C-Dynamic Memory Allocation and Data Structure Questions and Answers

Take Exam

Data Structure and Algorithms questions with answers are crucial for technical interviews and competitive exams like GATE, Infosys, and TCS. This topic tests understanding of arrays, linked lists, stacks, queues, trees, and sorting algorithms. Programming interview questions with answers in this section focus on time complexity, optimization, and problem-solving efficiency. Practicing DSA MCQs strengthens core programming logic, helping candidates excel in both written tests and coding interviews.

Detailed questions on dynamic memory use. For further practice, try database data models and data structures algorithms

C-Dynamic Memory Allocation and Data Structure

Showing 10 of 104 questions

41. 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?

  • Vaj(j)=0(logn)
  • Val(j)=0("n)
  • Val(j)=0(n)
  • Val(J)=(n logn)
Show Answer Report

42. 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?

  • ABCD
  • ABDC
  • DCAB
  • DCBA
Show Answer Report

43. The number of arguments used in realloc()is

  • 0
  • 1
  • 2
  • 3
Show Answer Report

44. In the circular array version of the queue class (with a fixed-sized array), which operations require linear time for their worst-case behavior?

  • Front
  • Push
  • Empty
  • None of these operations require linear time
Show Answer Report

45. In the linked-list version o the queue class, which operations require linear time for their worst-case behavior?

  • Front
  • Push
  • Empty
  • None of these operations require linear time.
Show Answer Report

46. In the circular array version  of the queue class (with a fixed-sized array), which operations require linear time for their worst-case behavior/

  • Front
  • Push
  • Empty
  • None of these operations require linear time
Show Answer Report

47. Queue is a:

  • Linear data structure
  • Non lenear data structure
  • Both a and b
  • None of the above
Show Answer Report

48. Queue works on the principle of

  • FIFO
  • LIFO
  • FCFS
  • Both a and c
Show Answer Report

49. 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 ?

  • (last % 1) + CAPACITY
  • (last %(1 +CAPACITY)
  • (LAST +1)% CAPACITY
  • last + (1% CAPACITY
Show Answer Report

50. The end at which a new element is added to a queue is called

  • front
  • rear
  • top
  • bottom
Show Answer Report
Questions and Answers for Competitive Exams Various Entrance Test