Tuesday 11 March 2014

DATA STRUCTURES MCQS

1) The C language includes the header file standard input & output in 
 A. stdlib.h library
 B. stdio.h library
 C. conio.h library
 D. #include library
 Ans:- B

2) Consider the following recursive C function that takes two arguments. unsigned int foo(unsigned int n,unsigned int r) { if(n>0)return((n%r)+foo(n/r,r)); else return 0; } What is value of function foo when it called as foo(512,2)? 
 A. 9
 B. 2
 C. 8
 D. 11
Ans:- B

3) What would be output of the following program?
# define SQR(X) (X*X)
main()
{
int a, b=3;
a = SQR(b+2);
printf(“\n%d”, a);

 A. 25
 B. 11
 C. Error
 D. Garbage value
Ans:- B

4) Number of possible binary trees with 3 nodes is 
 A. 12
 B. 13
 C. 14
 D. 15
Ans:- D

5) The expression X=4+2%-8 evaluate 
 A. -6
 B. 6
 C. 4
 D. None
Ans:-B

6) The data structure needed to convert a recursion to an iterative procedure is 
 A. Queue
 B. Graph
 C. Stack
 D. Tree
Ans:-C

7) What punctuation is used to signal the beginning and end of code blocks? 
 A. { }
 B. -> and <-
 C. BEGIN and END
 D. ( and )
Ans:-A

8) What is the output of the following program segment?
main()
{
int i = ++2;
printf(“%d\n”, i);

 A. 3
 B. 2
 C. 0
 D. -1
Ans:-A

9) An algorithm that calls itself directly or indirectly is known as 
 A. Sub algorithm
 B. Recursion
 C. Polish notation
 D. Traversal algorithm
Ans:-B

10) A Compiler is _____________________. 
 A. A combination of computer hardware
 B. A program which translates from one high-level language to another
 C. A program which translates from one high-level to a machine level
 D. None of these
Ans:-C

11) A binary tree in which if all its levels except possibly the last, have the maximum number of nodes and all the nodes at the last level appear as far left as possible, is known as 
 A. Full binary tree
 B. AVL tree
 C. Threaded tree
 D. Complete binary tree
Ans:-A

12) Which allows deletion at only one end of the list but allows insertion at both ends of the list? 
 A. Deque
 B. Circular queue
 C. Output restricted deque
 D. Input restricted deque
Ans:-C

13) A technique for direct search is 
 A. Binary Search
 B. Linear Search
 C. Tree Search
 D. Hashing
Ans:-D

14) The maximum value that an integer constant can have is 
 A. .32767
 B. 32767
 C. 1.7014e+38
 D. –1.7014e+38
Ans:- B

15) What would be output of the following program?
#include "stdio.h"
main()
{
printf(“%d%d”, size of (NULL!), size of (“ “));

 A. 2 1
 B. 1 2
 C. 2 2
 D. 1 1
Ans:-  C

16) It is necessary to declare the type of function in the calling program if 
 A. Function returns an integer
 B. Function returns a non-integer value
 C. Function is not defined in the same file
 D. Function is called number of times
Ans:-  B

17) The smallest element of an array’s index is called its 
 A. Lower bound
 B. Upper bound
 C. Range
 D. Extraction
Ans:-A

18) C language was invented by 
 A. Abacus
 B. Charles babage
 C. Thomson
 D. Dennis Ritchie
Ans:- D

19) The _______ operator is a technique to forcefully convert one data type to the others 
 A. Cast
 B. Conversion
 C. Type
 D. Unary
Ans:-A

20) A binary tree whose every node has either zero or two children is called 
 A. Complete binary tree
 B. Binary search tree
 C. Extended binary tree
 D. None of above
Ans:-C

No comments:

Post a Comment