0% found this document useful (0 votes)
4K views15 pages

CS301p MCQs File by Academic Helpers' With You

This document contains 60 multiple choice questions about data structures and algorithms topics like stacks, queues, linked lists, trees, heaps, and binary search trees. The questions cover concepts like traversals, balancing of AVL trees, operations on different data structures and their time complexities.

Uploaded by

Avaya Developer
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)
4K views15 pages

CS301p MCQs File by Academic Helpers' With You

This document contains 60 multiple choice questions about data structures and algorithms topics like stacks, queues, linked lists, trees, heaps, and binary search trees. The questions cover concepts like traversals, balancing of AVL trees, operations on different data structures and their time complexities.

Uploaded by

Avaya Developer
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/ 15

CS301P- Data Structure (Practical)

MCQs FILE

Facebook: Academic Helper

YouTube: Academic Helpers


Instagram: academichelperz
Email: [email protected]
Youtube link:

https://www.youtube.com/channel/UClG7IIpmS_-YxZMPlUO84Bw

1. The result of the postfix expression 632*+ is______

• 18
• 20
• 30

2. A complete binary tree has 7 non-leaf nodes, The number of leaf


nodes will be:

• 6
• 7
• 9
• 8

3. In C++, ampersand ‘& symbol is used for

• Reference Variables
• Static variables
• Pointers
• Array

4. All the operators in stack take

• Constant
• Mining
• Maximum
• Zero

5. A complete binary tree with a property that the value at each


node is at least as small as the values in its children are called as

• Binary tree
• Max Heap
• Binary search tree
• Min Heap

6. What will be the height of an empty AVL tree?

• -1
• 1
• 2
• 0

7. Which method of Node class returns the value of node in a


Linked list?

• back()
• tail()
• start()
• get()

8. Which of the following traversal method will be used, if we want


the output as 3,4,7.9,14,15,16 18.207

• Level-order traversal
• Pre-order traversal
• Post-order traversal
• In-order traversal

9. In Linked List. add () method will add the new node


after________

• Current node
• Last Current node
• None of the given options

10. Which traversal method should be maintained when a node is


deleted from a Binary Search Tree?

• In-Order
• Level Order
• Post-Order
• Pre-Order

11. Which of the following function prototype is declaring the


function as constant?

• void EType& findMin(const int a),


• const ETypes findMin( )
• const ETypea finaMin( ) const
• ETyped& findMin(const int a),

12. Which of the following is used to navigate from one node to


another node in the linked list?

• Object field of node


• None of the given options
• Next part of node

13. Which of the following is used in function calls?

• Tree
• Stack
• Linked list
• Queue
14. Binary search tree class is defined as a template class so that it
can be used for ____data type(s)

• Strings
• Character
• Integer
• Any

15. A hole is created which needs to be filled if the element


is____________ from the heap.

• Deleted
• Inserted
• There is no concept of hole in heap
• Updated

16. Which of the following is an infix expression?

• +63
• 826+*
• {1+2) *(3+4)

17. A tree will be an AVL tree if______________ of the tree fulfills


the AVL condition

• root node
• every
• leaf nodes
• non leaf nodes

18. Which of the following Linked List method moves the pointer
forward?
• remove ()
• start ()
• next()
• add()

19. Consider a min heap, represented by the following array:


5,6,8,9,7
After deleting the root node, which of the following is the
updated min heap?

• 68,9,7
• 67,9,8
• 8,7,9,6
• 67,.8,9

20. The following function is used for function call by__________


int func (int& a) {
a--:
return a:
}

• Value
• Template
• Pointer
• Reference

