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

More Mcqs Data Structure and Algorithms (Set 7)

The document contains a series of multiple-choice questions (MCQs) related to Data Structures and Algorithms (DSA) in C programming. Each question includes a code snippet or concept, followed by four answer options, with the correct answer indicated. Topics covered include structure declarations, data types, algorithm complexities, and characteristics of various data structures.

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)
20 views6 pages

More Mcqs Data Structure and Algorithms (Set 7)

The document contains a series of multiple-choice questions (MCQs) related to Data Structures and Algorithms (DSA) in C programming. Each question includes a code snippet or concept, followed by four answer options, with the correct answer indicated. Topics covered include structure declarations, data types, algorithm complexities, and characteristics of various data structures.

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

Data Structure and Algorithms (DSA)

7 of 14 sets

301. What is error in following declaration?


struct outer{ int a;
struct inner{
char c;
};
};
A. nesting of structure is not allowed in c
B. it is necessary to initialize the member variable
C. inner structure must have name
D. outer structure must have name
Answer:C
o m
302. What will be output if you will compile e
. c
#include<stdio.h> int main(){
a t and execute the following c code?

printf("%d",-2[array]); return 0;qM


int array[]={10,20,30,40};

} c
A. -60 M
B. -30
C. 60
D. garbage value
Answer:B

303. What will be output if you will compile and execute the following c code?
#include<stdio.h>
int main(){
int i=10;
static int x=i;
if(x==i)
printf("Equal");
else if(x>i)
printf("Greater than");
else
printf("Less than"); return 0;
}
A. equal
B. less than
C. greater than
D. compiler error
Answer:D

304. What will be output if you will compile and execute the following c code?
#include<stdio.h>
#define max 5;
int main(){
int i=0;
i=max++;
printf("%d",i++); return 0;
}
A. 5
B. 6
C. 7
D. 0
Answer:D

305. What will be output if you will compile and execute the following c code?
#include<stdio.h>
int main(){
double far* p,q;
printf("%d",sizeof(p)+sizeof q); return 0; }
A. 12
B. 8
C. 4
D. 1
Answer:A

306. C language was invented by


A. abacus
B. charles babage
C. thomson
D. dennis ritchie

View all MCQ's at [Link]


Answer:D

307. The data type created by the data abstraction process is called
A. class
B. structure
C. abstract data type
D. user defined data type
Answer:C

308. A variable which is visible only in the function in which it is defined, is called
A. static
B. auto
C. external
D. local
Answer:D

309. Unsigned integers occupies


A. two bytes
B. four bytes
C. one bytes
D. eight bytes
Answer:C

310. Which of the following data structure is linear type ?


A. strings
B. lists
C. queues
D. all of the above
Answer:D

311. In C, if you pass an array as an argument to a function, what actually gets


passed?
A. value of elements in array
B. first element of the array
C. base address of the array
D. address of the last element of array

View all MCQ's at [Link]


Answer:C

312. Which data structure allows deleting data elements from front and inserting
at rear?
A. stack
B. queue
C. dequeue
D. binary search tree
Answer:B

313. Queue is a -------------- List .


A. fifo
B. lifo
C. lilo
D. liso
Answer:A

314. Stack is a -------------List.


A. lifo
B. fifo
C. lilo
D. lito
Answer:A

315. A node in a linked list must contain at least


A. three fields
B. two fields
C. four fields
D. one field
Answer:B

316. An algorithm is made up of two independent time complexities f (n) and g (n).
Then the complexities of the algorithm is in the order of
A. f(n) x g(n)
B. max ( f(n),g(n))
C. min (f(n),g(n))

View all MCQ's at [Link]


D. f(n) + g(n)
Answer:B

317. Big O notation is defined for


A. time and space complexity
B. optimality
C. seaching
D. none of the above
Answer:A

318. Consider that n elements are to be sorted. What is the worst case time
complexity of Bubble sort?
A. o(1)
B. o(log2n)
C. o(n)
D. o(n^2)
Answer:D

319. The complexity of Binary search algorithm is


A. o(n)
B. o(log n)
C. o(n2)
D. o(n log n)
Answer:B

320. The complexity of linear search algorithm is


A. o(n)
B. o(log n)
C. o(n2)
D. o(n log n)
Answer:A

321. Which of the following data structure is linear data structure?


A. trees
B. graphs
C. arrays

View all MCQ's at [Link]


D. none of above
Answer:C

322. What is the maximun number of dimensions an array in C may have?

A. two
B. eight
C. twenty
D. theoratically no limit. the only practical limits are memory size and compilers
Answer:D

323. An external variable


A. is globally accessible by all functions
B. has a declaration
C. will be initialized to 0 if not initialized
D. all of these
Answer:D

324. The declaration "unsigned u" indicates u is a/an

A. unsigned character
B. unsigned integer
C. character
D. none of\ these
Answer:B

325. A declaration "short int" is used for variables

A. which have a short duration in a program


B. which have short names
C. which may require less storage than normal integers
D. all of these
Answer:C

View all MCQ's at [Link]

You might also like