In the name of ALLAH, the most beneficient, the most merciful

Data Structures (CS301)

Multiple Choice Questions (MCQs)

 

Objective Questions

Question

A solution is said to be efficient if it solves the problem within its resource constraints i.e. hardware and time.

  1. True
  2. False

Answer: 1 Chapter No. 1 

Question

A solution is said to be efficient if it solves the problem within its resource constraints i.e. hardware and time.

  1. True
  2. False

Answer: 1 Chapter No. 1 

Question

Which one of the following is known as "Last-In, First-Out" or LIFO Data Structure?

  1. Linked List
  2. Stack
  3. Queue
  4. Tree

Answer: 2 Chapter No. 5 

Question

Consider the following pseudo code
declare a stack of characters
while ( there are more characters in the word to read )
{
read a character
push the character on the stack
}
while ( the stack is not empty )
{
pop a character off the stack
write the character to the screen
}

What is written to the screen for the input "apples"?

  1. selpa
  2. selppa
  3. apples
  4. aaappppplleess

Answer: 2 Chapter No. 5 

Question

Which one of the following is known as "Last-In, First-Out" or LIFO Data Structure?

  1. Linked List
  2. Stack
  3. Queue
  4. Tree

Answer: 2 Chapter No. 5 

Question

What will be postfix expression of the following infix expression?
Infix Expression : a+b*c-d

  1. ab+c*d-
  2. abc*+d-
  3. abc+*d-
  4. abcd+*-

Answer: 2 Chapter No. 6 

Question

For compiler, a postfix expression is easier to evaluate than infix expression?

  1. True
  2. False

Answer: 1 Chapter No. 6 

Question

_________ only removes items in reverse order as they were entered.

  1. Stack
  2. Queue
  3. Both of these
  4. None of these

Answer: 1 Chapter No. 8 

Question

A binary tree of N nodes has _____________ .

  1. Log10 N levels
  2. Log2 N levels
  3. N / 2 levels
  4. N x 2 levels

Answer: 2 Chapter No. 11 

Question

Consider the following function:
void test_a(int n)
{
cout << n << " ";
if (n>0)
test_a(n-2);
}

What is printed by the call test_a(4)?

  1. 4 2 0
  2. 0 2 4
  3. 0 2
  4. 2 4

Answer: 1 Chapter No. 13 

Question

The easiest case of deleting a node from BST is the case in which the node to be deleted _________.

  1. Is a leaf node
  2. Has left subtree only
  3. Has right subtree only
  4. Has both left and right subtree

Answer: 1 Chapter No. 15 

Question

Every AVL is ___________.

  1. Binary Tree
  2. Complete Binary Tree
  3. Binary Search Tree
  4. None of these

Answer: 3 Chapter No. 19 

Question

Searching an element in an AVL tree takes maximum _______ time (where n is no. of nodes in AVL tree).

  1. Log2(n+1)
  2. Log2(n+1) -1
  3. 1.44 Log2n
  4. 1.66 Log2n

Answer: 3 Chapter No. 21