Top 350+ Solved Data Structure and Algorithms (DSA) MCQ Questions Answer
Q. Which of the following 'C' type is not a primitive data structure?
a. int
b. float
c. char
d. none of these
Q. The program fragmentint i = 263 ;putchar (i) ;prints
a. 263
b. ascii equivalent of 263
c. rings the bell
d. garbage
Q. The variables which can be accessed by all modules in a program, are called
a. local variables
b. internal variables
c. external variable
d. global variables
Q. The main measures of efficiency of an algorithm are
a. processor and memory
b. complexity and capacity
c. time and space
d. data and space
Q. The worst case occures in linear search algorithms when
a. item is somewhere in the middle of the array
b. item is not there in the array at all
c. item is last element in the array
d. item is last element in the array or is not there at all.
Q. What additional requirement is placed on an array, so that binary search may be used to locate an entry?
a. the array elements must form a heap
b. the array must have at least 2 entries.
c. the array must be sorted.
d. the array\s size must be a power of two.
Q. One difference between a queue and a stack is:
a. queues require dynamic memory, but stacks do not.
b. stacks require dynamic memory, but queues do not
c. queues use two ends of the structure; stacks use only one.
d. stacks use two ends of the structure, queues use only one.
Q. Which of the following formulas in big-O notation best represent the expression n²+35n+6?
a. o(n³)
b. o(n²)
c. o(n)
d. o(42)
Q. What term is used to describe an O(n) algorithm
a. constant
b. linear
c. logarithmic
d. quadratic
Q. The keyword used to transfer control from a function back to the calling function is
a. switch
b. goto
c. go back
d. return
Q. How many times the program will print "Amrutvahini" ? #include<stdio.h>int main(){ printf("Amrutvahini"); main(); return 0;}
a. infinite times
b. 32767 times
c. 65535 times
d. till stack overflows
Q. What will be the output of the program? #include<stdio.h>int i;int fun();int main(){ while(i) { fun(); main(); } printf("Hello\n"); return 0;}int fun(){ printf("Hi");}
a. hello
b. hi hello
c. no output
d. infinite loop