CS301- Data Structures
SOLVED MCQS &
SUBJECTIVE FROM MIDTERM PAPERS
Question: ( Marks: 1
) - Please choose one
In a complete binary tree of depth 5
the number of non-leaf nodes
is
|
15
|
|
32
|
|
16
|
31
Question: (
Marks: 1 ) -
Please choose one
Which of the following is NOT a linear data structure?
Linked
List
Stack
Queue
Tree (page
121)
Recursive
function calls are implemented internally using a data
structure
Stack
Link-List
Tree
Queue
Question No: 1
( Marks: 1 ) - Please
choose one
A queue where the
de-queue operation depends
not on FIFO, is called
a priority queue
Ø
► False
Ø ► True Page101
Question No: 2
( Marks: 1 ) - Please
choose one
The data of the problem is of 2GB and
the hard disk is of 1GB capacity, to solve this problem we should
► Use
better data structures
► Increase
the
hard disk space (Page
5)
► Use
the better algorithm
► Use
as much data as we
can store on the hard disk
Question No: 3
( Marks: 1 ) - Please
choose one
Consider the function X
as under int X (int& Value)
{
return Value;
}
Now a and b are integers in
a calling function. Which one of
the following is a valid call to
the above function
X.
► a
= X (b) ;
► a = X (&b)
;
► a
= X (*b) ;
► None of the given options
Here function
argument passing by reference
method
is used, so when we call a function
we will give
the variable reference as parameter.
Question No: 4
( Marks: 1 ) - Please
choose one
In
the call by value methodology,
a copy of the object is passed
to the called function.
► False
► True(Page 202)
Question No: 5 (
Marks: 1 ) - Please choose
one
The tree data structure is
a
► Linear data
structure
► Non-linear data structure(Page
112)
► Graphical data structure
► Data structure
like
queue
Question No:
6 ( Marks: 1 ) -
Please choose one
When should you use a const reference
parameter?
► 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
does not change the parameter within
its body. Declaring a parameter as
a const simply means
that
the function can’t change
the value of its parameters.
Question No: 7
( Marks: 1 ) - Please
choose one
Here is the start of a C++
class declaration:
class foo
{
public:
void
x(foo f);
void y(const foo
f);
void
z(foo
f) const;
...
Which
of the three member
functions can alter
the
PRIVATE member variables of the foo object that
activates
the function?
► 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 the object that
activates
the function.
Only the x and y
can alter the private member variable
of the foo class object. Last Option is more
Correct but
not exact. In
the last option the
two function name are not
mentioned
Question No: 8 (
Marks: 1 ) - Please choose
one
What is the maximum depth
of recursive calls a
function may make?
►1
►2
► n (where n is the argument)
► There is no fixed
maximum
Question No: 9
( Marks: 1 ) - Please
choose one
Suppose n is the number of
nodes in a complete Binary Tree
then maximum steps
required for a search
operation are,
► Log2
(n+1) -1(Page 139)
► Log2 (n+1)
► Log2 (n) – 1
► Log2 (n)
Question No: 10
( Marks: 1 ) - Please
choose one
In the linked list implementation
of the stack class, where does the
push member function places the new entry
on the linked list?
► At the
head(Page 53)
► At the tail
► After all other
entries
that
are greater than
the
new entry.
► After all other
entries
that
are smaller than
the new entry.
Question No: 11
( Marks: 1 ) - Please
choose one
Suppose we have
a circular array implementation
of the queue class, with ten
items
in
the queue stored
at data[2] 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 in the
array?
► data[1]
► data[2]
► data[11]
► data[12]
Question No: 12
( Marks: 1 ) - Please
choose one
The expression AB+C* is called?
► Prefix
expression
► Postfix expression (Page 70)
► Infix expression
► None of these
Question No: 13
( Marks: 1 ) - Please
choose one
is a binary tree
where every node has a value, every node's
left
subtree
contains only values
less than or equal to the
node's value, and every node's right subtree contains only values
that
are greater then
or equal?
► Strictly Binary Tree
► Binary
Search tree (sure)
► AVL tree
► All of these
Question No: 14
( Marks: 1 ) - Please
choose one
Consider the following binary search
tree (BST):
If
node A in the BST is deleted, which two
nodes are the candidates to
take its place?
► J and I
► H and E
► D and E
► L and M
Question No: 15
( Marks: 1 ) - Please
choose one
Let’s
call the node as that requires re-balancing. Consider the two cases
given below:
1) An insertion
into left sub tree of the left child
of a
2) An insertion
into right sub tree of the right
child
of a.
Which of the following statement is correct about these
two
cases?
1) The insertion occurs outside (i.e.,
left-left or right-right) in
cases 1 and 2 single rotation can
fix the balance in
these two
cases.
2) The insertion
occurs inside ((i.e., left-left or
right-right) in
cases 1 and 2. single rotation
cannot fix the balance in these
two
cases
Question No: 16
( Marks: 1 ) - Please
choose one
We access elements
in AVL Tree in,
► Linear way only
► Non Linear
way only
► Both linear and
non linear ways
► None of the given options.
Question No: 17
AVL Tree is,
► Non Linear
data structure
► Linear data
structure
► Hybrid data
structure (Mixture
of Linear and Non Linear)
► None of the given options.
Question No: 1(
Marks: 1 ) -
Please choose one
Which one of the
following statement is NOT correct .
► In linked list the elements are necessarily
to be contiguous
► In linked
list
the elements may locate
at far positions in
the memory
► In linked list each
element also has the
next to it
► In an array the elements
are contiguous
Question No: 2
( Marks: 1 ) - Please
choose one
Each operator in
a postfix expression refers to the
previous operand(s).
► One
► Two
(Page 67)
► Three
► Four
Question No: 3
( Marks: 1 ) - Please
choose one
Which one of the
following calling
methods
does not change the original value of the argument in the
calling
function?
► None
of the given options
► Call by passing
the value of the argument
► Call by passing
reference of the
argument
► Call by passing
the address of the argument
Question No: 4
( Marks: 1 ) - Please
choose one
A tree is an AVL tree
if
► Any one node fulfills the
AVL condition
► At least half
of the nodes fulfill the AVL condition
► All the nodes fulfill the AVL condition(Page 213)
► None of the given options
Question No: 5
( Marks: 1 ) - Please
choose one
Suppose currentNode
refers to a node in a linked list (using the
Node class with
member variables
called
data and nextNode). What statement changes currentNode so
that it refers to
the next node?
► currentNode ++;
► currentNode =
nextNode;
► currentNode += nextNode;
► currentNode = currentNode->nextNode;
Question No:
6 ( Marks: 1 )
- Please choose one
A queue where the
de-queue operation depends
not on FIFO, is called
a priority queue
► False
► True
(Page 101)
Question No: 7
( Marks: 1 ) - Please
choose one
Which one is
a self- referential data type?
► Stack
► Queue
► Link list
► All of these
Question No: 8
( Marks: 1 ) - Please
choose one
Each node in doubly link
list has,
► 1 pointer
► 2 pointers (Page
39)
► 3 pointers
► 4 pointers
Question No: 9
( Marks: 1 ) - Please
choose one
I have implemented
the queue with a linked
list,
keeping track of a front pointer and a
rear pointer. Which of these
pointers will change
during
an insertion into an EMPTY
queue?
► Neither changes
► Only front
pointer changes.
► Only
rear pointer changes.
► Both change.
Question No: 10
( Marks: 1 ) - Please
choose one
Consider the following tree.
How many of the
nodes have at least one sibling?
►8
►7
►5
►6
A sibling
is an element that
shares the same parent
with
another element
Question No: 11
( Marks: 1 ) - Please
choose one
The nodes with
no successor are called
► Root Nodes
► Leaf
Nodes
► Both of these
► None of these
Question No: 12
( Marks: 1 ) - Please
choose one
AVL Tree is,
► Non Linear
data structure
Click here for detail
► Linear data
structure
► Hybrid data
structure (Mixture
of Linear and Non Linear)
► None of the given options.
Question No: 13
( Marks: 1 ) - Please
choose one
We access elements
in AVL Tree in,
► Linear way only
► Non Linear
way only
► Both linear and
non linear ways
► None of the given options.
Question No: 14
( Marks: 1 ) - Please
choose one
A binary search tree
should have minimum of
one node/s at each level,
► One
► Two
► Three
► Four
Question No: 15
( Marks: 1 ) - Please
choose one
Consider the following statements.
(i) A binary tree can contain at least 2L Nodes
at level L.
(ii) A complete binary tree
of depth d is a binary tree that
contains 2 L Nodes at each level L between 0 and d, both inclusive.
(iii) The total number
of nodes (Tn ) in a complete binary tree of depth
d is 2 d+1 - 1 .
(iv) The height of the complete binary tree can be written as h = log 2 (Tn+1)-1
where Tn is Total number
of
Nodes.
Which one of the
following is correct in
respect of the above statements
regarding the Binary trees?
► (i) and (iii) only
► (i), (ii)
and (iii) only
► (ii) and (iii) only
► (ii), (iii) and (iv)
only
Question No: 16
( Marks: 1 ) - Please choose
one
“+” is a operator.
► Unary
► Binary(Page 64)
► Ternary
► None of the above
No comments:
Post a Comment