Home
MCQS
Data structure MCQ Quiz Hub
Data Structure and Algorithms (DSA) set 3
Choose a topic to test your knowledge and improve your Data structure skills
1. The selection sort is basically a method of repeated
interchange
searching
position adjustment
None of These
2. In selection sort of n elements,how many times is the swp function called in the complete execution of the algorithm?
1
n-1
n(n-1)/2
none of these
3. If two string are identical then strcmp() function returns____
A. -1 B. 1 D. none of these
1
0
None of These
4. How will you print on screen?
printf("\n");
printf(\ );
echo\\n;
printf("\\n");
5. Following function is used to find the first occurrence of given string in another string
strchar
strnset
strstr
strrchr
6. Which of the following is more appropriate for reading a multi_word string?
printf
scanf
put
gets
7. What will be the output of the following code? Int main(){printf("Hello","Word ");return 0;}
hello
hello world
world
none of these
8. What will be the output of the following code? Int main(){char str[9]="My Computer";printf("%s ",str);return 0;}
mycompute
syntax error
runtime error
None of These
9. Pointer is a___________
a keyword used to create a variable
a variable that stores the address of some instruction
a variable that stores the address of some other variable
All of the above
10. __operator is used to get the value stored at address stored in pointer variable
*
&
dot
+
11. Which of the following statement is true about char ****a ?
a is pointer to a pointer to a pointer to char
a is pointer to a pointer to a pointer to char
a is a pointer to a char pointer
a is a pointer to a pointer to a char
12. Are *ptr++ and ++*ptr are same?
no they are not same
yes they are one and the same
depends upon the value of ptr
None of These
13. Which of the following is a collection of different data type elements?
array
structure
string
all of the above
14. Which of the following is a collection of different data type elements?
array
structure
string
all of the above
15. Which of the following is a collection of different data type elements?
array
structure
string
All of the above
16. What is the similarity between structure,union and enum?
all of them let you define new values
all of them let you define new pointers
all of them let you define new structure
all of them let you define new data types
17. Which of the following can not be a structure member?
another structure
array
function
None of These
18. The members of the union are accessed by____
dot operator
pointer -> operator
both a and b
None of These
19. a-> is systematically correct if_____
a is a pointer to a structure in which b is a field
a and b are structure
a is a structure and b is a pointer to a structure
a is a pointer to a structure and b is a structure
20. How many bits are absolutely necessary to store an ASCII character ?
7
8
15
16
21. The result of 0001 1010 / 0001 0101 is
0001 1111
1111 0001
0001 0000
None of These
22. The result of 0001 1010 & 0000 1000 is ___
0001 1111
1111 0001
0000 1000
None of These
23. The result of 0001 1010 ~ 0100 0011 is
0101 1001
1010 0100
0000 0010
None of These
24. The result of 0001 1010^0001 0000 is____
0101 1001
1010 0100
0000 0010
None of These
25. The result of 0001 1010 << 2 is____
0101 1100
0110 1000
0001 1110
None of These
26. The result of 0001 1010 >>2 is____
0101 1100
0010 1110
0000 0110
None of These
27. The most significant bit is lost in following operation
&lt;&lt;
&gt;&gt;
&amp;
/
28. The result of i)true AND false II)false or false
i)is true and ii)is true
i)is true and ii)is false
i)is false and ii)is true
i)is false and ii)is false
29. What will be output if you will compile and execute the following c code? #include<stdio.h> int main(){ int i=320; char *ptr=(char *)&i; printf("%d",*ptr); return 0; }
320
1
64
None of the above
30. What will be output if you will compile and execute the following c code? #include<stdio.h> #define x 5+2 int main(){ int i; i=x*x*x; printf("%d",i); return 0; }
343
27
133
compiler error
31. What will be output if you will compile and execute the following c code? #include<stdio.h> int main(){ char c=125; c=c+10; printf("%d",c); return 0; }
135
+inf
-121
-8
32. What will be output if you will compile and execute the following c code? #include<stdio.h> int main(){ float a=5.2; if(a==5.2) printf("Equal"); else if(a<5.2) printf("Less than"); else printf("Greater than"); return 0; }
equal
less than
greater than
compiler error
33. What will be output if you will compile and execute the following c code? #include<stdio.h> int main(){ int i=4,x; x=++i + ++i + ++i; printf("%d",x); return 0; }
21
18
12
Compile time error
34. What will be output if you will compile and execute the following c code? #include<stdio.h> int main(){ int a=2; if(a==2){ a=~a+2<<1; printf("%d",a); } else{ break; } return 0;
it will print nothing
-3
-2
compiler error
35. What will be output if you will compile and execute the following c code? #include<stdio.h> int main(){ int a=10; printf("%d %d %d",a,a++,++a); return 0; }
12 11 11
12 10 10
11 11 12
10 10 12
36. What will be output if you will compile and execute the following c code? #include<stdio.h> int main(){ char *str="Hello world"; printf("%d",printf("%s",str)); return 0; }
10hello world
11hello world
hello world12
hello world13
37. What will be output if you will compile and execute the following c code? #include <stdio.h> #include <string.h> int main(){ char *str=NULL; strcpy(str,"cquestionbank"); printf("%s",str); return 0; }
cquestionbank
cquestionbank\0
(null)
it will print nothing
38. #include <stdio.h> #include <string.h> int main(){ int i=0; for(;i<=2;) printf(" %d",++i); return 0; }
0 1 2 3
0 1 2
1 2 3
compiler error
39. What will be output if you will compile and execute the following c code? #include<stdio.h> int main(){ int x; for(x=1;x<=5;x++); printf("%d",x); return 0; }
4
5
6
compiler error
40. What will be output if you will compile and execute the following c code? #include<stdio.h> int main(){ printf("%d",sizeof(5.2)); return 0; }
2
4
8
10
41. What will be output if you will compile and execute the following c code? #include <stdio.h> #include <string.h> int main(){ char c=' 8'; printf("%d",c); return 0; }
8
8
9
Compile error
42. What will be output if you will compile and execute the following c code? #include<stdio.h> #define call(x,y) x##y int main(){ int x=5,y=10,xy=20; printf("%d",xy+call(x,y)); return 0; }
35
510
15
40
43. What will be output if you will compile and execute the following c code? #include<stdio.h> int * call(); int main(){ int *ptr; ptr=call(); printf("%d",*ptr); return 0; } int * call(){ int a=25; a++; return &a; }
25
26
any adress
garbage value
44. . What is error in following declaration? struct outer{ int a; struct inner{ char c; }; };
nesting of structure is not allowed in c
it is necessary to initialize the member variable
inner structure must have name
outer structure must have name
45. What will be output if you will compile and execute the following c code? #include<stdio.h> int main(){ int array[]={10,20,30,40}; printf("%d",-2[array]); return 0; }
-60
-30
60
garbage value
46. 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; }
equal
less than
greater than
compiler error
47. 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; }
5
6
7
0
48. 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; }
12
8
4
1
49. C language was invented by
abacus
charles babage
thomson
dennis ritchie
50. The data type created by the data abstraction process is called
class
structure
abstract data type
user defined data type
51. A variable which is visible only in the function in which it is defined, is called
static
auto
external
local
52. Unsigned integers occupies
two bytes
four bytes
one bytes
eight bytes
53. Which of the following data structure is linear type ?
strings
lists
queues
All of the above
54. Which of the following data structure is linear type ?
strings
lists
queues
all of the above
55. In C, if you pass an array as an argument to a function, what actually gets passed?
value of elements in array
first element of the array
base address of the array
address of the last element of array
56. Which data structure allows deleting data elements from front and inserting at rear?
stack
queue
dequeue
binary search tree
57. Queue is a -------------- List .
fifo
lifo
lilo
liso
58. A node in a linked list must contain at least
three fields
two fields
four fields
one field
59. 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
f(n) x g(n)
max ( f(n),g(n))
min (f(n),g(n))
f(n) + g(n)
60. Big O notation is defined for
time and space complexity
optimality
seaching
none of the above
Submit