CSE205 End Term Practice Set
CSE205 End Term Practice Set
Unit 1
Unit 1
Unit 1
Unit 1
Unit 1
Unit 1
Unit 1
Unit 1
Unit 1
Unit 1
Unit 2
Unit 2
Unit 2
Unit 2
Unit 2
Unit 3
Unit 3
Unit 3
Unit 3
Unit 3
Unit 3
Unit 3
Unit 3
Unit 3
Unit 3
Unit 4
Unit 4
Unit 4
Unit 4
Unit 4
Unit 4
Unit 4
Unit 4
Unit 4
Unit 4
Unit 5
Unit 5
Unit 5
Unit 5
Unit 5
Unit 5
Unit 5
Unit 5
Unit 5
Unit 5
Unit 6
Unit 6
Unit 6
Unit 6
Unit 6
Unit 6
Unit 6
Unit 6
Unit 6
Unit 6
Unit 6
Unit 6
Unit 6
Unit 6
Unit 6
QUESTION STATEMENT
The time factor when determining the efficiency of algorithm is measured by
The complexity of Binary search algorithm is
Asymptotic analysis relates most closely to the
The
Whatcomplexity
will be theof for(int
result i = 0;
after i < 1n;ofi++)
pass { for(int
bubble sortj =
(to1;arrange
j < n; j *=
in 2)
an{ascending
//do constant timeis stuff
order) }}
performed for given element
3, 8, 1}?
A 2 dimensional array A[20, 10] has base address 100, Each element requires 4 words in memory . Calculate the m
A[11, 5] considering that the elements are stored in row major order.
Binary Search algorithm does not require this condition to be true?
For an array A with indexes from 1 to n. The following code signifies? A[I+1]=A[I]
The UB ofA an
An array array
holds is 24566and
following the lower
elements. 77,bound
42, 35,is12,1477.101,How
5. Themany total number
elements of elements
are placed can number
from index be stored1 in
to this
inde
of the following is the index of 5 after second pass of bubble sort?
13->45->23->67->89->56 is link list and start pointer store the address of first node. if p is a node pointer and p=sta
>next->next is storing
What is the result
The situation whenofSTART(External
following code Node)=NULL in a linked list . It means
struct
Given node *p;
the current statePointer) of a QUEUE
Start pointer(External
p=(struct node *)malloc(sizeof(structalwayswhichstoringis implemented using circular array of size 5 with starting index 0:
node));the address of
if (p==NULL)
Queue: --,then
P, C, sequence--, B of operations is performed on stack:
The following
How
PUSH many
(10),members
PUSH (20), in doubly
POP(),linked
PUSHlist (10), PUSH (20), POP(), POP(), POP(), POP(), PUSH (20), POP()
(where
The "--"
sequence denotes
of thean empty
What will be the result of evaluating the is:
value cell)
popped out postfix expression: 9, 2, 4, /, ^, 5, - using stack? (Note "," used only for sepa
represents
Which of the the Exponent
following operator)
What will be the value permutations
of FRONT andCAN REAR NOT be obtained
respectively through
after pop() operations from a stack
the following
assuming
operations: that the elements 1, 2, 3, 4 are pushed in the same sequence and push and pop can be performed in an
Which of the following delete(), insert('A')
is/are the condition of Overflow in a queue which is implemented using array of size N?
[Given that array indexes starts from 1]
What is the result of the following postfix expression? ab*cd*+ where a=2,b=0,c=3,d=4
The elements ‘z’, ‘y’, ‘x’, ‘v’ are placed in a queue and deleted one at a time, what order will they be removed queu
Which is very useful in situation when data have to stored and then retrieved in reverse order
Convert the given expression from Infix to Postfix Expression: (A+B)*(C*D-E)*F/G
What is the result of the given postfix expression? abb/*cc*+ where a=1, b=2, c=5
The number of external nodes in a extended binary tree with n internal nodes is?
Minimum number
Maximum height ofofthe
elements in the
binary tree last8level
from of extended
nodes is [NOTE:binary
Heighttree
of ais:
binary tree is number of nodes in the longes
tree]:
Maximum height of the complete binary tree from 8 nodes is [NOTE: Height of a binary tree is number of nodes in t
of
Thethe tree]:
sixth move, in Tower of Hanoi problem to move 4 discs from source tower(S) to destination tower(D) by using a
will be:
How many LL and RR rotations are required during the construction of an AVL tree if the following elements are to
What will be the 16th move while solving the Tower of Hanoi Problem for 5 disks?
order given? traversal sequence of a binary search tree is 30, 20, 10, 15, 25, 23, 39, 35, 42. Which one of the following is t
The preorder
17, inorder
The 18, 19,
traversal 10, preorder
sequence
and 9,of8,the
16, 14, 13
same tree
traversal of a binary tree are 8 4 2 5 1 6 3 7 and 1 2 4 8 5 3 6 7 respectively. The postorder traver
is:
A. 1 LL
Heap canrotations,
bethe
used2as…
RR rotations
What will be minimum time required to solve tower of hanoi puzzle with 5 disks assuming one move takes 2 seconds?
B. 2 LL rotations,
A. Priority queue 4 RR rotations
Given
SupposeInorder and Preorder
we are inserting Traversal
following of a binary
value tree Preorder:
in sequence A, B,and
16,22,20 D, C18
, E,to
G construct
, F , H, I. Inorder:
the AVL D,tree.
B, A, Now
E, G, suppose
C, H, F, I. we
Fi
C. 1 LL rotations,
B. Stack
traversal 4 RR rotations
of the Tree.
rotation
D.
C. 2
A LL to be performed
rotations,
decreasing to make tree as balance?
3 RRarray
order rotations
A. LL
What
D. NoneRotation
is the location
of the of parent node for any arbitrary node i, in a max heap?
mentioned
B. (i/2)
A. LR Rotation
position
What
RL is
C. (i+1)/2the maximum height of any AVL-tree with 12 nodes? (Assume that the height of a tree with a single node is
Rotation
B. position
D. RR Rotation
C. floor(i/2) position
D. ceil(i/2) position
What will be the post order traversal of the AVL tree formed by the nodes given below: 10, 15, 40,
5,
AVL7 treesahave
Consider binary
LL,max-heap
LR, RR, RL implemented using anthe
rotations to balance array.
treeWhich one ofthe
to maintain thebalance
following array
factor (LR:represe
Inser
Suppose
max-heap?
What
sub is the we are
maximum inserting
height of following
any AVL-tree value
with 7 in sequence
nodes? (Assume 10,
that 5, 20
the and
height 15
of a
tree of Left sub tree of node A, etc). Among rotations the following are single and double to
tree construct
with a singlethe
nodeAVL
is 0.)tree.
(a)2 N
(B)
rotati
insert
(a) LL, 12,
(A) 25,
Consider 12,
RL which
16,
and
the 13,rotation
LR, 10,
RR
following 8, 14
(B)
4-digit to
LL, be25,
(b)
RR performed
and
employee 12,
LR,16, to
RL 13,
numbers: make 8, tree
10,5882,
9614, (c)as25,
146713, balance?(a)
14, Find
4409. theLL2-digit
12, 13, (b)8,RR
10, 16(c)(d)
hash LR25,
(d)14,
address RLof 16,
each13,nu
(C) LR,
midsquare
Given
Consider
RR
thethe and
method.LL,
following RL
followinginput
(D)
4-digit
LR,
(4322, RL and LR,
1334,numbers:
employee
RL
1471, 9679,
9614,1999,
5882, 6171, 6173,Find
6713, 4409. 4199)
theand thehash
2-digit hashaddress
function x mod
of each 10, which
number usin
A. 28, 97, 64, 39
statements
Let h'(k)59,
Consider
B. 42, are43
=akhash
mod
06, true?
m, mwith
table = 97.7(1-7) slots. The hash function is h(k) = k mod 7. The collisions are resolved by chaining. The follow
A.
(a)11, 62,
9679,
inserted in20,
the44
1999, 4199
order: hash
15, to the
18, 19, 25, same
20, 37,value
53, 32. The maximum chain lengths in the hash table will be
C.
B. 89,60,
99, 79,69,
43,
4592
(b)
D. 1471,
Depth
24,63, 6171
First
45,21, has
Search
36, to
is the same
equivalent value
to which of the traversal in the Binary Trees?
C.
(c)12,
All elements4228hash to the same value
A.
D. Pre-order
90, Traversal
65, element
67, 40 hashes to a different value
(d) Each
B. Post-order Traversal
C. In-order Traversal
D. Level-order Traversal
Apply folding method on key 9898751203 with memory address 100 and find the address?
Which of the following is most appropriate Hash function for Division Method where address in the hash table are from 11 t
A hash table contains 10 buckets and uses linear probing to resolve collisions. The key values are integers and the hash fun
10. If the values 43, 165, 62, 123, 142 are inserted in the table, in what location would the key value 142 be inserted?
Consider a hash table with 9 slots. The hash function is h(k) = k mod 9. The collisions are resolved by chaining. The followin
in the order: 5, 28, 19, 15, 20, 33, 12, 17, 10. The maximum, minimum, and average chain lengths in the hash table, respec
Which
For a 4 of the undirected
vertex following simple
is true? graph, the sequence of the degrees of the nodes in the graph in decreasing order
Which of the following sequences
To represent a undirected and a simple of degrees
graph,iswe
possible?
are using adjacency matrix Adj[i][j] = 1 if there is an edge from ve
otherwise. What is the most efficient way to represent
1. A hash function h defined h(key)=key mod 7, with linear graph using adjacency
probing, is used to matrix to achieve
insert the keys 44,best
45, space
79, 55,complex
91, 18,
indexed from 0 to 6. What will be the location of key 18?
The Data astructures
Consider used that
hash function in standard implementation
distributes of Breadth
keys uniformly. The hashFirst Search
table size isand
36.Depth First Search
After hashing of howrespectively
many keysi
that any new key hashed collides with an existing one exceed 0.5.
Counting the Counting the Counting the
OPTION
Counting A OPTION
number ofBkey OPTION
number ofC OPTION
kilobytes ofD CORRECT OPTION
microseconds operations statements algorithm b
growth of decline in
O(n)
processor O(log n)
unprocessed O(n^2)
rate of growth O(n log n) of b
complexity
speeds data of functions source files C
O(n) O(log n ) O(n^2) O(n log n) D
{5, 6, 3, 1, 8} Deletion and
{5, 3, 6, 1, 8} The subscript
{6, 5, 8, 3, 1} {5, 6, 3, 8, 1} B
Direct accessatis insertion
The element The in the
element at The
of an elements
array can
required 560 565 are required 570 575 A
I index isto the array mustisbe
I+1 index never includeto Array subscript
middle
copied element.
to I+1 possible.
copied to I be sorted. like will be updated, Deletion and insertion in the array must be
operators
index. index. ‘+’, etc. not the value. The element at I index is copied to I+1 inde
A. 978 979 980 981 980
Address of 67 3 Address of 23 4 Address of 89 5 List has one 6 4
node nodehas only
List nodehas only
List of these A
Nonewith
node
List is empty first node Last node A
NULL
Last node First
Nodenode
is not Second
Node may node
be Any node B
Node is created created created or not None of these B
one
20, 10, 20, 10, two
10, 20, 10, 20, three 10, 20, 20, 10, C
20, 20, 10, 10, four
20 20 20 20 C
2 -2 76 None of These B
3, 4, 2, 1 2, 4, 3, 1 3, 2, 1, 4 4, 3, 1, 2 D
REAR == N-1
0 and 2==
REAR 1 and 2== 1 && 1
REAR and 4 ==
FRONT 3
&&and 1
FRONT == A
FRONT +1 FRONT == N REAR+1 1 C
12 16 14 0A
xyvz vxyz zvxy zyxv D
Tree Stack Queue Linked List B
AB+CD*E-*F*/G AB+CD*EF-**G/ AB+CD*E-*F*G/ AB+CD*E-F**G/ C
11 26 30 25 B
n n+1 n-1 2n n+1
0 1 2 None of these 2
2 4 8 None of these 8
2 4 8 None of these 4
S to D A to D D to S None of these None of these
10, 20, 15, 23, 15, 10, 25, 23, 15, 20, 10, 23, 15, 10, 23, 25,
BEG -> AUX
25, 35, 42, 39,
AUX -> END
20, 42, 35, 39,
BEG -> END
25, 42, 35, 39,
AUX -> BEG
20, 35, 42, 39,
C
30 30 30 30 D
12345678 87654321 84526731 84256371 C
31 62
D, B, G , E, H, I, D, G, B, H, E, I,
32
D, E, G, B, H, I,
64
D, I, F, B, G, E,
B
F, C, A F, A, C F, A, C H, A, C A
A B C D C
A B C D A
3 4 5 6 5
A B C D C
A B C D C
(A) 20, 15, 7, (B) 5, 10, 7, (C) 10, 5, 18, (D) 5, 10, 7,
5, 10, 18, 40, 15, 18, 20, 30, 7, 30, 50, 18, 15, 30,
30, 50 30, 40, 50 20, 40 50, 40, 20 D
A B C D B
A B C D A
A B C D D
A B C D B
4 3 2 1 4
A B C D A
A
a only B
b and c only C
a and b only D A
a and b only
d only
A B C D A
88 86 186 90 B
A graph
k mod 17
may k mod 19 k mod 7 None of these D
contain no A graph may A graph may A graph may
2 3 4 6D
edges and contain many contain no contain no
3, 0 and 2
many 4, 0 andand
edges 1 3, 3 andand
no edges 3 3, 0 and 1 and D
no vertices
vertices vertices vertices many edge B
4, 3, 2, 1 3, 3, 2,triangular
upper 2 3, 3, 2, 1 3, 3, 1, 1 3, 3, 2,triangular
upper 2
Square Matrix matrix Diagonal Matrix Row Matrix matrix
3 4 5 6 5
Stack, Tree Queue, Heap Stack, Queue Tree, Queue Stack, Queue
36 26 18 0.5 18
CT OPTION