CARVIEW |
Top MCQs on Data Structures and Algorithms
Question 1
Which of these operators can be used to concatenate two or more String objects?
+
+=
&
||
Question 2
In a nested loop,the outer loop must be terminated before the inner loop.
True
False
Question 3
Which of the following sorting algorithm takes the least time when applied to an almost sorted array?
Quick sort
Insertion sort
Selection sort
Merge sort
Question 4
The balance factor of a node in a binary tree is defined as _____
addition of heights of left and right subtrees
height of right subtree minus height of left subtree
height of left subtree minus height of right subtree
height of right subtree minus one
Question 5
What is true about a break statement ?
Break stops the execution of the entire program
Break halts the execution and forces the control out of the loop
Break forces the control out of the loop and starts the execution of next iteration
Break halts the execution of the loop for certain time frame
Question 6
The no. of external nodes in a full binary tree with n internal nodes is?
n
n+1
2n
2n + 1
Question 7
Which of the following statements is true?
Recursion is always better than iteration
Recursion uses more memory compared to iteration
Recursion uses less memory compared to iteration
Iteration is always better and simpler than recursion
Question 8
Consider an implementation of an unsorted singly linked list. Suppose it has its representation with a head pointer only.
Given the representation, which of the following operations can be implemented in O(1) time?
i) Insertion at the front of the linked list
ii) Insertion at the end of the linked list
iii) Deletion of the front node of the linked list
iv) Deletion of the last node of the linked list
I and II
I and III
I, II and III
I, II, and IV
Question 9
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?
ABCD
DCBA
DCAB
ABDC
There are 20 questions to complete.