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

21. How many number of interchange to be done for sorting the keys in non-decreasing order by bubble sort of the given array. int A[ ]={7, 9, 11, 13, 15, 20, 3};

  • 5
  • 6
  • 7
  • None of the above
Show Answer Report

22. Return value of malloc is

  • Garbage value
  • Generic pointer
  • Integer pointer
  • None of these
Show Answer Report

23. What is the scope of memory allocated with malloc function ?

  • Local to the file in which it is allocated.
  • Global
  • Local to the block in which it is allocated.
  • Local to the function in which it is allocated.
Show Answer Report

24. Consider the following C function int f(int n) { static int i=1; if (n>=i) return n; n=n+1; i++; return f(n); } The value return by f(1) is

  • 0
  • 1
  • 2
  • 3
Show Answer Report

25. Consider the following C function : int f(int n) { static int r=0; if(n<=0) return 1; if (n>3) { r=n; return (f(n-1)+2; } return f(n-1)+8; } What is the value of f(1)?

  • 7
  • 8
  • 9
  • 10
Show Answer Report

26. A linked list is a

  • Static data structure
  • Dynamic data structure
  • Non linear data structure
  • None of these
Show Answer Report

27. How many number of comparison to be done for sorting the keys in non decreasing order by bubble sort of the given array int A[ ]={3, 7,. 9, 12, 15, 20};

  • 10
  • 15
  • 0
  • None of the above
Show Answer Report

28. An Abstract Data Type (ADT) is :

  • same as an abstract class.
  • A data type that cannot be instantiated.
  • A data type for which only the operations defined on it can be used butnone else.
  • All of the above
Show Answer Report

29. Find closed form of the recurrence. F (n) =1             if n=1 F (n)=F(n-1+n    otherwise

  • n* (n+1)/2
  • n*n/2
  • (n+1( * (n+2)/2
  • None of these
Show Answer Report

30. How many numbeer of comparison is required to find the minimum and maximum at a given list A element having a number of elements.

  • 2n-3
  • 2n-2
  • 2n
  • 2n-1
Show Answer Report
Questions and Answers for Competitive Exams Various Entrance Test