C and Ds MCQ Jeca 05.06.22

Download as pdf or txt
Download as pdf or txt
You are on page 1of 11

1.

A binary search tree whose left subtree and right subtree differ in hight by
at most 1 unit is called ……
A. avl tree
B. red-black tree
C. lemma tree
D. none of the above

2. Stack is also called as


A. last in first out
B. first in last out
C. last in last out
D. first in first out
3. …………… is not the component of data structure.
A. operations
B. storage structures
C. algorithms
D. none of above
4. Which data structure is used in breadth first search of a graph to hold
nodes?
A. stack
B. queue
C. tree
D. array
5. The number of comparisons done by sequential search is ………………
A. (n/2)+1
B. (n+1)/2
C. (n-1)/2
D. (n+2)/2
6. In ……………, search start at the beginning of the list and check every
element in the list.
A. linear search
B. binary search
C. hash search
D. binary tree search
7. What will be the value of top, if there is a size of stack STACK_SIZE is 5
A. 5
B. 6
C. 4
D. none
8. The property of binary tree is
A. the first subset is called left subtree
B. the second subtree is called right subtree
C. the root cannot contain null
D. the right subtree can be empty
9. Any node is the path from the root to the node is called
A. successor node
B. ancestor node
C. internal node
D. none of the above
10.Which is/are the application(s) of stack
A. function calls
B. large number arithmetic
C. evaluation of arithmetic expressions
D. all of the above

11.…………………. Is a directed tree in which outdegree of each node is less than


or equal to two.
A. unary tree
B. binary tree
C. trinary tree
D. both b and c
12.Arrays are best data structures …………
A. for relatively permanent collections of data
B. for the size of the structure and the data in the structure are
constantly changing
C. for both of above situation
D. for none of the above
13.The time complexity of quick sort is …………..
A. o(n)
B. o(n2)
C. o(n log n)
D. o(log n)
14.The operation of processing each element in the list is known as
A. sorting
B. merging
C. inserting
D. traversal

15.How many times CppBuzz.com is printed?

int main()

while(1)

printf("CppBuzz.com");

}
return 0;

(A) 1 time
(B) Compilation Error
(C) Infinite times
(D) Runtime Error
16.What is output of below program?

int main()

int i,j,count;

count=0;

for(i=0; i<5; i++);

for(j=0;j<5;j++);

count++;

printf("%d",count);
return 0;

A) 55
(B) 54
(C) 1
(D) 0
17.What is output of below program?

int main()

int i,j,k,count;

count=0;

for(i=0;i<5;i++)

for(j=0;j<5;j++)

count++;

printf("%d",count);

return 0;

}
(A) 5
(B) 10
(C) 25
(D) 50

18. What is output of below program?

int main()

int i;

for(i=0; i<5; ++i++)

printf("Hello");

return 0;

(A) Hello is printed 5 times


(B) Compilation Error
(C) Hello is printed 2 times
(D) Hello is printed 3 times

19. What is output of below program?

int main()

for(; ;);
for(; ;);

printf("Hello");

return 0;

(A) Compilation Error


(B) Runtime Error
(C) Nothing is printed
(D) Hello is printed infinite times

20. What is the output of below program?

int main()

for(; ;)

for(; ;)

printf("Hello..");

return 0;

(A) Compilation Error


(B) Runtime Error
(C) Hello is printed one time
(D) Hello is printed infinite times

21. What is the meaning of below lines?

void sum (int, int);


(A) sum is function which takes int arguments
(B) sum is a function which takes two int arguments and returns void
(C) it will produce compilation error
(D) Can't comment

22. What is output of below code?

int main()

char name[]="Cppbuz";

int len;

int size;

len = strlen(name);

size = size_of(name);

printf("%d,%d",len,size);

return 0;

(A) 6,6
(B) 6,7
(C) 7,7
(D) 0,0

23. What is the following is invalid header file in C?

(A) math.h
(B) mathio.h
(C) string.h
(D) ctype.h
24. Libray function getch() belongs to which header file?

(A) stdio.h
(B) conio.h
(C) stdlib.h
(D) stdlibio.h

25. What should be the output:

int main()

int a = 10/3;

printf("%d",a);

return 0;

A) 3.33
(B) 3.0
(C) 3
(D) 0

26. Which of the following is executed by Preprocess?

(A) #include<stdio.h>
(B) return 0
(C) void main(int argc , char ** argv)
(D) None of above

27. int main()

{
int a = 10.5;

printf("%d",a);

return 0;

(A) 10.5
(B) 10
(C) 0
(D) Compilation Error

28. int main()

int a = 5;

int b = 10;

int c = a+b;

printf("%i",c);

(A) 0
(B) 15
(C) Undefined i
(D) Any other Compiler Error

29. Which compilation unit is responsible for adding header files content in the
source code?

(A) Linker
(B) Compiler
(C) Assembler
(D) Preprocessor
30. If the size of the array is less than the number of initializers then

(A) Generates an error message


(B) Extra values are being ignored
(C) Size of Array is increased
(D) Size is neglected when values are given

You might also like