Intel Interview Question Software Engineer / Developers

  • intel-interview-questions
    0
    of 0 votes
    3
    Answers

    Write functions for insertion and deletion in a circular queue implemented using an array in C.
    Hint: Remove the node from the end.
    Add a node in the front. Move the pointer for removal and insertion. Pointer is just a counter for the index. Modulus it by size of array so that it circles from 0-n.
    When pointers match , array is full.

    - KaranGoswamiKenZ on May 02, 2012 in United States for Firmware Report Duplicate | Flag
    Intel Software Engineer / Developer Arrays

Team: Firmware
Country: United States
Interview Type: In-Person


Comment hidden because of low score. Click to expand.
0
of 0 vote

you forgot to bumped the top while insertion

- Anonymous on October 11, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

void enqueue(void)
{
     int x;
     if((front==0&&rear==max-1)||(front==rear+1))                         //condition for full Queue
     { 
          printf("Queue is overflow\n"); return;
     }
     if(front==-1)
     {
          front=rear=0;
     }
     else
     {
          if(rear==max-1)
          {
               rear=0;
          }
          else
          {
               rear++;
          }
     }
     printf("enter the data:\n");
     scanf("%d",&x);
     q[rear]=x;
     printf("%d succ. inserted\n",x);
     return;
}
void dequeue(void)
{
     int y;
     if(front==-1)
     {
          printf("Queue  is underflow\n");  return;
     }
     y=q[front];
     if(front==rear)
     {
          front=rear=-1;
     }
     else
     {
          if(front==max-1)
          {
               front=0;
          }
          else
          {
               front++;
          }
     }
     printf("%d succ. deleted\n",y);
     return;
}

- main on July 01, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

class Queue{

int arr[size];
int top;
int bottom;


removeElement(){

if(bottom+1%size !=top && bottom!=top )
bottom++;
}


insertElement(int ele){
if(top+1%size != bottom)
arr[top+1%size]=ele;
}

}

- Anonymous on May 05, 2012 | Flag Reply


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book walking you through getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More