R4RIN
MCQS
Data structure MCQ Quiz Hub
Data Structure and Algorithms (DSA) set 4
Choose a topic to test your knowledge and improve your Data structure skills
1. 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
2. Are *ptr++ and ++*ptr are same?
A. no they are not same B. C.
yes they are one and the same
yes they are one and the same
none of these
3. 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);}
0 10 garbage
10 garbage garbage
10 10 10
syntax error
4. Which of the following is a collection of different data type elements?
array
structure
string
all of the above
5. 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
6. The members of the union are accessed by____
dot operator
pointer -> operator
both a and b
none of these
7. How many bits are absolutely necessary to store an ASCII character ?
7
8
15
16
8. The result of 0001 1010 & 0000 1000 is ___
0001 1111
1111 0001
0000 1000
None of These
9. The result of 0001 1010^0001 0000 is____
0101 1001
1010 0100
0000 0010
none of these
10. The result of 0001 1010 << 2 is____
0101 1100
0110 1000
0001 1110
None of These
11. The most significant bit is lost in following operation
&lt;&lt;
&gt;&gt;
&amp;
/
12. 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
13. 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
Compiler Error
14. 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
15. . #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
16. 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
17. 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
18. 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
19. 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
20. C language was invented by
abacus
charles babage
thomson
dennis ritchie
21. The data type created by the data abstraction process is called
class
structure
abstract data type
user defined data type
22. A variable which is visible only in the function in which it is defined, is called
A. static
auto
external
local
23. Which of the following data structure is linear type ?
strings
lists
queues
All of the above
24. Unsigned integers occupies
two bytes
four bytes
one bytes
eight bytes
25. Unsigned integers occupies
two bytes
four bytes
one bytes
eight bytes
26. 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
27. Which data structure allows deleting data elements from front and inserting at rear?
stack
queue
dequeue
binary search tree
28. Queue is a -------------- List .
fifo
lifo
lilo
liso
29. A node in a linked list must contain at least
three fields
two fields
four fields
one field
30. Consider that n elements are to be sorted. What is the worst case time complexity of Bubble sort?
o(1)
o(log2n)
o(n)
o(n^2)
31. The complexity of linear search algorithm is
o(n)
o(log n)
o(n2)
o(n log n)
32. Which of the following data structure is linear data structure?
trees
graphs
arrays
none of above
33. What is the maximun number of dimensions an array in C may have?
two
eight
twenty
theoratically no limit. the only practical limits are memory size and compilers
34. An external variable
is globally accessible by all functions
has a declaration
will be initialized to 0 if not initialized
All of the three
35. The declaration "unsigned u" indicates u is a/an
unsigned character
unsigned integer
character
none of these
36. A declaration "short int" is used for variables
which have a short duration in a program B. C.
which have short names
which may require less storage than normal integers
All of the three
37. Which of the following 'C' type is not a primitive data structure?
int
float
char
none of these
38. The program fragment int i = 263 ; putchar (i) ; prints
263
ascii equivalent of 263
rings the bell
garbage
39. The variables which can be accessed by all modules in a program, are called
local variables
internal variables
external variable
global variables
40. The main measures of efficiency of an algorithm are
processor and memory
complexity and capacity
time and space
data and space
41. The worst case occures in linear search algorithms when
item is somewhere in the middle of the array
item is not there in the array at all
item is last element in the array
item is last element in the array or is not there at all.
42. the terms push and pop are related to
stack
queue
array
None of the above
43. What will be the output of the program? #include<stdio.h> int main() { int X=40; { int X=20; printf("%d ", X); } printf("%d ", X); return 0; }
40 40
20 20
20
error
44. What additional requirement is placed on an array, so that binary search may be used to locate an entry?
the array elements must form a heap
the array must have at least 2 entries.
the array must be sorted.
the arrays size must be a power of two.
45. One difference between a queue and a stack is:
queues require dynamic memory, but stacks do not.
stacks require dynamic memory, but queues do not
queues use two ends of the structure; stacks use only one.
stacks use two ends of the structure, queues use only one.
46. If the characters 'D', 'C', 'B', 'A' are placed in a queue (in that order), and then removed one at a time, in what order will they be removed?
abcd
abdc
dcab
dcba
47. Which of the following formulas in big-O notation best represent the expression n²+35n+6?
o(n³)
o(n²)
o(n)
o(42)
48. What term is used to describe an O(n) algorithm
constant
linear
logarithmic
quadratic
49. The keyword used to transfer control from a function back to the calling function is
switch
goto
go back
return
50. How many times the program will print "Amrutvahini" ? #include<stdio.h> int main() { printf("Amrutvahini"); main(); return 0; }
infinite times
32767 times
65535 times
till stack overflows
51. What will be the output of the program? #include<stdio.h> int i; int fun(); int main() { while(i) { fun(); main(); } printf("Hello "); return 0; } int fun() { printf("Hi"); }
hello
hi hello
no output
infinite loop
52. In a linked list, the pointer of the last node contains a special value, called the ______ pointer.
null B. C. D.
zero
link
next pointer
53. In a ________ linked list, the last node's link field points to the first node of the list.
circularly
linearly
sequentially
indexed
54. The second part of the node, is called _______ field, and contains the address of the next node in the list.
pointer
field
node
link
55. The link list also contains a list pointer variable called start or ________.
name
field
node
link
56. A ________ linked list is a linked list structure in which each node has a pointer to both its successor and predecessor.
circularly
doubly
linear
sequential
57. _____ list is a special list that is maintained, which consists of unused memory cells.
linear
doubly linked
circularly linked
free storage
58. ______ is a technique using which a computer periodically collects all the deleted space onto the free storage list.
garbage collection
garbage compaction
linked list
free storage
59. ___ attacks the problem of fragmentation by moving all the allocated blocks to one end of memory, thus combining all the holes.
underflow
overflow
compaction
free storage
60. A ________ linked list is a linked list which always contains a special node, called the header node.
circular
grounded
header
doubly
61. A polynomial can be represented in a _______ by just storing the coefficient and exponent of each term.
array
linked list
queue
stack
62. ______ refers to situation where one wants to delete data form a data structure that is empty
free storage
underflow
overflow
compaction
63. ________ is an organization that provides faster request and return time response.
stack
queue
buddy system
recursion
64. _____ attacks the problem of fragmentation by moving all the allocated blocks to one end of memory, thus combining all the holes.
garbage collection
garbage compaction
buddy system
queue
65. A _______ list structure can be traversed in two directions-- in the forward direction from beginning of the list to end, or in the backward direction, from the end of the list to the beginning.
one way
linear array
two way
header
66. ____ header list combines the advantages of a two-way list and a circular header list.
one way
two way circular
two way
header
67. In linked list,a node contain
node,adrees field and data field
node number and data field
next adress field and information field
None of the above
68. In linked list,the logical order of elements
is same as their physical arrangement
is not necessarily equivalent to their physical arrangement
. is determined by their physical arrangement
none of the above
69. Null pointer is used to tell
end of linked list
empty pointer field of a structure
the linked list is empty
all of the above
70. List pointer variable in linked list contains address of the
following node in the first
current node in the first
first node in the first
none of the above
71. Because of linear structure of linked list having linear ordering,there is similarity between linked list and array in
insertion of a node
deletion of a node
traversal of elements of list
None of the above
72. Searching of linked list requires linked list to be created
in stored order only
in any order
without underflow condition
None of the above
73. A circular list can be used to represent
a stack
a queue
a tree
both a and b
74. To insert a node in a circular list at rear end it should be inserted at …...of the queue
front position
front-1position
rear position
rear-1 position
75. In a circularly linked list organisation ,insertion of a record involves the modifications of
no pointer
1 pointer
2 pointer
3 pointer
76. What is true about linked kist?
it is a linked structure,where each data gives the address of the next data
it is a dynamic data structure
it is a static data structure
both (a) and (b)
77. A node of linked list contains_______
data field
a self referential pointer
both (a)and(b)
only b
78. Which nodes contains a null pointer in a linked list?
first node
middle node
last node
both (a) and (b)
79. Deletion of a node from an empty linked list will cause________
underflow
overflow
run time error
all of the above
80. Insertion in a linked list requires modification of____pointers
1
2
3
4
Submit