## Objective Questions

*Question*

If there are N elements in an array then the number of maximum steps needed to find an element using Binary Search is ___________.

- N
- N2
- Nlog2N
- log2N

Answer: 4 | Chapter No. 39 |

*Question*

If we have 1000 sets each containing a single different person. Which of the following relation will be true on each set:

- Reflexive
- Symmetric
- Transitive
- Associative

Answer: 1 | Chapter No. 34 |

*Question*

Which one of the following is NOT the property of equivalence relation:

- Reflexive
- Symmetric
- Transitive
- Associative

Answer: 4 | Chapter No. 33 |

*Question*

If there are N external nodes in a binary tree then what will be the no. of internal nodes in this binary tree?

- N -1
- N+1
- N+2
- N

Answer: 1 | Chapter No. 26 |

*Question*

If there are N internal nodes in a binary tree then what will be the no. of external nodes in this binary tree?

- N -1
- N
- N +1
- N +2

Answer: 3 | Chapter No. 26 |

*Question*

If there are 23 external nodes in a binary tree then what will be the no. of internal nodes in this binary tree?

- 23
- 24
- 22
- 21

Answer: 3 | Chapter No. 26 |

*Question*

A binary tree with 24 internal nodes has ________ external nodes.

- 22
- 23
- 48
- 25

Answer: 4 | Chapter No. 26 |

*Question*

If there are 56 internal nodes in a binary tree then how many external nodes this binary tree will have?

- 54
- 57
- 56
- 55

Answer: 2 | Chapter No. 26 |

*Question*

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

- Log2(n+1)
- Log2(n+1) -1
- 1.44 Log2n
- 1.66 Log2n

Answer: 3 | Chapter No. 21 |

*Question*

Every AVL is ___________.

- Binary Tree
- Complete Binary Tree
- Binary Search Tree
- None of these

Answer: 3 | Chapter No. 19 |

*Question*

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

- Is a leaf node
- Has left subtree only
- Has right subtree only
- Has both left and right subtree

Answer: 1 | Chapter No. 15 |

*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)?

- 4 2 0
- 0 2 4
- 0 2
- 2 4

Answer: 1 | Chapter No. 13 |

*Question*

A binary tree of N nodes has _____________ .

- Log10 N levels
- Log2 N levels
- N / 2 levels
- N x 2 levels

Answer: 2 | Chapter No. 11 |

*Question*

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

- Stack
- Queue
- Both of these
- None of these

Answer: 1 | Chapter No. 8 |

*Question*

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

- ab+c*d-
- abc*+d-
- abc+*d-
- abcd+*-

Answer: 2 | Chapter No. 6 |

*Question*

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

- True
- False

Answer: 1 | Chapter No. 6 |

*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"?

- selpa
- selppa
- apples
- aaappppplleess

Answer: 2 | Chapter No. 5 |

*Question*

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

- Linked List
- Stack
- Queue
- Tree

Answer: 2 | Chapter No. 5 |

*Question*

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

- Linked List
- Stack
- Queue
- Tree

Answer: 2 | Chapter No. 5 |

*Question*

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

- True
- 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.

- True
- False

Answer: 1 | Chapter No. 1 |

*Question*

Here is a small function definition:*void f(int i, int &k){i = 1;k = 2;}*

Suppose that a main program has two integer variables x and y, which are given the value 0. Then the main program calls f(x,y); What are the values of x and y after the function f finishes?

- Both x and y are still 0.
- x is now 1, but y is still 0.
- x is still 0, but y is now 2.
- x is now 1, and y is now 2.

Answer: 3 | Chapter No. |

*Question*

Select the one FALSE statement about binary trees:

- Every binary tree has at least one node.
- Every non-empty tree has exactly one root node.
- Every node has at most two children.
- Every non-root node has exactly one parent.

Answer: 1 | Chapter No. |