0% found this document useful (0 votes)
42 views12 pages

CS301 Grand Quiz Preparation

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)
42 views12 pages

CS301 Grand Quiz Preparation

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/ 12

SOHAIL ZUBAIR

PLEASE SUBSCRIBE MY CHANNEL ON YOUTUBE “TECH SOLO SOFT”


CS301 –DATA STRUCTURE GRAND QUIZ PREPARATION FILE

1. An efficient program executes ________and helps ___________the usage of resources like


memory, disk.
a. Faster , minimize
b. Slower, maximize
c. Faster, maximize
d. Minimize, faster
2. As computer applications are becoming__________, so there is need for more resources
a. Efficient
b. Complex
c. Simple
d. None of given
3. Within an organization data should be arranged in a way that it is easily_____________.
a. Control
b. Secure
c. Accessible
d. Destroyed
4. The correct syntax to declare of array of 06 elements is?
a. int x[6];
b. int x[5];
c. int x{6};
d. int x{5};
5. An array is collection of cells of the ___________________type.
a. Different
b. Same
c. Integer
d. String
6. Array occupies _____________memory area in the computer.
a. Separate
b. Collective
c. Different
d. Contiguous
7. Which of these best describes an array?
a) A data structure that shows a hierarchical behavior
b) Container of objects of similar types
c) Arrays are immutable once initialized
d) Array is not a data structure
8. How do you initialize an array in C?
a) int arr[3] = (1,2,3);
b) int arr(3) = {1,2,3};
c) int arr[3] = {1,2,3};
d) int arr(3) = (1,2,3);
9. The _________ data structure is among the most generic of data structures.
a. Array
b. List
c. Stacks
d. Queues
10. List is a set of elements in an/a ________________ order.
a. Exponential
b. Static
c. Dynamic
d. Linear
11. A List is collection of item of the ___________________type.
a. Different
b. Same
c. Integer
d. String
12. The function of clear(); perform what in List data structure ?
a. Remove element at some position in the list
b. Set one list to be a copy of another
c. Clear a list (remove all elements)
d. None of the given
13. It is not necessary to always start the indexing from zero. Sometimes, it is required to start the
indexing from 1.
a. True
b. False
14. In this method, we do not add a new element to the list but simply move the pointer one
element ahead.
a. start()
b. tail()
c. next()
d. back()
15. When does the ArrayIndexOutOfBoundsException occur?
a) Compile-time
b) Run-time
c) Not an error
d) Not an exception at all
16. A linear list of elements in which deletion can be done from one end (front) and insertion can
take place only at the other end (rear) is known as a ?
a) Queue
b) Stack
c) Tree
d) Linked list
17. Process of inserting an element in stack is called ____________
a) Create
b) Push
c) Evaluation
d) Pop
18. The data structure required for Breadth First Traversal on a graph is?
a) Stack
b) Array
c) Queue
d) Tree
19. What does ‘stack underflow’ refer to?
a) accessing item from an undefined stack
b) adding items to a full stack
c) removing items from an empty stack
d) index out of bounds exception
20. What is the time complexity of pop() operation when the stack is implemented using an array?
a) O(1)
b) O(n)
c) O(logn)
d) O(nlogn)
21. It is impossible that one element of the array is located at a memory location while the other
element is located somewhere far from it in the memory.
a. True
b. False
22. When we have declared the size of the array, it is ___________ to increase or decrease it during
the execution of the program.
a. Possible
b. Not possible
c. Depend on the programming language
d. Depend on the compiler
23. While calling a function, we pass values of variables to it. Such functions are known as
a. Call by value
b. Call by reference
c. Call by address
d. Call by location
24. A node comprises ____________ fields.
a. Two
b. One
c. Three
d. Four
25. While calling a function, instead of passing the values of variables, we pass address of variables
(location of variables) to the function known as
a. Call by value
b. Call by reference
c. Call by address
d. Call by location
26. The local variables of a function are created on____________.
a. Heap
b. Array
c. call stack
d. Linked List
27. All the variables or objects created in a function that we want to access later are created on
memory heap, sometimes called?
a. Memory bank
b. Heap store
c. Stack
d. free store
28. Heap is an area in computer memory that is allocated ____________________.
a. Statically
b. Manually
c. Dynamically
d. Randomly
29. All the objects created using new operator have to be explicitly destroyed using the _________.
a. delete operator
b. kill operator
c. remove operator
d. clear operator
30. Nameless objects (objects accessed by pointers) are called _______________.
a. Free object
b. Pointer object
c. anonymous objects
d. none of given
31. A linear list of elements in which deletion can be done from one end (front) and insertion can
take place only at the other end (rear) is known as a ?
a) Queue
b) Stack
c) Tree
d) Linked list
32. Which one of the following is an application of Queue Data Structure?
(A) When a resource is shared among multiple consumers.
(B) When data is transferred asynchronously (data not necessarily received at same rate as sent)
between two processes
(C) Load Balancing
(D) All of the above
33. The data structure required for Breadth First Traversal on a graph is?
a) Stack
b) Array
c) Queue
d) Tree
34. A queue follows __________
a) FIFO (First In First Out) principle
b) LIFO (Last In First Out) principle
c) Ordered array
d) Linear tree
35. Circular Queue is also known as ________
a) Ring Buffer
b) Square Buffer
c) Rectangle Buffer
d) Curve Buffer
36. If the elements “A”, “B”, “C” and “D” are placed in a queue and are deleted one at a time, in
what order will they be removed?
a) ABCD
b) DCBA
c) DCAB
d) ABDC
37. A data structure in which elements can be inserted or deleted at/from both the ends but not in
the middle is?
a) Queue
b) Circular queue
c) Dequeue
d) Priority queue
38. A normal queue, if implemented using an array of size MAX_SIZE, gets full when
a) Rear = MAX_SIZE – 1
b) Front = (rear + 1)mod MAX_SIZE
c) Front = rear + 1
d) Rear = front
39. Queues serve major role in ______________
a) Simulation of recursion
b) Simulation of arbitrary linked list
c) Simulation of limited resource allocation
d) Simulation of heap sort
40. Which of the following is not the type of queue?
a) Ordinary queue
b) Single ended queue
c) Circular queue
d) Priority queue
41. How many stacks are needed to implement a queue? Consider the situation where no other
data structure like arrays, linked list is available to you.
(A) 1
(B) 2
(C) 3
(D) 4
42. Choose correct output for the following sequence of operations.

