CS301 Quiz 1
CS301 Quiz 1
function as an argument?
may make?
i = 1;
k = 2;
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?
x is still 0, but y is now 2.
597-*
generation?
int x[100];
Created
Table ADT?
node.
Two
11
21
resolve collisions?
Double hashing
return Value;
a = X(*b);
hights of nodes?
26
log2 n
variable?
nodes.
25
infix
12 23 26 31 34 44 56 64 78 100
is ________.
31
In ________, a programmer uses two pointers in the node, i.e.
one to point to next node and the other to point to the previous
node.
Linked list
________ .
Underflow of stack
ampersand
Reflexivity
8
The most difficult case for deleting a node from Binary Search
is Leaf node
Process
process as:
Postfix expression
Storing of data
Fields
________ operand(s).
One
57
crash()
Which of the following statement is false?
Array
Recursive
Binary Search Tree voilates the condition of AVL tree when any
2 pointers
expression?
Minus
Levels.
Log2 (N+1) -1
table.
1, 8, 10, _, _, _, 3
Stack
31
initialized to -1 shows:
read a character
Consider the linked list having data [6, 72, 35, 65, 25] stored in
value?
Queues use two ends of the structure, stacks use only one.
called?
25
each node.
One
Reflexive
are :
1024
to ________.
Limitation of array
If a tree has 50 nodes, then the total edges/links in the tree will
be:
49
Delete
Left-to-right
Log2n time.
FALSE
If we want to find 3rd minimum element from an array of
is ___________.
log2N
Remove
More
linear structure.
Forms
________ of tree.
Depth
The expression
if (! heap ->isFull() )
check
Is a leaf node
Recursion
N-h-1
The binary tree is the maximum level of its leaves (also called
the depth).
Height
Which one of the following is NOT true regarding the skip list?
Queue.
7524
queue.
75243
N -1
>getRight());
Stack
________.
'NULL
N +1
Integer
nodes, root
If there are 23 external nodes in a binary tree then what will be
22
Searching
7/8 + 9
789/+
relationship?
infix expression?
True
Hybrid expression
x-y*a+b/c
above?
xya*-bc/+
AVL
Next Node
What will be the value of root of an AVL and BST if built from
Skip list
array?
Yes
Balance
performed by height?
O(log N)
Collision
TRUE
called
Forest
Recusive
Suppose a hash function returns 6 for the given value. At which
Log2 N levels
property
Transitivity
O(logn)
1.44 Log2n
Pastfix
Priority Queue
NLogN
of size 5.
Push(10);
Push(20);
Push(30);
Pop();
Pop();
Push(40);
20
relation?
Associative
Stack
Left, right, info, and parent are the operation of ________ data
structure.
Tree
For Binary Search Tree, we call the findMax() method as
________.
findMin(tree->getLeft())
Stack
100
31 34 44 56 64 78 100
34
Which operation of queue data structure is used to get front
element from the queue and then remove it from the queue?
enqueue()
dynamically.
Heap
________ .
Top
Disjoint
Top
decreaseKey(p,delta)
What will be the postfix expression of following infix
expression?
A*B/C+D-E
AB+CD/+E-
Maximizing
Contiguous
7, 7
Consecutive
for every process executing, the last part of the memory is for
Heap
expression?
D+E*F/G
DEF*G/+
The expression
if (! heap ->isEmpty() )
checks
&
Log2 (n+1) -1
void test_a(int n)
if (n>0)
test_a(n-2);
420
Doubly Linked List always has ________ NULL pointer/s in a
node.
Two
up, down
5+3*2/(6-3)
entered.
Stack
Self-referential
What will be postfix expression of the following infix
expression?
abc*+d-
linked list.
Very fast
1 pointer
returns,
123*+2-
FIFO, is called:
Priority queue
A Linear Data Structure is the data structure in which data
isEmpty(), isFull()
Y = &x[0];
lvalue
1 pointer
If ahmad is boss of ehsan and ehsan is boss of umer then
Transitive
Table ADT?
top
Stack
~BinarySearchTree() is a ________ .
Constructor
Which property of equivalence relation is satisfied if we say:
Symmetry
are :
32
.cpp
3516
The……..of a binary tree is a maximum level of its leaves (also
the depth).
height
Height
Delete
code
balance
Delete
AVL
as……
Tail recursive
Root
tree node?
Info (p)
1 2 6
5 8
1234568
30
Objects
structure
18. 15 25 45
35 75
15 35 25 75 45
Strictly
1
When a function calls another function the parameters and
Stock
Destructor
the bottom
Nodes
Simulation
called
Dereferencing
Recursion
completely filled
AVL tree.
False
The principal benefit of a linked list over a conventional array is
that the order of the linked items may be_______ from the
Same
10,13,15,5,7,8
New
During the execution of a process, operating system constructs
four things for that process. Which of the following is not part of
that process?
Linked list
each node.
One
Suppose there are three nodes tree with three numbers 14, 4,
them.
(4, 4, 15)
The type of expression in which operator succeeds its
operands is___________expression.
Postfix
Balance
If both left and right nodes of a node are NULL then this type of
Stack
postfix expression?
Stack
____________.
Linear
element from the queue and then remove it from the queue?
Remove ()
continuously.
Linked list
Start
Queue
their _____________.
ASCII values
Stack.push(4);
Stack.push(6);
Stack.push(5);
Stack.push(8);
If a user calls a pop() operation, then which value will be
returned?
~BinarySearchTree( ) is a _______________.
Destructor
Contiguous
to____________
Top
All of above
No null pointer
phenomenon
Simulation
Recursive
The balance of a node in a binary tree is defined as the height
of its _______ sub tree minus height of its right sub tree.
Left
Tree.
Minus (-)
_______ operand(s).
Two
data type.
Int
phenomenon
Simulation
application.
True
Which one of the following calling method does not change the
_________ order.
Left-to-right
Binary Search Tree voilates the condition of AVL tree when any
1 or -1
2n time
True
AVL
Tree
Recursion
class?
Crash ()
Which one is the cored function call for the following function of
calculating cube?
cube (num)
Stack
Structure
Contiguous
In singly linked list a node comprises of __________ field/s.
Two
5+3*2/(6-3)
Want and de-allocatmg memory for linked lest nodes does take
MORE
Suppose you are writing a class for Node class and forgot to
Recursive
Strictly
Pointer
Queue
The type of queues that is FIFO i.e. the person who comes first
False
AVL tree is a binary search tree
True
B C
Ʌ ̸
DEF
ABDCEF
a linear structure.
postfix expression?
Z+B-(D-H)/K
ZB+DH-K/-
same type
Suppose you are writing a class for Node class and forgot to
1.44log2n
AVL
More
dynamic manner.
Heap
In which case of insertion we require double rotation to make
None
__________.
One
data structure.
Tree
Return Address
Stack
Time
precedence in an expression
None
The postfix form of the expression A + B * C and (A + B) * C will
be _______.
Same
condition.
Which one the following is more closer to AVL tree, (chose the
best option)
78/9+
variables.
rotation is performed.
AVL
be removed first?
One Pointers
What's wrong with following loop? while( (i < 10) && (i > 24)) { }
2. Queue
3. stack
4. Memory cell
“+” is a _________operator.
1. Unary
2. Binary
3. Ternary
1. Thread
2. .h file
3. Process
4. None of the above
www.vustudents.ning.com
node.
1. Linked list
2. doubly-link list
3. array
4. Structure
______ operand(s)
1. one
2. two
3. three
4. four
Which of the following operations returns top value of the
stack?
1. push
2. pop
3. top
4. First
function call.
1. Previous line
2. Next line
3. Beginning
entered.
1. Queue
2. Stack
3. Both of these
4. None of these
the push member function places the new entry on the linked
list?
1. After all other entries that are greater than the new entry.
2. At the head
3. After all other entries that are smaller than the new entry.
4. At the tail
Data Structure?
1. Linked List
2. Stack
3. Queue
4. Tree
________data structure.
1. FIFO, LIFO
1. 2
2. 3
3. 4
2. Return address
3. Last argument
1. isFull(),isEmpty()
2. pop(), push()
3. isEmpty() , isFull()
2. Binary Tree
4. AVL Tree
1. Remove
2. next
3. start
4. back
1. C program file
2. .h file
2. .h file
3. Process
1. pointer
2. pointers
3. pointers
4. pointer
1. FIFO, LIFO
2. LIFO,FIFO
3. both of these
4. none of these
To create a _________ we link the last node with the first node
in the list.
2. Circularly-linked list
3. Linked list
1. isFull(),isEmpty()
2. pop(), push()
3. isEmpty() , isFull()
4. push(),pop()
that the order of the linked items may be_____ from the order
1. Same
2. Identical
3. Different
4. Equivalent
node due to the fact that the next field of the last node is set to
NULL.
be removed first?
1. 48
2. 4
3. 333
4. 5
two nodes (p and q) are the same. Assume that neither p nor q
is null.
1. p == q
2. p.data == q.data
3. p.nextNode == q. nextNode
4. p.data == q
2. Stack
3. Queue
4. AVL Tree
A queue is a data structure where elements are
1. Infix
2. Postfix
3. Prefix
__________data type.
1. Specific
2. Definite
3. Generic
1. First argument
2. Return address
3. Last argument
1. Stack
2. Queue
3. Both of these
4. None of these
________data structure.
1. FIFO, LIFO
2. LIFO,FIFO
3. both of these
4. none of these
Stack and Queue can be implemented using _______,
2. Binary Tree
4. AVL Tree
1. Linked list
2. Stack
3. Queue
4. Memory cell
Compiler uses which one of the following in Function calls,
1. Stack
2. Queue
4. AVL Tree
that the order of the linked items may be_____ from the order
1. Same
2. Identical
3. Different
4. Equivalent
1. True
2. False
1. Stack
2. Queue
3. Both of these
4. None of these
a stack-linked list ?
1. Zero
3. Any Number
4. None of these
“+” is a _________operator.
1. Unary
2. Binary
3. Ternary
node.
1. Linked list
2. doubly-link list
3. array
4. structure
1. isFull(),isEmpty()
2. pop(), push()
3. isEmpty() , isFull()
4. push(),pop()
1. Remove
2. Next
3. Start
4. Back
1. Stack
2. Queue
4. AVL Tree
be removed first?
1. 48
2. 4
3. 333
4. 5
highest of node
1. 31
2. 30
3. 27
4. 26
1. Reflexivity
2. Symmetry
3. Transitivity
relation?
1. Reflexive
2. Symmetric
3. Transitive
4. Associative
1. Improve performance
2. Code readable
3. Less code
are
1. 256
2. 512
3. 1024
4. Can’t be determined
called _____.
1. Cluster
2. Class
3. Forest
4. Bunch
The percolate Down procedure will move the smaller value and
bigger value.
1. Left, right
2. Right, left
3. Down, up
4. Up, down
of height of nodes is
1. N - h -1
2. N - 1
3. N - 1 + h
4. N - (h - 1)
once?
1. Insert
2. Add
3. Update
4. percolateDown
1. Reflexive
2. Symmetry
3. Transitive
4. None of given
called?
1. 5
2. 25
3. 35
4. 50
relationship?
1. Reflexive, symmetric
2. Reflexive, transitive
3. Symmetric, transitive
1. NlogN
2. 2N
3. N*N*N
4. N
if ( ! heap->isFull() )
Check
1. Heap is empty
2. Heap is full
The Expression
if ( ! heap->isEmpty() )
Check
1. Heap is empty
2. Heap is full
31 34 44 56 64 78
deleted is__________ .
1. 31
2. 34
3. 44
4. 56
1. increaseKey(p, delta)
2. decreaseKey(p, delta)
3. percolateDown(p, delta)
4. remove(p, delta)
1. increaseKey(p, delta)
2. decreaseKey(p, delta)
3. percolateDown(p, delta)
4. remove(p, delta)
1. Reflexivity
2. Symmetry
3. Transitivity
4. All of Above
Given the values are the array representation of heap;12 23 26
given heap?
1. 31
2. 34
3. 44
4. 56
Level
Width
Height
functions prototypes?
binary tree whose every node has either zero or two children is
called _________
None of above
Which one of the following calling method does not change the
________ of tree
Level
Length
Depth
Node level
space in memory
Balance
Width
int &x ;
int *x ;
int x ;
None of the given options
My todays quizzz no 1
1.When an executable program run, it is loaded in the memory and becomes
a_______.
Select correct option:
Thread
.h file
Process
None of the above
2.A kind of expressions where the operator is present between two operands called
________expressions.
Select correct option:
Infix
Postfix
Prefix
None of the above
4.To create a _________ we link the last node with the first node in the list.
Select correct option:
Double linked list
Circularly-linked list
Linked list
None of the above
5.In the calling function, after the execution of the function called, the program
continues its execution form the _______after the function call.
Select correct option:
Previous line
Next line
Beginning
None of the above
8.In the linked list implementation of the stack class, where does the push member
function places the new entry on the linked list?
Select correct option:
After all other entries that are greater than the new entry.
At the head
After all other entries that are smaller than the new entry.
At the tail
Infix
Postfix
Prefix
Stack
Queue
AVL Tree
Binary Tree
AVL Tree
7. Which one of the following is TRUE about recursion?
Select correct option:
True
False
9. Which boolean expression indicates whether the numbers in two nodes (p and q) are the
same. Assume that neither p nor q is null.
Select correct option:
p == q
p.data == q.data
p.nextNode == q. nextNode
p.data == q
10. Whenever we call a function, the compiler makes a stack, the top element of the stack
is _____ of the function.
Select correct option:
First argument
Return address
Last argument
None of the above
11.
_____ is the stack characteristic but _______was implemented because of the size limitation
of the array.
Select correct option:
isFull(),isEmpty()
pop(), push()
isEmpty() , isFull()
push(),pop()
12.
Each operator in a postfix expression refers to the previous ______ operand(s).
Select correct option:
one
two
three
four
13The next field in the last node in a singly-linked list is set to_____.
Select correct option:
0
1
NULL
false
14.
The _____ method of list will position the currentNode and lastCurrentNode at the start of
the list.
Select correct option:
Remove
Next
Start
Back
15.
______ is the maximum number of nodes that you can have on a stack-linked list ?
Select correct option:
Zero
2n (where n is the number of nodes in linked list)
Any Number
None of these
16.
In the linked list implementation of the stack class, where does the push member function
places the new entry on the linked list?
Select correct option:
After all other entries that are greater than the new entry.
At the head
After all other entries that are smaller than the new entry.
At the tail
17. Which of the following operations returns top value of the stack?
Select correct option:
push
pop
top
first
18. it will be efficient to place stack elements at the start of the list because insertion and
removal take _______time.
Select correct option:
Variable
Constant
Inconsistent
None of the above
Specific
Definite
Generic
None of the above.
20. Local variables of a function are stored in,
Select correct option:
Binary Search Tree
Stack
Queue
AVL Tree
21. To create a _________ we link the last node with the first node in the list.
Select correct option:
Double linked list
Circularly-linked list
Linked list
None of the above
22. In the calling function, after the execution of the function called, the program continues
its execution form the _______after the function call.
Select correct option:
Previous line
Next line
Beginning
None of the above
25. In________ the ‘next’ returns false when it reaches to the last node due to the fact that the
next field of the last node is set to NULL.
Select correct option:
Circular linked list
Triple linked list
Singly linked list
None of the above
26. only removes items in reverse order as they were entered.
Select correct option:
Queue
Stack
Both of these
None of these
FIFO, LIFO
LIFO,FIFO
both of these
none of these
28. The principal benefit of a linked list over a conventional array is that the order of the
linked items may be_____ from the order that the data items are stored in memory.
Select correct option:
Same
Identical
Different
Equivalent
29. Whenever we call a function, the compiler makes a stack, the top element of the stack
is _____ of the function.
Select correct option:
First argument
Return address
Last argument
None of the above
30. The _____ method of list will position the current Node and lastCurrentNode at the start
of the list.
Select correct option:
Remove
Next
Start
Back
See the below code and fill the appropriate answer for? void fastInorder(TreeNode*
p) { while((p=nexInorder(p)) != ? ) cout p->getInfo(); }
Dummy
rootNode
LTH
RTH
If there are N external nodes is a binary tree then what will be the no. of the
internal nodes in this binary tree?
N-1
N
N+1
N+2
In a min heap the parent node has key smaller than or equal to
Left child
Right child
Both
None
For a perfect binary tree of height h, having N nodes, the sum of heights of nodes is
n-(h-1)
n-(h+1)
n-h
none
For a perfect binary tree of height 4. What will be the sum of heights of nodes?
31
3027
26
For a perfect binary tree of height h, having N nodes, the sum of heights of nodes is
_____________.
N – (h – 1)
N – (h + 1)
N–1
N–1+h
If we want to find median of 50 elements, then after applying buildHeap method, how
many times deleteMin method will be called ?
5
25
35
50
Which of the following heap method increase the value of key at position ‘p’ by the
amount ‘delta’?
increaseKey(p,delta)
decreaseKey(p,delta)
preculateDown(p,delta)
remove(p,delta)
www.vuzs.net
The main reason of using heap in priority queue is
improve performance
code is readable
less code
heap can't be used in priority queues
The total number of nodes on 10th level of a perfect binary tree are :
256
512
1024
Can't be determined
Which property of equivalence relation is satisfied if we say: Ahmad R(is related to)
Ahmad
Reflexivity
Symmetry
Transitivity
All of the above
Which of the following heap method lowers the value of key at position ‘p’ by the
amount ‘delta’?
increaseKey(p,delta)
decreaseKey(p,delta)
preculateDown(p,delta)
remove(p,delta)
If a tree has 50 nodes, then the total edges/links in the tree will be :
55
51
50
49 N-1= 49
Consider a max heap, represented by the following array;
40,30,20,10,15,16,17,18,4 After inserting a nodes with value 35.Which of
following is the updated max heap?
40,30,20,10,15,16,17,8,4,35
40,30,20,10,35,16,17,8,4,15
40,35,20,10,30,16,17,8,4,15
40,35,20,10,15,16,17,18,4,30
A Threaded Binary Tree is a binary tree in which every node that does not have
a right child has a THREAD (in actual sense, a Link) ___________Successor.
Preorder
Inorder
Postorder
Leveloder
A Threaded Binary tree is a binary tree in which every node that does not have
a right child has a THREAD (in actual sense, a link)_____________ successor.
Preoder
Inorder
Postorder
Levelorder
If there are 56 internal nodes in a binary tree then how many external nodes
this binary tree will have?
54
55
56
57
A binary tree with 45 internal nodes has _________ links to external nodes.
44
45
46
90
In which of the following tree, parent nodes has key greater than or equal to its
both children?
Max heap
Binary search tree
Threaded Binary tree
Complete Binary tree
If one pointer of the nodes in a binary tree is NULL then it will be a/an
Inner node
Leaf node
External node
Root node
If there are N external nodes is a binary tree then what will be the no. of the
internal nodes in this binary tree?
N-1
N
N+1
N+2
See the below code and fill the appropriate answer for? Void
fastlnorder(TreeNod+p) {while((p+nextInorder(p)) !+ ? ) cout << p->getInfo();}
Dummy
rootNode
LTH
RTH
If the bottom level of a binary tree is NOT completely filled, depicts that the
tree is NOT a ________
Complete Binary tree
Threaded Binary Tree
Expression tree
Perfectly compete Binary tree
If an expression tree is correct then its root should have,
An operator
(
)
an operand
A complete binary tree is a tree that is _______ filled, with the possible
exception of the bottom level.
partially
completely
incompletely
partly
A complete binary tree is a tree that is _________ filled, with the possible
exception of the bottom level.
partially
completely
incompletely
partly
Which of the following statement is true about dummy node of threaded binary
tree?
The left pointer of dummy node points to the itself while the right pointer points to the
root of tree.
The left pointer of dummy node points to the root node of the tree while the right
pointer points itself i.e. to dummy node.
The left pointer of dummy node points to the root node of the tree while the right
pointer is always NULL.
The right pointer of dummy node points to the itself while the left pointer is always
NULL.
Threaded binary tree
When a complete binary tree, represented by an array then for any array
element at position i, the parent is at position ______ .
2i-1
2i
2i+1
floor(i/2)
When a complete binary tree represented by an array then if right child is at
position 5 then left child will be at position _____
2
3
4
6
A binary tree with N internal nodes has _____ links, _______ links to internal
nodes and ________ links to external nodes.
2N, N-1, N+1
N-1, 2N, N+1
N+1, 2N, N-1
N+1, N-1, 2N
If a binary tree has N + 1 external nodes then,
It has N internal nodes.
It has N-1 internal nodes.
It has N/2 internal nodes.
It has N+2 internal nodes.
A binary tree with 45 internal nodes has _______links to external nodes.
44
45
46
90
Consider a binary tree, represented by the following array: 10,7,9,5,2,1,6,3,4
This is a ________.
Min heap
Max heap (Not Sure)
Threaded binary tree
Binary Search tree
Consider a binary tree, represented by the following array: A,B,C,D,E,F,G,I Is it
a strictly binary tree ?
Yes
No
In threaded binary tree the NULL pointers are replaced by the
preorder successor or predecessor
inorder successor or predecessor
inorder successor or predecessor
NULL pointers are not replaced
Consider a binary tree, represented by the following array:
A,B,C,D,E,F,G,H,I,J,K,L Is it a strictly binary tree?
Yes
No
We implement the heap by ______________ .
Threaded Tree
AVL tree
Complete binary tree
Expression
If there are 56 internal nodes in a binary tree then how many external nodes
this binary tree will have?
► 54
► 55
► 56
► 57
Which of the following statement is true about dummy node of threaded binary
tree?
► The left pointer of dummy node points to the itself while the right pointer
points to the root of tree.
► The left pointer of dummy node points to the root node of the tree while
the right pointer points itself i.e. to dummy node
► The left pointer of dummy node points to the root node of the tree while the
right pointer is always NULL.
► The right pointer of dummy node points to the itself while the left pointer is
always NULL.
If the bottom level of a binary tree is NOT completely filled, depicts that the
tree is NOT a
► Expression tree
► Threaded binary tree
► complete Binary tree
► Perfectly complete Binary tree
If there are 23 external nodes in a binary tree then what will be the no. of
internal nodes in this binary tree?
► 23
►2
► 21
► 22
f 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