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.
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.
Question
A solution is said to be efficient if it solves the problem within its resource constraints i.e. hardware and time.
- True
- False
Question
A solution is said to be efficient if it solves the problem within its resource constraints i.e. hardware and time.
- True
- False
Question
Which one of the following is known as "Last-In, First-Out" or LIFO Data Structure?
- Linked List
- Stack
- Queue
- Tree
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
Question
Which one of the following is known as "Last-In, First-Out" or LIFO Data Structure?
- Linked List
- Stack
- Queue
- Tree
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+*-
Question
For compiler, a postfix expression is easier to evaluate than infix expression?
- True
- False
Question
_________ only removes items in reverse order as they were entered.
- Stack
- Queue
- Both of these
- None of these
Question
A binary tree of N nodes has _____________ .
- Log10 N levels
- Log2 N levels
- N / 2 levels
- N x 2 levels
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
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
Question
Every AVL is ___________.
- Binary Tree
- Complete Binary Tree
- Binary Search Tree
- None of these
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
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
Question
A binary tree with 24 internal nodes has ________ external nodes.
- 22
- 23
- 48
- 25
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
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
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
Question
Which one of the following is NOT the property of equivalence relation:
- Reflexive
- Symmetric
- Transitive
- Associative
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
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