push(5)
push(8)
pop
push(2)
push(5)
pop
pop
pop
push(1)
pop

a. 85251
b. 85521
c. 82551
d. 81255
43. Stack can be implemented using ___________ and ______________?
a. Array & Binary Tree
b. Linked List & Graph
c. Array & Linked list
d. Queue & linked list
44. Postfix form of following expression.
a. EF*D+
b. DEF*+
c. DEF+*
d. EFD*+
45. When function calls another function then the details of previous function are stored in Stack?
a. True
b. False
46. Insertion and Deletion operation in Queue is known as
a. Push & Pop
b. Enqueue & Dequeue
c. Insert & Delete
d. None of given
47. Stack data structure cannot be used for
a. Implementation of recursive function
b. Allocation resource & scheduling
c. Reversing string
d. Evaluations of string in postfix form
48. What is the advantage of recursive approach than an iterative approach?
a) Consumes less memory
b) Less code and easy to implement
c) Consumes more memory
d) More code has to be written
49. In which of the cases uniform binary search fails compared to binary search?
a) A table lookup is generally faster than an addition and a shift
b) Many searches will be performed on the same array
c) Many searches will be performed on several arrays of the same length
d) Complexity of code
50. Given an input arr = {2,5,7,99,899}; key = 899; What is the level of recursion?
a) 5
b) 2
c) 3
d) 4
51. What is the worst case complexity of binary search using recursion?
a) O(nlogn)
b) O(logn)
c) O(n)
d) O(n2)
52. What is the average case time complexity of binary search using recursion?
a) O(nlogn)
b) O(logn)
c) O(n)
d) O(n2)
53. Which of the following is not an application of binary search?
a) To find the lower/upper bound in an ordered sequence
b) Union of intervals
c) Debugging
d) To search in unordered list
54. Binary Search can be categorized into which of the following?
a) Brute Force technique
b) Divide and conquer
c) Greedy algorithm
d) Dynamic programming
55. Given an array arr = {5,6,77,88,99} and key = 88; How many iterations are done until the
element is found?
a) 1
b) 3
c) 4
d) 2
56. Each element of a binary tree is called a ___________of the tree.
a. Node
b. Leaf
c. Mode
d. Child
57. We make (draw) a tree by joining different nodes with lines. But we ______join any nodes
whichever we want to each other.
a. Can also
b. Cannot
c. Depend on the nodes
d. None of given
58. In a tree there is always _________ path to go (from root) to a node.
a. Two
b. One
c. No path
d. None of the given
59. We can use the words descendant and child interchangeably.
a. True
b. False
60. A binary tree is said to be a strictly binary tree if every non-leaf node in a binary tree has non-
empty left and right sub trees.
a. True
b. False
61. Level of any other node is one more than the level its_______________.
a. Child
b. Leaf
c. Descendant
d. Parent
62. A complete binary tree of depth d is the strictly binary tree all of whose leaves are at level d”.
a. True
b. False
63. We can say that in a complete binary tree at a particular level k, the number of nodes is equal to
_________?
a. 2K
b. 2*2k
c. 2logk
d. 2k
64. Which of the following is not an operation on binary tree?
a. right(p) returns pointer to right sub tree
b. parent(p) returns the father of p
c. brother(p) returns brother of p.
d. all of the given
65. A complete binary tree is necessarily a strictly binary tree but not vice versa.
a. True
b. False
66. Binary tree is useful structure when two-way decisions are made at each point.
a. True
b. False
67. What is an AVL tree?
a) a tree which is balanced and is a height balanced tree
b) a tree which is unbalanced and is a height balanced tree
c) a tree with three children
d) a tree with at most 3 children
68. Why we need to a binary tree which is height balanced?
a) to avoid formation of skew trees
b) to save memory
c) to attain faster memory access
d) to simplify storing
69. In post order traversal of binary tree right sub tree is traversed before visiting root.
a) True
b) False
70. What is the possible number of binary trees that can be created with 3 nodes, giving the
sequence N, M, L when traversed in post-order.
a) 15
b) 3
c) 5
d) 8
71. Which of the following pair’s traversals on a binary tree can build the tree uniquely?
a) post-order and pre-order
b) post-order and in-order
c) post-order and level order
d) level order and preorder
72. To obtain a prefix expression, which of the tree traversals is used?
a) Level-order traversal
b) Pre-order traversal
c) Post-order traversal
d) In-order traversal
73. Which one is a self- referential data type?
a. Stack
b. Queue
c. Link list
d. All of these
74. Each node in doubly link list has,
a. 1 pointer
b. 2 pointers (Page 39)
c. 3 pointers
d. 4 pointers
75. I have implemented the queue with a linked list, keeping track of a front pointer and a rear
pointer. Which of these pointers will change during an insertion into an EMPTY queue?
a. Neither changes
b. Only front pointer changes.
c. Only rear pointer changes.
d. Both change.
76. The nodes with no successor are called _________
a. Root Nodes
b. Leaf Nodes
c. Both of these
d. None of these
77. Doubly Linked List always has one NULL pointer.
a. True
b. False (Page 43)
78. In which of the traversal method, the recursive calls can be used to traverse a binary tree ?
a. In preorder traversal only (Page 143)
b. In inorder traversal only
c. In postorder traversal only
d. All of the given options
79. What is the maximum height of an AVL tree with p nodes?
a) p
b) log(p)
c) log(p)/2
d) p⁄2
80. A tree is an AVL tree if
a. Any one node fulfills the AVL condition
b. At least half of the nodes fulfill the AVL condition
c. All the nodes fulfill the AVL condition (Page 213)
d. None of the given options
81. Consider the following sequence of push operations in a stack:
stack.push(’7’);
stack.push(’8’);
stack.push(’9’);
stack.push(’10’);
stack.push(’11’);
stack.push(’12’);
a. 7 8 9 10 11 12
b. 9 8 11 10 7 12
c. 9 10 8 11 12 7
d. 9 10 8 12 7 11
82. Which one of the following operators has higher priority than all of others?
a. Multiplication operator
b. Minus operator
c. Plus operator
d. Exponentiation operator
83. Which of the following is "TRUE" about arrays,
a. We can increase the size of arrays after their creation.
b. We can decrease the size of arrays after their creation.
c. We can increase but can't decrease the size of arrays after their creation.
d. We can neither increase nor decrease the array size after their creation.
84. Next item in a linked list is known as
a. Index
b. Item
c. Node
d. Child
85. Each operator in a postfix expression refers to the previous ________ operand(s).
a. One
b. Two
c. Three
d. Four
86. We access elements in AVL Tree in,
a. Linear way only
b. Non Linear way only
c. Both linear and non linear ways
d. None of the given options.
87. A + B * C the postfix expression is _____________?
a. + A * B C
b. +*ABC
c. A B C * +
d. A+*BC
88. Data compression plays a significant role in ________________?
a. Application software
b. Database
c. Encoding scheme
d. computer networks
89. Huffman code is method for the compression of standard text documents.
a. True
b. False
90. _________ is a data structure that can grow easily dynamically at run time without having to
copy existing elements.
a. Array
b. List
c. Both of these
d. None of these
91. “+” is a _________operator.
a. Unary
b. Binary
c. Ternary
d. None of the above
92. A ___________ is a FIFO structure, which can make the level-order traversal easier.
a. Array
b. List
c. Queue
d. Linked List
93. We can make a lexicographic order of characters based on their ASCII values.
a. True
b. False
94. A queue is a ________data structure, whereas a stack is a ________data structure.
a. FIFO, LIFO
b. LIFO,FIFO
c. none of these
d. both of these
95. Searching an element in an AVL tree take maximum _______ time (where n is no. of nodes in
AVL tree),
a. Log2(n+1)
b. Log2(n+1) -1
c. 1.44 Log2n
d. 1.66 Log2n
96. Consider the following infix expression.
5 + 6/2
If one converts the above expression into postfix, what would be the resultant expression?
a) 56/ + 2
b) 5 6 2 / + not confirmed
c) 5 6 / 2 +
d) /62 + 5
97. Which of the following is a nonlinear data structure?
a. Linked List
b. Stack
c. Queue
d. Tree
98. In an AVL tree to delete a parent with two childs in a straight line following rotations will be
required:-
a. Single
b. Double
c. Triple
d. None.
99. Each node in a BST has ______ Pointers:-
a. 1
b. 2
c. 3
d. 4
100. When an operator is used in between two operands this is which type of notation
a. Prefix
b. Postfix
c. Infix
d. None of the Above

You might also like