Sunteți pe pagina 1din 18

ID

Qus
A solution is said to be efficient if it solves the problem within its
1
resource constraints i.e. hardware and time
Which one of the following is known as "Last-In, First-Out" or LIFO
2
Data Structure?
What will be postfix expression of the following infix expression? Infix
3
Expression : a+b*c-d
For compiler a postfix expression is easier to evaluate than infix
4
expression?
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
5
( the stack is not empty ){pop a character off the stack; write the
character to the screen;} input "apples"?
Consider the following function: void test_a(int n) {cout << n << " "; if
6
(n>0) test_a(n-2); } What is printed by the call test_a(4)?
If there are N external nodes in a binary tree then what will be the no. of
7
internal nodes in this binary tree?
If there are N internal nodes in a binary tree then what will be the no. of
8
external nodes in this binary tree?
If we have 1000 sets each containing a single different person. Which of
9
the following relation will be true on each set:
10 Which one of the following is NOT the property of equivalence relation
11 A binary tree of N nodes has _______
The easiest case of deleting a node from BST is the case in which the
node to be deleted ___________
If there are N elements in an array then the number of maximum steps
13
needed to find an element using Binary Search is _______
Merge sort and quick sort both fall into the same category of sorting
14
algorithms. What is this category?
If one pointer of the node in a binary tree is NULL then it will be a/an
15
_______
12

Ans

True

False

Linked
List

Stack

Queue

Tree

ab+c*d-

abc*+d-

abc+*d-

abcd+*-

True

False

selpa

selppa

apples

aaappppplleess

42

024

02

24

N -1

N +1

N+2

N -1

N +1

N+2

Reflexive

Symmetric

Transitive

Associative

Reflexive
Log10 N
levels
Is a leaf
node

Symmetric

Transitive

Associative

Log2 N levels N / 2 levels

N x 2 levels

Has left
subtree only

Has right
subtree only

Has both left and


right subtree

N^2

Nlog2N

log2N

O(nlogn)
sorts
External
node

Interchange
sort

Average time None of the given


D
is quadratic options

Root node

Inner node

ID

Qus
A
We convert the ________ pointers
16 of binary to threads in threaded
Left
binary tree
If the bottom level of a binary tree
17 is NOT completely filled, depicts Expression tree
that the tree is NOT a
What is the best definition of a
18
collision in a hash table?

Two entries are identical


except for their keys

Leaf node

Right

NULL

None of the giv


options

Threaded binary tree

complete Binary
tree

Perfectly comp
Binary tree

Two entries with


Two entries with different
Two entries wi
different keys have
data have the exact same
exact same key
the same exact
key
different hash v
hash value

Suppose that a selection sort of 100


items has completed 42 iterations
of the main loop. How many items
19
21
are now guaranteed to be in their
final spot (never to be moved again
)
Suppose you implement a Min
heap (with the smallest element on
top) in an array. Consider the
20
16, 18, 20, 22, 24, 28, 30
different arrays below; determine
the one that cannot possibly be a
heap:
A find(x) on element x is
Which of the following statement is performed by returning
21
correct about find(x) operation
exactly the same node that is
found

22

23

24

25

26
27
28
29

30

It is not a requirement that a


find operation returns any
Which of the following statement is specific name, just that finds
NOT correct about find operation on two elements return the
same answer if and only if
they are in the same set
In complete binary tree the bottom
Left to right
level is filled from ________
Here is an array of ten integers: 5 3
8 9 1 7 0 2 6 4 The array after the
FIRST iteration of the large loop in 0 3 8 9 1 7 5 2 6 4
a selection sort (sorting from
smallest to largest)
What requirement is placed on an
The array elements must form
array, so that binary search may be
a heap
used to locate an entry?
Which one of the following
operations returns top value of the Push
stack?
Compiler uses which one of the
Stack
following in Function calls,
Every AVL is _____________
Binary Tree
If there are 56 internal nodes in a
binary tree then how many external 54
nodes this binary tree will have?
If there are 23 external nodes in a
binary tree then what will be the
21
no. of internal nodes in this binary
tree?

ID

Qus
Which one of the following
31 is not an example of
equivalence relation?
Binary Search is an
32 algorithm of searching, used
with the ______ data
Which one of the following
33 is NOT true regarding the
skip list?

41

42

43

16, 20, 18, 24, 22, 30, 28

16, 24, 18, 28, 30, 16, 24, 20, 30,


20, 22
18, 22

A find(x) on element x is
performed by returning
the root of the tree
containing x

A find(x) on
element x is
A find(x) on el
performed by
x is performed
returning the whole
returning TRU
tree itself
containing x

One idea might be to use


a tree to represent each
Initially each set
set, since each element in
contains one
a tree has the same root,
element
thus the root can be used
to name the set

Initially each s
contains one el
and it does not
sense to make a
of one node on

Right to left

Not filled at all

None of the giv


options

2640389175

2649170385 03826491

