C-Dynamic Memory Allocation and Data Structure

C-Dynamic Memory Allocation and Data Structure
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
22. Return value of malloc is
  • Garbage value
  • Generic pointer
  • Integer pointer
  • None of these
Show Answer
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
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
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
26. A linked list is a
  • Static data structure
  • Dynamic data structure
  • Non linear data structure
  • None of these
Show Answer
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
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
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
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
Questions and Answers for Competitive Exams Various Entrance Test