MCQ Datastructure Python

Download as xls, pdf, or txt
Download as xls, pdf, or txt
You are on page 1of 18

SR.

NO QUESTION TYPE QUESTION TEXT OPTION 1

1 Objective Which of the following is linear data structure?  Trees

2 Objective Which of the following is non-linear data structure?   Array

3 Objective Queue is based on which principle?  FIFO

Which notation is used to find the complexity of an Asymptotic


4 Objective
algorithm?  Notation

5 Objective Stack is based on which principle FIFO

When the data structure is combined with its operation


6 Objective Topology
then, data structure is known as 
Asymptotic
7 Objective Describes the running time of an algorithm
Notation

8 Objective A linear collection of data elements where the linear node Linked list
is given by means of pointer is called
When new data are to be inserted into a data structure ,
9 Objective but there is no available space, this situation is usually Housefull
called

Arrays have
better cache
locality that
10 Objective Which of the following points is/are true about Linked List can make
data structure when it is compared with array
them better in
terms of
performance.

11 Objective Which of the following sorting algorithms can be used to Insertion Sort
sort a random linked list with minimum time complexity?
12 Objective  Process of inserting an element in stack is called Create
In a stack, if a user tries to remove an element from an
13 Objective Underflow
empty stack it is called
ushing an element into stack already having five elements
14 Objective Overflow
and stack size of 5, then stack becomes
A collection of
 Entries in a stack are “ordered”. What is the meaning of
15 Objective stacks is
this statement?
sortable

16 Objective What is the value of the postfix expression 6 3 2 4 + – *? 1


Here is an infix expression: 4 + 3*(6*3-12). Suppose that
we are using the usual
stack algorithm to convert the expression from infix to
17 Objective postfix notation. 1
The maximum number of symbols that will appear on the
stack AT ONE TIME
during the conversion of this expression?