The array must have at


least 2 entries

The arrays siz


The array must be
must be a powe
sorted
two

Pop

Top

Queue

Binary Search Tree AVL Tree

Complete Binary Tree

None of these

Binary Search

55

56

57

22

23

24

First

Ans

Electrical connectivity

Set of people

<= relation

Set of pixels

Sorted

Unsorted

Heterogeneous

Random

Each list Si contains the List S0 contains the


special keys + infinity and keys of S in non- infinity
decreasing order

Each list is a subsequence List Sh contains only the


D
of the previous one
n special keys

A simple sorting algorithm


34 like selection sort or bubble
sort has a worst-case of

35

Which of the following is a


property of binary tree?

By using __________we
avoid the recursive method
of traversing a Tree, which
36
makes use of stacks and
consumes a lot of memory
and time
Which of the following
statement is true about
37
dummy node of threaded
binary tree?

O(n2) time because sorting


1 element takes O(n) time O(1) time because all lists O(n) time because it
After 1 pass through the
take the same amount of has to perform n swaps
list,either of these
time to sort
to order the list
algorithms can guarantee
that 1 element is sorted

O(n3) time, because the


worst case has really
C
random input which
takes longer to sort

A binary tree of N
external nodes has N
internal node

A binary tree of N
A binary tree of N external A binary tree of N
internal nodes has N+ 1 nodes has N+ 1 internal
internal nodes has N- 1
external node
node
external node

Binary tree only

Threaded binary tree

Heap data structure

Huffman encoding

This dummy node never


has a value

This dummy node has


always some dummy
value

This dummy node has


either no value or some
dummy value

This dummy node has


always some integer
value

N (h + 1)

N1

N1+h

For a perfect binary tree of


38 height h, having N nodes, the N (h 1)
sum of heights of nodes is
Which formula is the best
40 approximation for the depth log (base 2) of n
of a heap with n nodes?
It is not a requirement that
a find operation returns
Which of the following
any specific name, just
41 statement is NOT correct
that finds on two elements
about find operation:
return the same answer if
and only if they are in the
same set

The number of digits in


n (base 10), e.g., 145
The square root of n
has three digits
One idea might be to
use a tree to represent
each set, since each
Initially each set contains
element in a tree has
one element
the same root, thus the
root can be used to
name the set
Remove a randomly
Which of the following is not Randomly remove walls Removing a wall is the
chosen wall if the cells it
42 true regarding the maze
until the entrance and exit same as doing a union
separates are already in the
generation?
cells are in the same set operation
same set
In threaded binary tree the
preorder successor or
inorder successor or
postorder successor or
43 NULL pointers are replaced
predecessor
predecessor
predecessor
by

Initially each set contains


one element and it does
B
not make sense to make
a tree of one node only
Do not remove a
randomly chosen wall if
C
the cells it separates are
already in the same set
NULL pointers are not
replaced

Implementation: for each


Which of the given option is Maintain sizes (number of Make smaller tree, the
root node i, instead of
Make the larger tree, the
44 NOT a factor in Union by
nodes) of all trees, and
subtree of the larger
setting parent[i] to -1, set C
subtree of the smaller one
Size:
during union
one
it to -k if tree rooted at i
has k nodes
Suppose we had a hash table
whose hash function is n %
12, if the number 35 is
45 already in the hash table,
143
144
145
148
A
which of the following
numbers would cause a
collision?
A binary tree with 24 internal
47 nodes has ______ external 22
23
25
48
C
nodes

ID

Qus
A
In case of deleting a
node from AVL tree,
48
Yes
rotation could be
prolong to the root node
when we have declared
the size of the array, it is
not possible to increase
49
Declaration
or decrease it during the
________of the
program
50 it will be efficient to
Variable
place stack elements at
the start of the list

No

Execution

Defining

None of the abov

Constant

Inconsistent

None of the above

51

52

53

55

56
57

58

59

60

61

62

63

because insertion and


removal take
_______time
_______ is the stack
characteristic but
_______was
implemented because of
the size limitation of the
array
What kind of list is best
to answer questions
such as "What is the
item at position n?"
Each node in doubly
link list
has________pointer(s)
A binary tree with N
internal nodes has
_____ links, _______
links to internal nodes
and ________ links to
external nodes
The definition of
Transitivity property is
Union is a _______ time
operation
Huffman encoding uses
_________ tree to
develop codes of
varying lengths for the
letters used in the
original message
Consider a min heap,
represented by the
following array:
10,30,20,70,40,50,80,60
After inserting a node
with value 31.Which of
the following is the
updated min heap?
Consider a min heap,
represented by the
following array:
11,22,33,44,55 After
inserting a node with
value 66.Which of the
following is the updated
min heap?
_________ is a data
structure that can grow
easily dynamically at
run time without having
to copy existing
elements
The maximum number
of external nodes
(leaves) for a binary tree
of height H is
_________
A complete binary tree
of height ____ has
nodes between 16 to 31

