C-Dynamic Memory Allocation and Data Structure Questions and Answers

Practice Mode
Showing 10 of 104 questions
Q41
Consider the following C-program frangment in which i,j and n are integer variables. For (i=n, j=0; i>0; i/=2, j+=i); Let val(j) denote the value stored in the variable J after termination of the for loop. Which one of the following is true?
  • A Vaj(j)=0(logn)
  • B Val(j)=0("n)
  • C Val(j)=0(n)
  • D Val(J)=(n logn)
Answer: Option D
Q42
If the characters 'D', 'C', 'B', 'A' are placed in a queue ( in tha oreder), and then removed one at a time, in what order will they be removed?
  • A ABCD
  • B ABDC
  • C DCAB
  • D DCBA
Answer: Option D
Q43
The number of arguments used in realloc()is
  • A 0
  • B 1
  • C 2
  • D 3
Answer: Option C
Q44
In the circular array version of the queue class (with a fixed-sized array), which operations require linear time for their worst-case behavior?
  • A Front
  • B Push
  • C Empty
  • D None of these operations require linear time
Answer: Option D
Q45
In the linked-list version o the queue class, which operations require linear time for their worst-case behavior?
  • A Front
  • B Push
  • C Empty
  • D None of these operations require linear time.
Answer: Option D
Q46
In the circular array version  of the queue class (with a fixed-sized array), which operations require linear time for their worst-case behavior/
  • A Front
  • B Push
  • C Empty
  • D None of these operations require linear time
Answer: Option D
Q47
Queue is a:
  • A Linear data structure
  • B Non lenear data structure
  • C Both a and b
  • D None of the above
Answer: Option A
Q48
Queue works on the principle of
  • A FIFO
  • B LIFO
  • C FCFS
  • D Both a and c
Answer: Option D
Q49
data is a circular array of CAPACITY elements, and last is an index into that array, what is the formula for the index after last ?
  • A (last % 1) + CAPACITY
  • B (last %(1 +CAPACITY)
  • C (LAST +1)% CAPACITY
  • D last + (1% CAPACITY
Answer: Option C
Q50
The end at which a new element is added to a queue is called
  • A front
  • B rear
  • C top
  • D bottom
Answer: Option B
Questions and Answers for Competitive Exams Various Entrance Test