The postfix form of the expression (A+ B)*(C*D- E)*F / G  AB+ CD*E –
18 Objective
is? FG /**

19 Objective The postfix form of A*B+C/D is? *AB/CD+

Which data structure is needed to convert infix notation to


20 Objective Branch
postfix notation?

21 Objective Which data structure is used for implementing recursion? Queue

Consider the following operation performed on a stack of


size 5.
Push(1);
Pop();
Push(2);
Push(3);
22 Objective Pop(); 1
Push(4);
Pop();
Pop();
Push(5);
After the completion of all operation,the number of
elements present in stack are

A linear collection of data elements where the linear node


23 Objective Linked list
is given by means of pointer is called?

 Which of the following is not a disadvantage to the usage


24 Objective of array?  Fixed size

piling up of
Which of the following real world scenarios would you chairs one
25 Objective
associate with a stack data structure? above the
other
accessing item
from an
26 Objective What does ‘stack underflow’ refer to?
undefined
stack
What is the time complexity of pop() operation when the
27 Objective O(1)
stack is implemented using an array?

28 Objective What is the term for inserting into a full queue known as? overflow

29 Objective What is the time complexity of enqueue operation? O(logn)

In linked list implementation of a queue, where does a  At the head of


30 Objective
new element be inserted? link list

In linked list implementation of a queue, from where is the At the head of


31 Objective
item deleted? link list
The essential condition which is checked before insertion Underflow
32 Objective
in a linked queue is?
33 Objective Which of the following is not the part of ADT description? Data
34 Objective Which of the following is non-liner data structure? Stacks
35 Objective Which of the following data structure is non linear type? Strings
To represent hierarchical relationship between elements,
36 Objective Dequeue
Which data structure is suitable?

Match the following.


a) Completeness i) How long does it take to find a solution
b) Time Complexity ii) How much memory need to
37 Objective a-iii, b-ii, c-i
perform the search.
c) Space Complexity iii) Is the strategy guaranteed to find
the solution when there in one.

Arrays are
dense lists and
38 Objective Which of the following statement is false ?
static data
structure

Which of the following sorting algorithm is of divide-and-


39 Objective Bubble sort
conquer type?
What is the process of finding the location of a given data
40 Objective Deletion
element in the data structure called?
__________ is a collection of data elements of similar data
41 Objective String
types.

42 Objective Which is an example of a dynamic data structure? Linked list


Programming
Term Data Structure refers to _________ and
43 Objective Language
interrelationship between them
Statement
Mathematical Model that can have set of operations that Abstract Data
44 Objective
can be performed on that model is called as Type
It is
completely
45 Objective ADT is called as Abstract because
independent
data type
An algorithm with running-time of a highest-order term Quadratic
46 Objective
containing a factor of n^2 is said to have a growth rate
Term that makes realization of a data type as a software Actual data
47 Objective
component is called type

48 Objective An implementation for an ADT is called Data process

49 Objective Data structure that allows extremely fast exact-match Arrays


search, is known to be

50 Objective Data structure that support efficient insertion of new Array


records, is said to be
51 Objective An algorithm is composed of a series of Steps
52 Objective Process of following a method to solve a problem is called Program
a/an

53 Objective Which case of data structure operation takes maximum Worst Case
time?

54 Objective Which of the following is not a Characteristics of a Data Completeness


Structure?
Which characteristics shows that running time or the
55 Objective execution time of operations of data structure must be as Completeness
small as possible?

Which of the following analysis known as theoretical A Posterior


56 Objective
analysis of an algorithm? Analysis

57 Objective Which of the following analysis known as empirical A Posterior


analysis of an algorithm? Analysis

58 Objective O(1) means computing time is Constant

 Every binary
Which of the following statements about a binary tree is
59 Objective tree has at
not correct?
least one node

60 Objective Which of the following is not a stable sorting algorithm?  Insertion sort
Suppose we are sorting an array of eight integers using
The pivot
quicksort, and we have just finished the first partitioning
could be
61 Objective with the array looking like this:
either the 7 or
2 5 1 7 9 12 11 10
the 9.
Which statement is correct?

The complexity of sorting algorithm measures the …… as a


62 Objective average time
function of the number n of items to be sorter.

A structure
63 Objective What is a hash table? that maps
values to keys

A function has
allocated
64 Objective  What is a hash function?
memory to
keys

 Make the
65 Objective What can be the techniques to avoid collision? hash function
appear
random
66 Objective The complexity of Binary search algorithm is O(n)
67 Objective The operation of processing each element in the list is Sorting
known as

68 Objective Which of the following case does not exist in complexity Best case
theory

When Item is
69 Objective The Average case occur in linear search algorithm somewhere in
the middle of
the array

70 Objective The complexity of linear search algorithm is O(n)


71 Objective The complexity of merge sort algorithm is O(n)

The item is
72 Objective In linear search algorithm the Worst case occurs when somewhere in
the middle of
the array

for relatively
73 Objective Linked lists are best suited permanent
collections of
data
Processor and
74 Objective Two main measures for the efficiency of an algorithm are
memory

75 Objective Finding the location of the element with a given value is: Traversal

76 Objective  Key value pairs is usually seen in Hash tables

The searching technique that takes O (1) time to find a


77 Objective  Linear Search
data is

The left child is


78 Objective Which of the following is false about a binary search tree? always lesser
than its parent

It traverses in
79 Objective What is the speciality about the inorder traversal of a a non
binary search tree? increasing
order

80 Objective Which of the following is not a disadvantage to the usage  Fixed size
of array?

Every binary
81 Objective Which of the following statement about binary tree is tree is either
CORRECT? complete or
full

Which type of traversal of binary search tree outputs the


82 Objective Pre-order
value in sorted order?
Can have 2
83 Objective A Binary Tree can have
children

84 Objective Which of the following is the infix expression? A+B*C

85 Objective Which of the following is the prefix form of A+B*C?    A+(BC*)


If the elements '1', '2', '3' and '4' are added in a stack, so
86 Objective 1234
what would be the order for the removal?
If the elements '1', '2', '3' and '4' are inserted in a queue,
87 Objective 1234
what would be order for the removal?
Which data structure is the best for implementing a
88 Objective Stack
priority queue?
89 Objective Sorting is not possible using which method Deletion
Which of the algorithm uses the minimum number of
90 Objective Merge Sort
swaps when it sorts?
Which algorithm has the lowest worst case complexity
91 Objective Merge Sort
amoong these?

Arrays have
better cache
locality that
Which of the following points is/are true about Linked List
92 Objective can make
data structure when it is compared with array?
them better in
terms of
performance.

Θ(logn) for
93 Objective What are the worst-case complexities of insertion and deletion
both
ofinsertion
a key in a binary search tre
and deletion

94 Objective If there's no base criteria in a recursive program, the not be


program will executed.

95 Objective Which of the following algorithm takes the same time in all Merge Sort
three cases (e.g., best, average, and worst)?

96 Objective The result of prefix expression * / b + – d a c d, where a = 0


3, b = 6, c = 1, d = 5 is

97 Objective Which of the following approach Recursive algorithms are Bottom-up


worked on? approach

98 Objective Which among the following data structures is best suited HashMap
for storing very large numbers.
 Suppose server and client are communicating with each
99 Objective other, and both are working at a different speed. Which of Graph
the following data structure is best suited for
synchronization?
Which of the following order is given by binary search tree Ascending
100 Objective
if we traverse it in inorder? order

If we want to convert infix notation to postfix notation,


101 Objective Stack
then which of the following data structure should we use?

For relatively
102 Objective Which of following is the advantage of using linked list? permanent
collections of
data
Which of following is contained by the header of the linked The address of
103 Objective
list? the first node

 In linked list each node contains a minimum of two fields. Pointer to
104 Objective
One field is data field to store the data second field is? character

What would be the asymptotic time complexity to add a


105 Objective node at the end of singly linked list, if the pointer is initially O(1)
pointing to the head of the list?
What would be the asymptotic time complexity to insert
106 Objective O(1)
an element at the front of the linked list (head is known)?

for relatively
permanent
107 Objective Linked lists are best suited …..
collections of
data.

108 Objective The operation of processing each element in the list is  sorting
known as
109 Objective The situation when in a linked list START=NULL is  Underflow
110 Objective Each node in singly linked list has …….. fields 2
111 Objective ………. refers to a linear collection of data items.  List

112 Objective The dummy header in linked list contain first record of
the actual data

values in a
node are
greater than
every value in
113 Objective  In a head tree  the left
subtree and
smaller than
the right
subtree.

The in-order traversal of the tree will yield a sorted listing


114 Objective Binary trees
of elements of tree in
115 Objective In Binary trees, nodes with no successor are called  End nodes
Left sub-tree,
116 Objective Which indicates pre-order traversal? Right sub-tree
and root

117 Objective ……… form of access is used to add and remove nodes LIFO, Last In
from a queue. First Out
118 Objective The retrieval of items in a stack is ……….. operation. push
119 Objective Which is the pointer associated with the stack? FIRST
120 Objective  Deletion operation is done using ……… in a queue. front
121 Objective The elements are removal from a stack in ………. order. Reverse

It is placed on
122 Objective When an operand is read, which of the following is done?
to the output

What should be done when a left parenthesis ‘(‘ is


123 Objective It is ignored
encountered?

124 Objective  Which of the following is an infix expression? (a+b)*(c+d)


What is the postfix expression for the corresponding infix
125 Objective abc*+de*+
expression? a+b*c+(d*e)
What is the postfix expression for the following infix
126 Objective abc^/d-
expression?a/b^c-d

127 Objective In infix to postfix conversion algorithm, the operators are right to left
associated from?

128 Objective What is the corresponding postfix expression for the given ab*cdef/^*g-
infix expression?a+(b*c(d/e^f)*g)*h) h+

129 Objective Expression in which Operator is written after Operand is Infix


called as  Expression
It traverses in
130 Objective What is the speciality about the inorder traversal of a a non
binary search tree? increasing
order

Every binary
131 Objective  Which of the following statement about binary tree is tree is either
CORRECT? complete or
full

132 Objective What is the worst case for linear search? O(nlogn)

133 Objective  Which of the following is a disadvantage of linear search? Requires more
space

Which of the following is not the required condition for a The list must
134 Objective
binary search algorithm? be sorted

135 Objective The complexity of merge sort algorithm is O(n)


136 Objective Binary search algorithm cannot be applied to sorted linked
list
OPTION 2 OPTION 3 OPTION 4 OPTION 5 CORRECT OPTION

Graphs Arrays None of these 3

 Linked lists Stacks None of these 4

LIFO pop None of these 1

 None of
Big oh Notation Omega Notation 1
these

Push LIFO None of these 3

Data Structure Abstract Data Type None of these 3

Time Performance
None of these 1
complexity  Analysis

Skip list  Node  None of 1


these

 Underflow Overflow None of these 3

The size of
array has to
It is easy to Random access is
be
insert and not allowed in a
delete typical pre-decided, All of the above 5
linked lists
elements in implementation of can
Linked List Linked Lists change their
size any time.

Quick Sort Heap Sort Merge Sort 4


 Push  Evaluation Pop 2
Empty Garbage
Overflow 1
collection Collection
Crash Underflow User flow 1
Stack entries
may be The entries are There is a
Sequential
compared with stored in a linked 4
entry that is
the ‘<‘ list
one by one
operation
40 74  -18 4
2 3 4 4

AB + CD* E – F AB + CD* E – *F AB + CDE * –


3
**G / *G / * F *G /

AB*CD/+ A*BC+/D ABCD+/* 2

Tree Queue Stack 4

Stack Array List 2

2 3 4 1

Node list Primitive list Unordered list 1

There are
chances of
wastage of
Accessing
memory space
Insertion based on elements at
if elements position specified 4
inserted in an
positions
array are lesser
than the
allocated size
people
offer services
standing in a  tatkal Ticket
based on the
line to be Booking in 1
priority of the
serviced at a customer IRCTC
counter
removing items  index out of
adding items to
from an empty bounds 3
a full stack
stack exception

O(n) O(logn)  O(nlogn) 1

program
 null pointer
 underflow won’t be 1
exception
compiled

O(nlogn) O(n) O(1) 4


At the centre At any
At the tail of the
position in the position in 3
link list
link list the linked list
At the centre
At the tail of the Node before
position in the 1
link list link list the tail
Overflow Front value Rear value 2
None of the
Operations Both of the above 4
above
List Strings Trees 4
Lists Stacks Graph 4
Priority Tree Graph 3

a-i, b-ii, c-iii a-iii, b-i, c-ii a-i, b-iii, c-ii 3

linked lists are


data elements
in linked list collection of
need not be pointers store the the nodes
next data element that contain 3
stored in
adjecent space of a list information
part and next
in memory
pointer

Insertion sort Quick sort All of above 3

Insertion Traversing Searching 4

Arrays Both (a) and (b) NULL 2

Memory
Stack String 1
location
Coding Organization of
None of these 3
Standards data element

Composite Data
Primitive Data Type None of these 1
Type

It is collection
Implementation
of different None of these 3
Details are hidden
data types

Exponential Absolute growth Linear growth


1
growth rate rate rate
Abstract data Component
Visual data type 2
type data type
Data
Data structure Data member 3
movement

Pointers Stacks Hash tables 4

Hash table Pointer Stack 2


Structures Domains Architectures 1
Processing Algorithm Pattern 3

Average Case Best Case None of the 1


above

Correctness Time Complexity Space 1


Complexity

Correctness Time Complexity Space 3


Complexity

A
A Priori Analysis A Feasibility Independent 2
Analysis
Analysis
A
A Priori Analysis A Feasibility Independent 1
Analysis
Analysis
Quadratic Linear Cubic 1
Every non- Every non-
empty tree has Every node has at root node has
1
exactly one most two children exactly one
root node parent
Selection sort Bubble sort  Merge sort 2
 The pivot could The pivot is not the Neither the 7
be the 7, but it 7, but it could be nor the 9 is 1
is not the 9 the 9 the pivot.

average-case case-
running time 2
complexity complexity

A structure
A structure that used to
A structure used
maps keys to implement 2
for storage
values stack and
queue

A function that
computes the A function that None of the
2
location of the creates an array mentioned
key in the array

Use the
chaining Use uniform All of the 4
hashing mentioned
method

O(logn ) O(n^2)  O(n log n) 2


Merging Inserting Traversal 4

Worst case Average case Null case 4

When Item is
 When Item is When Item is the the last
not in the array last element in the element in 1
the array or is
at all array
not there at
all

O(log n) O(n^2) O(n log n) 1


O(log n) O(n^2) O(n log n) 4

The item is
The item is not The item is the last the last
in the array at element in the element in 4
the array or is
all array
not there at
all

for the size of


the structure
for none of
and the data in for both of above above 2
the structure situation
are constantly situation
changing
Complexity and Data and
Time and space 3
capacity space
None of
Search  Sort 2
above
Both Hash tables
Heaps Skip list 1
and Heaps

Binary Search  Hashing Tree Search 3

In order
The right child The left and right sequence
is always sub-trees should gives
4
greater than its also be binary decreasing
parent search trees order of
elements

It traverses
It traverses in
an increasing It traverses in a based on 2
random fashion priority of the
order
node

There are
chances of
wastage of
Accessing
memory space
if elements Insertion based on elements at 4
position specified
inserted in an
positions
array are lesser
than the
allocated size

 A binary tree
Every complete Every full binary
cannot be
binary tree is tree is also a both 3
also a full complete binary
complete and
binary tree tree
full

In-order Post-order None 2

Can have 1
Can have 0 children All of the the 4
children above

A*BC ABC+* None of the 1


above
+AB*C ABC+*   +A*BC 4

2134 4321 None of the 3


above

4321 3241 None of the 1


above
Linked list Array Heap 4
Exchange Selection Insertion 1
Bubble Sort Selection Sort Quick Sort 3

Selection Sort Quick Sort Bubble Sort 1

The size of
array has to
 It is easy to  Random access is
be pre-
insert and not allowed in a
decided,
delete typical All of the above 5
linked lists
elements in implementation of
can change
Linked Lis Linked Lists
their size any
time.

Θ(logn) for
Θ(n) for both  Θ(n) for insertion
insertion and and Θ(logn) for insertion and 2
Θ(n) for
deletion deletion
deletion

execute until all obtain


conditions execute infinitely. progressive 3
match approach.

Quick Sort Selection Sort Bubble Sort 1

5 10 8 3

Top-down Hierarchical All of the 1


approach approach above

Linked List Tree Stack 2

Tree Queue None of the 3


above

Descending None of the


Random order 1
order above

Queue Singly Linked List HashMap 1

Linked list is
more flexible it Less time None of the 2
can grow and complexity above
shrink easily
Pointer to the last Middle record
The address of
record of the actual of the actual 1
the last node
data data

Pointer to
Pointer to node  Node 3
integer

O(n) θ(n)  θ(1) 3

O(n) O(n^2) O(n^3) 1

 the size of the


structure and
for none of
the data in the data structure
the above 2
structure are
situation
constantly
changing.

merging inserting traversal 4


Overflow  Houseful Saturated 1
3  1 4 1
Tree Graph  Edge 1
 pointer to the last middle record
last record of record of the actual of the actual 1
the actual data
data data

values in a
node are
greater than conditions. terms. 2
every value in
children of it.

Binary search Merging


AVL Trees 2
trees
Terminal nodes Final nodes Last nodes 2
Right sub-tree, Right sub-
Left sub-tree Root, Left sub-tree, tree, root, 3
Right sub-tree
and root Left sub-tree
FIFO, First In Both a and b None of these 2
First Out
pop retrieval access 2
FRONT TOP  REAR 3
rear  top list 1
Hierarchical Alternative Sequential 1
 Operator
It is placed in
 It is ignored stack is 1
operator stack
emptied

The contents
of the
 It is placed in It is placed in the
operator 3
the output operator stack
stack is
emptied
ab+c* +ab abc+* 1
 abc+*de*+ a+bc*de+*  abc*+(de)*+ 1

ab/cd^- ab/^cd- abcd^/- 1

left to right centre to left centre to 2


right
abcdef^/ abcd*^ed/g*-h*+ abc*de^fg/*- 2
*g*h*+ *h+
Postfix Prefix Expression 2
Expression

It traverses in
an increasing It traverses in a None of the 2
random fashion mentioned
order

A binary tree
Every complete Every full binary
cannot be
binary tree is tree is also a both 3
also a full complete binary
complete and
binary tree tree
full
 O(logn)  O(n) O(1) 3
Greater time
complexities
Not easy to  Not easy to
compared to 2
understand implement
other searching
algorithms

 There should There must be a


be direct access mechanism to  Number
values should
to the middle delete and/or 3
only be
element in any insert elements in
present
sublist the list.
O(logn) O(n^2) O(nlogn) 4
sorted binary sorted linear array pointer array 1
trees

You might also like