More Mcqs Data Structure and Algorithms [Set 5]
More Mcqs Data Structure and Algorithms [Set 5]
5 of 14 sets
201. A sort which compares adjacent elements in a list and switches wherever
necessary is _______
A. insertion sort
B. bubble sort
C. selection sort
D. none of these
Answer:B
204. In bubble sort,for a file of size n,after p iterations number of records in proper
position is____
A. n-p
B. n-p+1
C. n-p+2
D. p
Answer:A
205. In bubble sort,for a file of size n,during each pth pass the number of last
records left out are____
A. n-p
B. n-p+1
C. p
D. p-1
Answer:D
206. Given a file size n the number of times a given file is passed through in bubble
sort is____
A. n2
B. n-1
C. nlogn
D. logn
Answer:A
208. A sort which iteratively passes through a list to exchange the first element
with any element less than it and then repeats with a new first element is called
A. insertion sort
B. selection sort
C. bubble sort
D. merge sort
Answer:B
210. In selection sort of n elements,how many times is the swp function called in the
complete execution of the algorithm?
A. 1
B. n-1
C. n(n-1)/2
D. none of these
Answer:B
213. Following function is used to find the first occurrence of given string in
another string
A. strchar
B. strnset
C. strstr
D. strrchr
Answer:D
214. Which of the following is more appropriate for reading a multi_word string?
A. printf
B. scanf
C. put
216. What will be the output of the following code? Int main(){char str[9]="My
Computer";printf("%s\n",str);return 0;}
A. mycompute
B. syntax error
C. runtime error
D. none of these
Answer:B
218. ____operator is used to get the value stored at address stored in pointer
variable
A. *
B. &
C. dot
D. +
Answer:A
221. What will be the output of the following code? Void main(){int a=10;int
*b=&a;int **c=&b;printf("%d %d %d",a,*b,**c);}
A. 10 10 garbage
B. 10 garbage garbage
C. 10 10 10
D. syntax error
Answer:C