isFull(),isEmpty()

pop(), push()

isEmpty() , isFull()

push(),pop()

Lists implemented with an


Doubly-linked lists
array

Singly-linked lists

Doubly-linked or si
linked lists are equa

N+1, 2N, N-1

N+1, N-1, 2N

2N, N-1, N+1

N-1, 2N, N+1

For all element x member


of S, x R x

For all elements x, y and z, For all elements w,


For all elements x and y, x
if x R y and y R z then x R z, if x R y and w R
R y if and only if y R x
z
Rz

Constant

Polynomial

Exponential

None of the given o

Linked list

Stack

Queue

Binary tree

10,30,20,31,40,50,80,60,70 10,30,20,70,40,50,80,60,31 10,31,20,30,40,50,80,60,31 31,10,30,20,70,40,5

11,22,33,44,55,66

11,22,33,44,66,55

11,22,33,66,44,55

11,22,66,33,44,55

Array ()

List

Both of these

None of these

2^H

2^H +1

2^H -1

2^H +2

ID
64

65

67
68

69

70
71

72
73
74
75

76

Qus
Which of the given option is NOT a factor in
Union by Size
Suppose A is an array containing numbers in
increasing order, but some numbers occur
more than once when using a binary search for
a value, the binary search always finds
____________
+ is a _________operator
A kind of expressions where the operator is
present between two operands called
________expressions
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 ?
If you know the size of the data structure in
advance, i.e., at compile time, which one of the
following is a good data structure to use
If a complete binary tree has height h then its
no. of nodes will be,
If a max heap is implemented using a partially
filled array called data, and the array contains
n elements (n > 0), where is the entry with the
greatest value?
Which one is a self-referential data type?
There is/are ________ case/s for rotation in an
AVL tree,
Which of the following can be the inclusion
criteria for pixels in image segmentation
Consider te following array 23 15 5 12 40 10 7
After the first pass of a particular algorithm,
the array looks like 15 5 12 23 10 7 40 Name
the algorithm used

A
B
Maintain sizes
Make smaller
(number of nodes)
tree, the subtree
of all trees, and
of the larger one
during union

C
Make the larger
tree, the subtree
of the smaller
one

the second
the first occurrence
occurrence of a
of a value
value

may find first or


second
None of the given options
occurrence of a
value

Unary

Binary

Ternary

None of the above

Postfix

Infix

Prefix

None of the above

Both x and y are


still 0

x is now 1, but y x is still 0, but y


x is now 1, and y is now 2
is still 0
is now 2

Array

List

Both of these

None of these

Log (h)

2^(h+1)- 1

Log (h) - 1

2^h - 1

data[0]

data[n-1]

data[n]

data[2*n+1]

Stack

Queue

Link list

All of these

Pixel intensity

Texture

Threshold of
intensity

All of the given options

Heap sort

Selection sort

Insertion sort

Bubble sort

Rotations equal
to number of
No rotation at all
levels
In a table, the type A table consists
A major use of table is in
The row of a
of information in of several
databases where we build
table is called a
columns may be
columns, known
use tables for keeping
record
different
as entities
information

77

In a perfectly balanced tree the insertion of a


node needs ________

79

Which of the following is NOT a correct


statement about Table ADT

80

If both pointers of the node in a binary tree are


Inner node
NULL then it will be a/an _______

ID

D
Implementation: for each
node i, instead of setting
parent[i] to -1, set it to -k
tree rooted at i has k node

One rotation

Two rotations

Leaf node

Qus
A
B
Suppose we are sorting an array of
eight integers using quick sort, and we
The pivot could be
have just finished the first partitioning The pivot could be either
81
the 7, but it is not
with the array looking like this: 2 5 1 the 7 or the 9
the 9
7 9 12 11 10 Which statement is
correct?

Root node

None of the given options

The pivot is not the


Neither the 7 nor the
7, but it could be
the pivot
the 9

A binary tree with 33 internal nodes


31
has _______ links to internal nodes
The _______ method of list will
83 position the currentNode and
Remove
lastCurrentNode at the start of the list
Elements in the first half
Mergesort makes two recursive calls.
of the array are less than
Which statement is true after these
84
or equal to elements in
recursive calls finish, but before the
the second half of the
merge step?
array
The arguments passed to a function
should match in number, type and
85
True
order with the parameters in the
function definition
If numbers 5, 222, 4, 48 are inserted
86 in a queue, which one will be
48
removed first?
Suppose currentNode refers to a node
in a linked list (using the Node class
with member variables called data and
87
currentNode ++;
nextNode). What statement changes
currentNode so that it refers to the
next node?
A Compound Data Structure is the
data structure which can have multiple
88 data items of same type or of different Arrays
types. Which of the following can be
considered compound data structure?
a binary search tree has
two children per node
The difference between a binary tree
89
whereas a binary tree can
and a binary search tree is that
have none, one, or two
children per node
Compiler uses which one of the
90 following to evaluate a mathematical Binary Tree
equation
Which of the following method is
91
insert
helpful in creating the heap at once?
A complete binary tree of height 3 has
92
8 to 14
between ________ nodes
Consider a min heap, represented by
the following array: 3,4,6,7,5,10 After
93 inserting a node with value 1.Which 3,4,6,7,5,10,1
of the following is the updated min
heap?
Which one of the following
94 algorithms is most widely used due to Bubble Sort
its good average time
We are given N items to build a heap,
95 this can be done with _____
N-1
successive inserts
82

