0% found this document useful (0 votes)
6 views6 pages

More Mcqs Data Structure and Algorithms [Set 5]

The document contains multiple-choice questions related to Data Structures and Algorithms, focusing on sorting methods such as bubble sort and selection sort, as well as programming concepts like pointers and structures. Each question is followed by four answer options, with the correct answer indicated. The content is structured as a quiz format, suitable for testing knowledge in DSA.

Uploaded by

mmaimsalim95
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views6 pages

More Mcqs Data Structure and Algorithms [Set 5]

The document contains multiple-choice questions related to Data Structures and Algorithms, focusing on sorting methods such as bubble sort and selection sort, as well as programming concepts like pointers and structures. Each question is followed by four answer options, with the correct answer indicated. The content is structured as a quiz format, suitable for testing knowledge in DSA.

Uploaded by

mmaimsalim95
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Data Structure and Algorithms (DSA)

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

202. Which of the following sorting method is the slowest?


A. quick sort
o m
B. merge sort
. c
C. bubble sort
te
D. none of these
a
Answer:C
q M
c
M
203. Consider that n elements are to be sorted.The worst case complexity of bubble
sort is____
A. o(1)
B. o(log2n)
C. o(n)
D. o(n2)
Answer:D

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

207. Total number of comparision in bubble sort is____


A. o(nlogn)
B. o(n2)
C. o(n)
D. none of these
Answer:B

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

209. The selection sort is basically a method of repeated


A. interchange
B. searching
C. position adjustment
D. none of these

View all MCQ's at McqMate.com


Answer:C

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

211. If two string are identical then strcmp() function returns____


A. -1
B. 1
C. 0
D. none of these
Answer:C

212. How will you print \n on screen?


A. printf("\\n");
B. printf(\\\n\);
C. echo\\\\n;
D. printf("\\\\n");
Answer:A

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

View all MCQ's at McqMate.com


D. gets
Answer:D

215. What will be the output of the following code? Int


main(){printf("Hello","Word\n");return 0;}
A. hello
B. hello world
C. world
D. none of these
Answer:A

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

217. Pointer is a___________


A. a keyword used to create a variable
B. a variable that stores the address of some instruction
C. a variable that stores the address of some other variable
D. all of the above
Answer:C

218. ____operator is used to get the value stored at address stored in pointer
variable
A. *
B. &
C. dot
D. +
Answer:A

219. Which of the following statement is true about char ****a ?


A. a is pointer to a pointer to a pointer to char

View all MCQ's at McqMate.com


B. a is pointer to a pointer to a pointer to char
C. a is a pointer to a char pointer
D. a is a pointer to a pointer to a char
Answer:B

220. Are *ptr++ and ++*ptr are same?


A. no they are not same
B. yes they are one and the same
C. depends upon the value of ptr
D. none of these
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

222. Which of the following is a collection of different data type elements?


A. array
B. structure
C. string
D. all of the above
Answer:B

223. What is the similarity between structure,union and enum?


A. all of them let you define new values
B. all of them let you define new pointers
C. all of them let you define new structure
D. all of them let you define new data types
Answer:D

224. Which of the following can not be a structure member?


A. another structure

View all MCQ's at McqMate.com


B. array
C. function
D. none of these
Answer:C

225. The members of the union are accessed by____


A. dot operator
B. pointer -> operator
C. both a and b
D. none of these
Answer:C

View all MCQ's at McqMate.com

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy