C-Dynamic Memory Allocation and Data Structure

C-Dynamic Memory Allocation and Data Structure
51. I have implemented the queue with a linked list, keeping trck of a front pointer nd a rear pointer. Which of these pointers will change during tan insertion into a NONEMPTY queue?
  • Neither changes
  • Only front_ptr changes
  • Only rear_ptr changes
  • Both change
Show Answer
52. Suppose top is called on a priority queue that has exactly two entries with equal priority. How is the return value of top selected ?
  • The implementation gets to choose either one.
  • The one which was inserted first.
  • The one which was inserted most recently.
  • This can never happen (violates the perconditon)
Show Answer
53. Find the output
void main ( )
{
int *p, *q, *r;
q=(int *) malloc (sizeof (int));
p=q-1
r=q+1;
*p=100;
*q=200;
*r=300;
p++;
printf ("%d %d %d", *p, *q, *r);
}

  • 200 200 300
  • 100 200 300
  • 200 200 200
  • None of these
Show Answer
54. Which datastructure works to handle multiple request in a time sharing system for use of CPU time sheduling
  • tree
  • Queue
  • Stack
  • Linked list
Show Answer
55. Circular buffer concept in computer system is based on which data structure
  • Queue
  • Stack
  • Trees
  • Graph
Show Answer
56. Circular buffer concept in computer system is based on which data structure
  • queue
  • Stack
  • Trees
  • Graph
Show Answer
57. Find the output
void main ( )
{
void *p;
p=malloc(2);
*p=(int) 100;
printf("%d", *p;
}

  • 100
  • Garbage output
  • Prints address where 100 is stored
  • Compilation error
Show Answer
58. In the array version of the stack class (with a fixed-sized array), which operations require linea time for their worst-case behavior?
  • is_empty
  • peek
  • pop
  • None of these operations require linear time.
Show Answer
59. Find the output, if the input is 2c3
void main ( )
{
int *hi=25, *hello=4;
hi=(int*) malloc (sizeof (int));
scanf("%dc%d", &hi, &hello);
printf("%d %d", hi, hello);
}

  • 2c3
  • 2d3
  • 2 3
  • 2 4
Show Answer
60. For a queue built using an array and containg n elements, the value of frong and rear would be respectively
  • (-1, n)
  • (0, n)
  • (0, n-1)
  • (-1, n)
Show Answer
Questions and Answers for Competitive Exams Various Entrance Test