21. ‘vord func (TreeNode* treeNode) {


if{ treeNode '= NULL } {
func(treeNode->getLeft()),
func(treeNade->getRight());
‘cout << *(treeNode->getinfa())<<" "
}

• Preorder traversal
• Level-order traversal
• Post-order traversal
• In-order traversal

22. All the operations in stack take________ time.


• Constant
• Maximum
• Minimum
• zero
23. Which of the following is used in function calls?

• Linked List
• tree

24. In data structures, List is the collection of elements in

• Linear order
• Non-linear order
• Descending order
• Random order

25. Consider a max heap, represented by the following array:


49, 39, 36, 31, 27, 21, 35, 12
After the deletion of node with value 49. Which of the following
is the updated max heap?

• 39, 31, 36,12, 27, 21, 35


• 39, 36, 31,12, 27, 21, 35
• 39, 36, 31,27, 21, 35, 12
• 39, 36, 35 21, 27, 31,12
26. Which type of linked list has two Null pointers?

• None of the given options


• Doubly linked list
• Singly linked list

27. Which of the following is visited at last step in post-order


traversal method?

• Root Node
• Right Node
• leaf node
• left node

28. The balance of a node in a binary search tree is defined as


the_________

• height of ts left subtree - height of its right subtree


• height of its left subtree - height of its leaf nodes
• height of its right subtree + height of its left subtree
• height of its right subtree - height of root node

29. Removing an element from the end of stack using a linked list
take __________ time than removing an element from the s

• more
• Equal
• No
• Less

30. Level order traversal of a binary tree can be implemented with


______ date structure

• Linked List
• Binary Tree
• queue

31. Which of the following represents the destructor of Binary


Search Tree class?

• void ~BinarySearchTree()
• ~BinarySearchTree()
• BinarySearchTree()
• BinarySearchTree() ~

32. The postfix expression for the infix expression 1-3-4 is :


• 134
• 13-4-
• 134—

33. In binary tree level of root node es


• Same us the level of its left child
• Same us the level of its right child
• O
• 2
34. An AVL tree is identical to _____
• Stack
• Binary Search Tree
• queue
• Linked list

35. Which of the following statement declares an array ‘x’ with 6


integers?
• int (6) x:
• int x = 6;
• float x{6}
• int x[6];

36. Each operator in a postfix expression refers to the previous


_________ operand(s).
• 0
• 1
• 3
• 2

37. Nodes in the linked list are accessed in _________order:

• Descending
• Sequential
• Non-linear
• random

38. A binary tree in which every non-leaf node has non-empty right
and left subtrees 1s called

• Huffman Tree
• Strictly Binary Tree

39. Which traversal method should be maintained when a node is


deleted from a Binary Search Tree?

• Level Order
• In-Order
• Post-Order
• Pre-Order

40. in C++ a single stack can be used for different types by using
________

• Static variables
• Linked Lists
• Templates
• Postfix expressions

41. Which of the following will be used to avoid the problems


caused by the BST generated using sorted data?

• AVL Tree
• Queue
• Stack
• Linked list

42. Which of the following node has the maximum value in a max
heap?

• Left most child


• Right most child
• None of the given options.
• Root node

43. If there is a complete binary tree of depth 4. the total number of


nodes in it will be

• 30
• 33
• 32
• 31

44. We can use & symbol with_________ data type.

• User Defined
• Any
• Integer

45. A tree will be an AVL tree if__________ of the tree fulfils the
AVL condition

• Leaf nodes
• Every
• Non-leaf nodes
• Root node

46. In which traversal method let sub tree is waited in first step?

• in order traversal
• Post-order traversal
• Post-order traversed
• Pre-order traversal

47. Which file extension is used in C++ to keep the class interface in
a separate file?

• exe
• txt
• .c
• .h

48. What is the output of the following program?


int main ()
{
int array [5] = {10,20,30,40,50};
cout << array [3];
return 0;

• 40

49. If there are two paths to reach to certain node. then the data
structure will be

• Simple tree
• Binary search tree

50. How many times a for loop will be executed if we use the find()
method of list data structure to find the value 10 from the given
list?
A 2 6 8 9 1 current | size
1 2 3 4 5 5 5

• 7
• 10
• 5

51. Which of the fallowing symbol is used for assigning addresses to


pointer variables?
• &
• >
• .

52. Which of the following statement declares the Stack object of


float data type if a Stack class is defined using C++ template?

• Stack float stack;


• <float> Stack stack;
• Stack stack;
• Stack <float> stack

53. Which of the following condition will be true if a node is NULL


during the in-order traversal using recursive calls?

• Node can contain only one child


• Node contains only left child
• Node contains only right child
• Node does not contain both left and right children

54. The ASCII value for character ‘A’ is:

• 65
• 66
• 67
• 68

55. Which of the following queue does not always follow FIFO
behavior?
• Double-ended queue
• Simple queue
• Priority queue
• Circular queue

56. Level order traversal of 3 binary tree can be implemented with


data structure

• linked List
• Queue
• Stack
• Binary Tree

57. Which type of linked list has two Null pointers?

• Doubly linked list


• None of the given options
• Singly linked list

58. The depth of a complete binary tree is 6. the number of its non-
leaf nodes will be
• 64
• 63
• 6
• 61

59. Which of the following symbol is used for assigning addresses to


pointer variables?

• &
• .
• >
• -<
60. In data structures, List is the collection of elements
in_____________

• Linear order
• Descending order
• Non-linear order
• Random order

61. Binary search tree class is defined as a template class so that it


can be used for __________ data type(s).

• Any
• Character
• Integer

62. What will be value of second element of array ‘x’ after the
execution of the given code?
int main
{
for(int j = 0: j < 3: j++)

x[j]= 2*j:

• 0
• 2

63. In stack, which node will be considered as the Top of stack?


• Middle node
• First node
• Last node

64. In C++, same code can be reused for different data types by
writing__________

• traverse method
• templates
• Push
65. Which of the following represents frequency of all characters in
Huffman Encoding tree?

• Root Node
• Leaf Node
• Right Branch

66. If the date is given in Sorted order. the tree generated will be
similar to__________

• Heap
• Linked list
• Queue

67. Which of the following is 5 reserved keyword of C++?

• add
• remove
• define
• del

68. In a doubly linked list. we can traverse the list in__________

• Both directions
• No direction
• forward direction

69. In which traversal method root node is visited in first step?

• In-order traversal
• Pre-order traversal
• Level-order traversal
• Post-order traversal

70. In recursive functions, recursion is stopped by using

• Binary Search tees


• Function prototype
• Function Signature
• Terminating conditions

71. The following method getLeft () of TreeNode class returns


the________
TreeNode * getLeft(}{
return left.
}

• Integer value
• Pointer
• None of the given options

72. If the tree becomes unbalance after deleting a node then we


use_________ to rebalance it.

• Rotations
• Insertions

73. Consider the max heap represented by the following array.


Which of the following is the parent of node 14?
50,40,30,20,25,26,27,18,14

• 30
• 50
• 40
• 20

74. The code of BST traversal methods becomes very short by using

• Recursive calls
• Friend functions
• Non-recursive calls

You might also like