C-Dynamic Memory Allocation and Data Structure Questions and Answers

Practice Mode
Showing 10 of 104 questions
Q21
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};
  • A 5
  • B 6
  • C 7
  • D None of the above
Answer: Option B
Q22
Return value of malloc is
  • A Garbage value
  • B Generic pointer
  • C Integer pointer
  • D None of these
Answer: Option B
Q23
What is the scope of memory allocated with malloc function ?
  • A Local to the file in which it is allocated.
  • B Global
  • C Local to the block in which it is allocated.
  • D Local to the function in which it is allocated.
Answer: Option B
Q24
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
  • A 0
  • B 1
  • C 2
  • D 3
Answer: Option B
Q25
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)?
  • A 7
  • B 8
  • C 9
  • D 10
Answer: Option C
Q26
A linked list is a
  • A Static data structure
  • B Dynamic data structure
  • C Non linear data structure
  • D None of these
Answer: Option B
Q27
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};
  • A 10
  • B 15
  • C 0
  • D None of the above
Answer: Option B
Q28
An Abstract Data Type (ADT) is :
  • A same as an abstract class.
  • B A data type that cannot be instantiated.
  • C A data type for which only the operations defined on it can be used butnone else.
  • D All of the above
Answer: Option B
Q29
Find closed form of the recurrence. F (n) =1             if n=1 F (n)=F(n-1+n    otherwise
  • A n* (n+1)/2
  • B n*n/2
  • C (n+1( * (n+2)/2
  • D None of these
Answer: Option A
Q30
How many numbeer of comparison is required to find the minimum and maximum at a given list A element having a number of elements.
  • A 2n-3
  • B 2n-2
  • C 2n
  • D 2n-1
Answer: Option A
Questions and Answers for Competitive Exams Various Entrance Test