C-Dynamic Memory Allocation and Data Structure Questions and Answers

Practice Mode
Showing 10 of 104 questions
Q51
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?
  • A Neither changes
  • B Only front_ptr changes
  • C Only rear_ptr changes
  • D Both change
Answer: Option C
Q52
Suppose top is called on a priority queue that has exactly two entries with equal priority. How is the return value of top selected ?
  • A The implementation gets to choose either one.
  • B The one which was inserted first.
  • C The one which was inserted most recently.
  • D This can never happen (violates the perconditon)
Answer: Option B
Q53
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); }
  • A 200 200 300
  • B 100 200 300
  • C 200 200 200
  • D None of these
Answer: Option A
Q54
Which datastructure works to handle multiple request in a time sharing system for use of CPU time sheduling
  • A tree
  • B Queue
  • C Stack
  • D Linked list
Answer: Option B
Q55
Circular buffer concept in computer system is based on which data structure
  • A Queue
  • B Stack
  • C Trees
  • D Graph
Answer: Option A
Q56
Circular buffer concept in computer system is based on which data structure
  • A queue
  • B Stack
  • C Trees
  • D Graph
Answer: Option A
Q57
Find the output void main ( ) { void *p; p=malloc(2); *p=(int) 100; printf("%d", *p; }
  • A 100
  • B Garbage output
  • C Prints address where 100 is stored
  • D Compilation error
Answer: Option D
Q58
In the array version of the stack class (with a fixed-sized array), which operations require linea time for their worst-case behavior?
  • A is_empty
  • B peek
  • C pop
  • D None of these operations require linear time.
Answer: Option D
Q59
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); }
  • A 2c3
  • B 2d3
  • C 2 3
  • D 2 4
Answer: Option C
Q60
For a queue built using an array and containg n elements, the value of frong and rear would be respectively
  • A (-1, n)
  • B (0, n)
  • C (0, n-1)
  • D (-1, n)
Answer: Option C
Questions and Answers for Competitive Exams Various Entrance Test