ID
96

Qus
__________ only removes
items in reverse order as they
were entered

32

33

66

Next

Start

Back

None of the given


options

Elements in the secon


half of the array are le
The array elements
than or equal to eleme
form a heap
in the first half of the
array

False

222

currentNode =
nextNode;

currentNode +=
nextNode;

currentNode =
currentNode->nextNo

LinkLists

Binary Search Trees All of the given optio

in binary search tree


nodes are inserted
based on the values
they contain

in binary tree nodes


are inserted based
none of these
on the values they
contain

Binary Search Tree

Parse Tree

AVL Tree

add

update

preculateDown

8 to 15

8 to 16

8 to 17

3,4,6,7,5,1,10

3,4,1,5,7,10,6

1,4,3,7,5,10,6

Insertion Sort

Quick Sort

Merge Sort

N+1

N^2

A
Stack

Queue

Both of these

None of these

97

Select the one FALSE statement Every binary tree has


about binary trees
at least one node

Every non-empty tree


has exactly one root
node

Every node has at most Every non-root node h


two children
exactly one parent

98

Searching an element in an AVL


tree take maximum _______
1.44 Log2n
time (where n is no. of nodes in
AVL tree),

1.66 Log2n

Log2(n+1)

Log2(n+1) -1

Suppose you implement a heap


(with the largest element on top)
in an array. Consider the
99
7364251
different arrays below,
determine the one that cannot
possibly be a heap
In the worst case of deletion in
100
Only one rotation
AVL tree requires _________
A Threaded Binary
Tree is a binary tree in
which every node that
Which of the following
does not have a left
101
statement is correct?
child has a THREAD
(in actual sense, a link)
to its INORDER
successor
Which of the following
102 statement is NOT true about
threaded binary tree?

103

104

105

106

107

108

109

110

111

112

7643521

7362145

Rotation at each non-leaf Rotation at each leaf


node
node
A Threaded Binary
A Threaded Binary Tree
Tree is a binary tree in
is a binary tree in which
which every node that
every node that does not
does not have a right
have a right child has a
child has a THREAD
THREAD (in actual
(in actual sense, a link)
sense, a link) to its
to its INORDER
PREOREDR successor
successor
The left pointer of
Right thread of the
Left thread of the leftdummy node points to
right-most node points most node points to the
the root node of the
to the dummy node
dummy node
tree

Consider a min heap,


represented by the following
array: 3,4,6,7,5 After calling the
4,6,7,5
function deleteMin().Which of
the following is the updated min
heap?
We can build a heap in
Linear
________ time
While joining nodes in the
building of Huffman encoding
tree if there are more nodes with Randomly
same frequency, we choose the
nodes _______
... is a linear list where
and take
place at the same end . This end (i) queue (ii) insertion
is called the .. What (iii) removals (iv) top
would be the correct filling the
above blank positions?
Which traversal gives a
decreasing order of elements in
post-order
a heap where the max element is
stored at the top?
Which of the following is a non
Linked List
linear data structure?
The data of the problem is of
2GB and the hard disk is of
Use better data
1GB capacity, to solve this
structures
problem we should
In an array list the current
The first element
element is
ID
Qus
A
In sequential access data
structure, accessing any
element in the data
structure takes different
Arrays
amount of time. Tell which
one of the following is
sequential access data
structure
I have implemented the
(last % 1) + CAPACITY
queue with a circular array.
If data is a circular array of
CAPACITY elements, and

7654321

Rotations equal to log

A Threaded Binary Tr
a binary tree in which
every node that does n
have a right child has
THREAD (in actual
sense, a link) to its
POSTORDER success

Left thread of the righ


most node points to th
dummy node

6,7,5,4

4,5,6,7

4,6,5,7

Exponential

Polynomial

None of the given opti

That occur first in the


text message

That are lexically


smaller among others

That are lexically grea


among others

(i) stack (ii) insertion


(iii) removals (iv)
bottom

(i) stack (ii) insertion


(iii) removals (iv) top

(i) tree (ii) insertion (ii


removals (iv) top

level-order

inorder

None of the given opti

Stack

Queue

Tree

Increase the hard disk


space

Use the better


algorithm

Use as much data as w


can store on the hard d

The middle element

The last element

The element where the


current pointer points
D
A

Lists

Both of these

None of these

last % (1 + CAPACITY)

(last + 1) % CAPACITY

last + (1 %
CAPACITY)

113

115

116

117

last is an index into that


array, what is the formula
for the index after last?
Which one of the
following is TRUE about
recursion?
Which one of the
following is TRUE about
iteration?
Which of the following
heap method increase the
value of key at position
p by the amount delta?
If we have 1000 sets each
containing a single
different person. Which of
the following relation will
be true on each set

Which of the following


118 statements is correct
property of binary trees?

Recursion extensively uses Threaded Binary Trees use


stack memory
the concept of recursion
Iteration extensively uses
stack memory

Threaded Binary Trees use


the concept of iteration

increaseKey(p,delta)

decreaseKey(p,delta)

preculateDown(p,delta)

remove(p,delta

Reflexive

Symmetric

Transitive

Associative

A binary tree with N


internal nodes has N+1
internal links

A binary tree with N


external nodes has 2N
internal nodes

A binary tree with N


internal nodes has N+1
external nodes

None of above
statement is a
property of the
binary tree

n log n

n2

In a selection sort of n
elements, how many times
119 the swap function is called n-1
to complete the execution
of the algorithm?
Consider the following
postfix expression S and
the initial values of the
variables. S = A B - C + D
120 E F - + ^ Assume that
-1
A=3, B=2, C=1, D=1,
E=2, F=3 What would be
the final output of the
stack?
To perform Union of two
Which of the following
sets, we merge the two
122 statement is correct about trees by making the root of
union?
one tree point to the root of
the other
Let heap stored in an array
as H = [50, 40, 37, 32, 28,
22, 36, 13]. In other words,
the root of the heap
123
[50,32, 37,13, 28, 22, 36]
contains the maximum
element. What is the result
of deleting 40 from this
heap
In an array we can store
124 data elements of different True
types
Which one of the
In linked list the elements
125 following statement is
are necessarily to be
NOT correct
contiguous
Doubly Linked List always
126
True
has one NULL pointer
128

Iteration is mo
efficient than
iteration
Recursion is m
Iterative function calls
efficient than
consumes a lot of memory
iteration
Recursive function calls
consume a lot of memory

A queue is a data structure inserted at the front and


where elements are
removed from the back

To perform Union of two


sets, we merge the two trees perform Union of two sets,
None of the giv
by making the leaf node of merging operation of trees
options
one tree point to the root of in not required at all
the other

[37, 28, 32, 22, 36, 13]

[37, 36, 32, 28, 13, 22]

[37, 32, 36, 13


22]

False
In linked list the elements
may locate at far positions
in the memory

In linked list each element In an array the


also has the address of the elements are
element next to it
contiguous

False
inserted and removed from
the top

inserted at the back and


removed from the front

inserted and
removed from
both ends

ID
Qus
129 Each node in doubly link list has
I have implemented the queue with a linked list, keeping
track of a front pointer and a rear pointer. Which of these
130
pointers will change during an insertion into an EMPTY
queue?
If a complete binary tree has n number of nodes then its
131
height will be
If a complete binary tree has height h then its no. of nodes
132
will be
A binary relation R over S is called an equivalence
133
relation if it has following property(s)
Use of binary tree in compression of data is known as
134
_______
135

While building Huffman encoding tree the new node that


is the result of joining two nodes has the frequency

A Threaded Binary Tree is a binary tree in which every


137 node that does not have a right child has a THREAD (in
actual sense, a link) to its __________ successor
A complete binary tree is a tree that is _________ filled,
138
with the possible exception of the bottom level
Consider the following infix expression: x y * a + b / c
139 Which of the following is a correct equivalent
expression(s) for the above?
In a min heap, preculateDown procedure will move
140
smaller value______ and bigger value______
When an array of object is created dynamically then there
141 is no way to provide parameterized constructors for array
of objects
142 Reference is not really an address it is ______________
Which of the following concept is NOT associated with
143
stream?
144 To get the memory address of a variable we use ____

ID

Qus

A
1 pointer

B
2 pointers

C
3 pointers

D
4 pointers

Ans
B

Neither
changes

Only front
pointer
changes

Only rear pointer


changes

Both change

Log2 (n+1) -1

2n

Log2 (n) - 1

2n - 1

Log (h)

2^(h+1) - 1

Log (h) - 1

2^h - 1

Reflexivity

Symmetry

Transitivity

All of the given


options

Traversal

Heap

Union

Huffman encoding

Equal to the
Equal to the
small frequency greater

Equal to the
Equal to the sum of
difference of the
the two frequencies
two frequencies

Inorder

levelorder

Preorder

Postorder

partially

completely

incompletely

partly

x y -a * b +c /

x *y a - b c / + x y a * - b c / +

x y a * - b/ + c

left, right

Right, left

Down, up

True

False

a synonym

an antonym

a value

a number

Source

Template

Destination

State

&

Up, down

D
none of the given
options

Ans

145 Class is a user defined___________

data type

memory reference

value

The compiler generates


__________________ automatically
In_________, we try to have a precise
147
problem statement
From the following; which on is the
148 correct syntax of an array declaration:
array size is 5 and it is of float data type?
For the inorder traversal of threaded
binary tree, we introduced a dummy node.
149
The left pointer of the dummy node is
pointing to the ________ node of the tree

member
functions

classes

objects of a class

constructors

Analysis

Design

Coding

None of the given

float [5] name;

name[5] float;

float name[5];

None of the given


options

left most

Root

right most

any of the given


node

146

When a complete binary tree, represented


150 by an array then for any array element at
position i, the parent is at position ______
Consider a binary tree, represented by the
151 following array: A,B,C,D,E,F,G,H,I,J,K,L
Is it a strictly binary tree?
A queue where the de-queue operation
152 depends not on FIFO, is called a priority
queue
Consider the function X as under int X
(int& Value) { return Value; } Now a and
153 b are integers in a calling function. Which
one of the following is a valid call to the
above function X
In the call by value methodology, a copy
154 of the object is passed to the called
function
155 The tree data structure is a

156

When should you use a const reference


parameter?

class foo { public: void x(foo f); void


y(const foo f); void z(foo f) const; Which
157 of the three member functions can alter
the PRIVATE member variables of the foo
object that activates the function?
What is the maximum depth of recursive
calls a function may make?
Suppose n is the number of nodes in a
159 complete Binary Tree then maximum
steps required for a search operation are
158

ID

2i-1

2i

Yes

No

True

False

a = X (b) ;

a = X (&b) ;

True

False

Linear data
structure

Non-linear data
structure

Graphical data structure

Data structure like


queue

Whenever the
parameter has
huge size

Whenever the parameter


has huge size, the
function changes the
parameter within its
body, and you do NOT
want these changes to
alter the actual argument

Whenever the
parameter has huge
size, the function
changes the parameter
within its body, and you
DO want these changes
to alter the actual
argument

Whenever the
parameter has huge
size, and the function
B
does not change the
parameter within its
body

Only x can alter


the private
member variables
of the object that
activates the
function

Only y can alter the


private member
variables of the object
that activates the
function

Only z can alter the


private member
variables of the object
that activates the
function

Two of the functions


can alter the private
member variables of D
the object that
activates the function

n (where n is the
argument)

There is no fixed
maximum

Log2 (n+1) -1

Log2 (n+1)

Log2 (n) - 1

Log2 (n)

Qus

2i+1

floor(i/2)

a = X (*b) ;

None of the given


options

C
After all other
entries that are
greater than the
new entry

D
After all other
entries that are
smaller than the
new entry

Ans

In the linked list implementation of the stack class, where


160 does the push member function places the new entry on At the head
the linked list?

At the tail

we have a circular array implementation of the queue


class, with ten items in the queue stored at data[2]
161 through data[11]. The CAPACITY is 42, i.e., the array
has been declared to be of size 42. Where does the push
member function place the new entry

data[1]

data[2]

data[11]

data[12]

162 The expression AB+C* is called?

Prefix
expression

Postfix
expression

Infix expression

None of these

Binary Search
tree

AVL tree

All of these

H and E

D and E

L and M

_________ is a binary tree where every node has a value,


every node's left subtree contains only values less than or Strictly Binary
163
equal to the node's value, and every node's right subtree Tree
contains only values that are greater then or equal?
164 Consider the following binary search tree (BST), If node J and I
A in the BST is deleted, which two nodes are the

candidates to take its place?


Non Linear way
only

Both linear and


non linear ways
Hybrid data
structure (Mixture
of Linear and Non
Linear)

None of the given


B
options

Call by passing
the value of the
argument
At least half of
Any one node
the nodes fulfill
fulfills the AVL
the AVL
condition
condition

Call by passing
reference of the
argument

Call by passing
the address of the B
argument

All the nodes


fulfill the AVL
condition

None of the given


C
options

Leaf Nodes

Root Nodes

Both of these

None of these

True

False

True

False

165 We access elements in AVL Tree in

Linear way only

166 AVL Tree is

Non Linear data


Linear data
structure Click
structure
here for detail

Each operator in a postfix expression refers to the


previous ________ operand(s)
Which one of the following calling methods does not
168 change the original value of the argument in the calling
function?
167

169 A tree is an AVL tree if

170
171
172
173
174

ID
175

176

177

178

179

Consider the following tree. How many of the nodes have


at least one sibling?
The nodes with no successor are called _________
A binary search tree should have minimum of one
________ node/s at each level
A subscript of an array may be an integer or an integer
expression
Doubly Linked List always has one NULL pointer

Qus
In which of the traversal
method, the recursive calls can
be used to traverse a binary
tree ?
Suppose currentNode refers to a
node in a linked list (using the
Node class with member
variables called data and
nextNode). What boolean
expression will be true when
cursor refers to the tail node of
the list?
Which of the following tests in
the client code correctly
compares two class objects
alpha and beta?
In C what is the operation that
you can not do with primitive
types?
The operation for adding an
entry to a stack is traditionally
called

1
None of the
given options

A
In preorder
traversal only

None of the given


A
options

Ans

In postorder traversal
All of the given options
only

(currentNode == (currentNode->nextNode
null)
== null)

(nextNode.data ==
null)

(currentNode.data == 0.0)

if (alpha < beta)

if (LessThan(alpha,
beta))

if (LessThan(alpha).beta)

In inorder traversal only

if (alpha.LessThan(beta))

Assign a value to Declare primitive types to Create a new instance


primitive type
be constant using the Const of primitive type with None of these
using a literal
keyword
New keyword

add

append

insert

push

The operation for removing an


180 entry from a stack is
traditionally called
Consider the following sequence
of push operations in a stack:
stack.push(7); stack.push(8);
181 stack.push(9);
stack.push(10);
stack.push(11);
stack.push(12);
________ is the maximum
182 number of nodes that you can
have on a stack-linked list ?
Which of the following can be
183
used to reverse a string value
An array is a group of
184 consecutive related memory
locations
185

Which one of the following


statements is NOT correct?

Suppose that the class


declaration of SomeClass
includes the following function
prototype. bool
186 LessThan( SomeClass
anotherObject ); Which of the
following tests in the client code
correctly compares two class
objects alpha and beta?
A queue is a----- data structure,
187 whereas a stack is a -----data
structure
Which one of the following
188 operators has higher priority
than all of others?
Four statements about trees are
below. Three of them are
189
correct. Which one is
INCORRECT?

ID
190

191

192
193
194
195
196

delete

peek

pop

remove

7 8 9 10 11 12

9 8 11 10 7 12

9 10 8 11 12 7

9 10 8 12 7 11

Zero

2n (where n is the number


of nodes in linked list)

Any Number

None of these

Stack

Queue

Both of these

None of these

True

False

Array size can be


Link List size can be
changed after its
changed after its creation
creation

Binary Search Tree


size can be changed
after its creation

AVL Tree size can be


changed after its creation

if (alpha < beta)

if (alpha.LessThan(beta))

if (LessThan(alpha,
beta))

if (LessThan(alpha).beta)

FIFO, LIFO

LIFO,FIFO

none of these

both of these

Multiplication
operator

Minus operator

Plus operator

Exponentiation operator

Trees are
recursively
defined multidimensional data
structures tree

The order of a tree indicates


a maximum number of
children allowed at each
node of the

A search tree is a
special type of tree
where all values (i.e.
keys) are ordered

If Tree1's size is greater than


Tree2's size, then the height
D
of Tree1 must also be greater
than Tree2's height

C
We can increase but
can't decrease the size
of arrays after their
creation

Qus
Which of the following is "TRUE"
about arrays
Consider the following infix
expression. 5 + 6/2 If one converts the
above expression into postfix, what
would be the resultant expression?
Addition of new items in stack make
the pointer ------------ by 2
Next item in a linked list is known as
In an AVL tree to delete a parent with
two childs in a straight line following
rotations will be required
BST is a Structure
After creation of an array

We can increase the We can decrease


size of arrays after the size of arrays
their creation
after their creation

Ans

We can neither increase


nor decrease the array size D
after their creation

56/ + 2

562/+

56/2+

/62 + 5

Increment, bits

Increment, bytes

Decrement, bits

Decrement, bytes

Index

Item

Node

Child

Single

Double

Triple

None

Circular
Size can neither be
increased nor be

None of Above
B
Size can be increased and C
can also be decreased

Linear
Non Linear
Size can be
Size can be
increase but can not decreased but can

197 Each node in a BST has Pointers


Highest Operators Precedence is of the
198
following operator
Following are the linear data
199
structures
Each entry which points to a null
200 value in a Singly Linked List is known
as
Non recursive calls are faster than the
201
Recursive calls
202 Tree data structure is a
When an operator is used in between
203 two operands this is which type of
notation
Suppose a pointer has been declared in
204 main but has not assigned any variable
address then

ID
205

be decreased
1

not be increased
2

decreased
3

Plus

Minus

Multiply

Exponentiation

Stacks

Queues

Both a & b

None of the above

Node

First Node

Last Node

Head Node

True

False

Linear

Non Linear

Circular

None of Above

Prefix

Postfix

Infix

None of the Above

None of these

That pointer points to any


D
memory address

That pointer points That pointer


to First byte in
contains a NULL
main function
value

Qus
Which statement of the following statements is
incorrect?

206 Parameters in function call are passed using


void test_a(int n) { cout << n << " "; if (n>0)
207 test_a(n-2); } What is printed by the call
test_a(4)?
208 Queue follows
is a binary tree where every node has a value,
every node's left subtree contains only values
209 less than or equal to the node's value, and every
node's right subtree contains only values that are
greater then or equal ?
Below is a binary search tree. If we delete the
210 value 50 using the algorithm we discussed, what
value will be in the root of the remaining tree?
Is a data structure that can grow easily
211 dynamically at run time without having to copy
existing elements?
In a program a reference variable, say x, can be
212
declared as
Linked lists are collections of data items "lined
up in a row" , insertions and deletions can be
213
made only at the front and the back of a linked
list
214 A Linear Data Structure is the data structure in

A
Lists can be
implemented by
using arrays or
linked lists
Stack

C
Stack is a special kind
A list is a sequence
of list in which all
of one or more data
insertions and deletions
items
take place at one end
Queue
Binary Search Tree

D
Ans
Stacks are
easier to
D
implement than
lists
AVL Tree
A

420

024

02

24

Last in First out

First in Last out

First in First out

None of these

Strictly Binary Tree Binary Search tree

AVL tree

All of these

50

60

70

80

Array

List

Both of these

None of these

int &x ;

int *x ;

int x ;

None of the
given options

True

False

Arrays

LinkLists

B
Binary Search Trees

None of these

which data elements are arranged in a sequence


or a linear list. Which of the following is Non
Linear Data Structure?
215

Which one of the following statements is


correct?

216

Which one of the following is correct about


pointers?

Link List size is


fixed once it is
created
They always point They may point to a
todifferent memory singlememory
locations
location
Array size is fixed
once it is created

Which of the following abstract data types are


short
Int
NOT used by Integer Abstract Data type group?
We can add elements in QUEUE From
218
Front
Rear
_________
3 + 5 * 6 - 7 * (8 + 5) Which of the following is
219
365+*758+-* 365758+*+-*
a correct equivalent expression(s) for the above?
217

ID
220

221

222

223

225

226
227
228

Qus
An array is a group of
consecutive related
memory locations
A node cannot be deleted,
when the node to be
deleted has both left and
right subtrees
Deleting a leaf node in
binary search tree
involves setting ______
pointer/s of that nodes
parent as null
For a perfect binary tree
of height 4. What will be
the sum of heights of
nodes?
If we want to find median
of 50 elements, then after
applying buildHeap
method, how many times
deleteMin method will be
called ?
The main reason of using
heap in priority queue is
The total number of nodes
on 10th level of a perfect
binary tree are
Which property of
equivalence relation is

Binary Search Tree size AVL Tree size


isfixed once it is
is fixed once it A
is created
created
The address of two
pointer variables is
same

None of these

float

long

From Both Rare and


Front

None of these

356+*785+-*

356*+785
+*-

True

False

True

False

31

30

27

26

25

35

50

improve performance

code is readable

less code

heap can't be u
queues

256

512

1024

Can't be determ

Reflexivity

Symmetry

Transitivity

All of the abov

229

230

231

232

233

234

235

satisfied if we say: Ahmad


R(is related to) Ahmad
If a tree has 50 nodes,
then the total edges/links
in the tree will be
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?
It is necessary fro
Huffman encoding tree to
be
A binary tree with 45
internal nodes has
_________ links to
external nodes
In which of the following
tree, parent nodes has key
greater than or equal to its
both children?
If there are N external
nodes is a binary tree then
what will be the no. of the
internal nodes in this
binary tree?
See the below code and
fill the appropriate answer
for? Void
fastlnorder(TreeNod+p)
{while((p+nextInorder(p))
!+ ? ) cout << p>getInfo();}

55

51

50

49 N-1= 49

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

AVL tree

Binary tree

Complete binary Tree

None of these

44

45

46

90

Max heap

Binary search tree

Threaded Binary tree

Complete Bina

N-1

N+1

N+2

Dummy

rootNode

LTH

RTH

ID
Qus
A
236 An expression tree will always be a Complete binary tree
In a threaded binary tree which
237
All leaf nodes
nodes have NULL child pointers
We implement the heap by
238
Threaded Tree
____________

239

Which of the following statement


concerning heaps is NOT true?

B
Binary search tree
Nodes other then leaf
nodes

C
Heap AVL tree

AVL tree

Complete binary tree

Removing the item at the


Traversing a heap in
top provides immediate
order provides access to
access to the key value
the data in numeric or
with highest (or lowest)
alphabetical order
priority

When a complete binary tree


represented by an array then if right
240
2
child is at position 5 then left child
will be at position _____
If a binary tree has N + 1 external
241
It has N internal nodes
nodes then
Consider a binary tree, represented
by the following array:
242
True
A,B,C,D,E,F,G,I Is it a strictly
binary tree ?

Root Node

D
Non of then
None of the
nodes

Ans
B

Expression

Inserting an item is always


done at the end of the
A heap may be
array, but requires
stored in an
A
maintaining the heap
array
property

It has N-1 internal nodes

It has N/2 internal nodes

It has N+2
A
internal nodes

False

S-ar putea să vă placă și