Font size
WorksheetsMock test - Data Structures
Total questions: 60
Worksheet time: 37mins
In doubly linked lists, traversal can be performed?
a) Only in forward direction
b) Only in reverse direction
c) In both directions
d) In circular fashion
A node in a doubly linked list has at least _____ fields
4
2
3
5
In a stack, if a user tries to remove an element from empty stack it is called _________
Underflow
Empty collection
Overflow
Garbage Collection
Process of inserting an element in stack is called ____________
Create
Push
Evaluation
Pop
User perform following operations on stack of size 5 then -
push(1);
pop();
push(2);
push(3);
pop();
push(2);
pop();
pop();
push(4);
pop();
pop();
push(5);
Overflow Occurs
Stack Operations will be performed Smoothly
Underflow Occurs
None of these
Which one of the following is an application of Stack Data Structure?
Managing function calls
The Knight-Tour problem
Maze Problem
All of the above
List of data in which element can be inserted and removed at the same end is called as __________.
array
stack
linked list
queue
Which of the following is not an application of stack?
Job scheduling
Undo-redo feature
Balancing of symbols
Tower of hanoi
The stack uses which policy out of the following
LIFO
FIFO
FILO
NONE
An array elements are always stored in ________ memory locations.
sequential
Random
Sequential and Random
None of the above
Select operations that can be performed on a stack Data Structure...
isEmpty()
pop()
push()
isFull()
A stack is a data structure in which elements
can be added to any position and removed only from the top
can be only added to the top and removed from any position
can be added and removed from the top only
can be added and removed from any position
9
12
6
8
If the elements “A”, “B”, “D” and “C” are placed in a stack and are deleted one at a time, in what order will they be removed?
ABCD
ABDC
CDBA
DCAB
If the elements “A”, “B”, “C” and “D” are placed in a queue and are deleted one at a time, in what order will they be removed?
ABCD
DCBA
ABDA
ABDC
Let size of queue is 4. The following operations are performed in order.
enqueue(10)
enqueue(20)
enqueue(30)
enqueue(40)
what will be the result after executing enqueue(50)?
Queue Empty
Queue Full
None
5
A normal queue, if implemented using an array of size MAX_SIZE, gets full when
Rear = MAX_SIZE – 1
Front = (rear + 1)mod MAX_SIZE
Front = rear + 1
Rear = front
Insertion and Deletion operation in Queue is known as ?
Push and Pop
Enqueue and Dequeue
Array and Linked List
Stack and Linked List
What is the reason for using a "circular queue" instead of a regular one?
running time of enqueue() is improved
reuse empty spaces
you can traverse all the elements more efficiently
none of the above
In Queue Insertion & Deletion take place at ________________.
same end
first end
different end
last end
If the numbers 5, 10, 3, 42 are enqueued onto a queue in that order, what does dequeue return?
5
10
3
42
A queue of characters currently contained a,b,c,d. What would be the contents of queue after the following operationDELETE, ADD W, ADD X, DELETE, ADD Y.
A,B,C,W,Y
A,B,C,D,W
C,D,W,X,Y
W,Y,X,C,D
If front=rear, then the queue is?
full
undeflow
Empty or has data only at the end (at rear = size-1)
empty only
Suppose you have the following series of queue operations.
q = Queue();
q.enqueue('hello');
q.enqueue('dog');
q.enqueue(3);
q.dequeue();
What items are left on the queue?
'hello', 'dog'
'dog', 3
'hello', 3
'hello', 'dog', 3
A Queue can only store 6 data items. The Queue is sent 4 data items: Bert, Cynthia, Cedric and Albert. Where does the "Rear" index pointer point?
0
1
2
3
A Queue can only store 6 data items. The Queue is sent 4 data items: Bert, Cynthia, Cedric and Albert. Where does the "Front" pointer point?
Bert
Cynthia
Cedric
Albert
Select ALL the situations that a Queue data structure would be used?
Printer in a room full of computers
Characters typed on a keyboard
Back Button
Undo Button
What advantage does a linked list have over an array?
Size of the list doesn't need to be mentioned at the beginning of the program
You can add or remove elements from the middle of the list.
The linked list doesn't have a size limit
All of these are true.
◻Nodes can be located anywhere in the memory.
True
False
Nodes in a linked list contain two things
Direction and a pointer
Data and a pointer
A Pointer and a reference
A pointer and a node
The situation when in a linked list Head==NULL
is
Full
Empty
Half full
saturated
In the above image what will be printed when Head->next->data?
83
9
27
Error
What is value in the head -> next -> next below?
12
4600
1600
88
Linked list is a collection of
Nodes
Arrays
Address
None
Circular Linked List the Address part of last node holds the address of
First Node
Null
Intermediate Node
None of the Above
What is the operation of the below statements?
Create a new node for a linked list
Insert a new node to the front of a linked list
Delete a new node from a linked list
Insert a new node to the end of the linked list
How to insert a node after a position P in singly linked list?
Newnode -> data = P ;
Newnode -> next = p ->next ;
P -> next = newnode ;
Newnode -> data = x ;
Newnode -> next = p ->next ;
P -> next = L ;
Newnode -> data = x ;
Newnode -> next = p ->node ;
P -> nextnode = next ;
Newnode -> data = x ;
Newnode -> next = p ->next ;
P -> next = newnode ;
The last node of the singly-linked list contains__________.
INFO
NULL
NEXT
None of the above
......................... is a way of arranging data on a computer so that it can be accessed and updated efficiently.
Data Structures
Data
Structure
None
If a linked list has a head node and 5 other data nodes, what would the size of the linked list return?
5
6
none of the above
both
A singly linked list can be visualized as a chain of nodes, where every node points to the previous node.
TRUE
FALSE
A singly linked structure is introduced to overcome the limitations of arrays and allow easy
Insertion only
Deletion only
Insertion and Deletion
traversing backward and forward
Select the all the applications of Stack,
Converting infix to postfix expressions.
x
Undo/Redo button/operation in word processors.
While switching multiple applications, windows
In Escalators
Select the all the applications of Queue.
Printer spooler
To handle congestion in the networking
Forward-backward surfing in the browser
Recursion
Select the applications of Linked List.
The music player
Train coaches
Random access of elements
None
What will be the postfix expression for following infix expression
b * c + d / e
b c * d e / +
b*cde/+
bc*de+/
bcd*e/+
what is postfix of expression a+b+c+d*e/f
ab+c+de*f+
a+bc+def/*+
abc++de*f/+
ab+c*de/f+
what will be the result of 2,3,4,*,+
13
12
10
14
the postfix expression of a-b*c-e
a b c * - e -
a b - c * e -
none of above
Stack can be implemented using _________ and ________ ?
Array and Binary Tree
Linked List and Graph
Array and Linked List
none of above
Which of the following is an example for a postfix expression?
a*b(c+d)
abc*+de-+
+ab
a+b-c
The postfix form of the expression (A+ B)*(C*D- E)*F / G is?
AB+ CD*E - FG /**
AB + CD* E - F **G /
AB + CD* E - *F *G /
AB + CDE * - * F *G /
The result of evaluating the postfix expression 5, 4, 6, +, *, 4, 9, 3, /, +, * is?
600
350
650
588
Minimum number of steps required in TOH to solve the problem is
2^n
2n-1
2^n-1
2n
Minimum number of steps required in TOH to solve the problem is
2^n
2n-1
2^n-1
2n
Which of the following is the advantage of recursion
Takes less memory
Decreases code size
Less space complexity
take less time
In ___________ data structure data items are not in sequence.
non linear
linear
non-homogeneous
all of above
In ____________ data structure, the data items are arranged in a linear sequence.
linear
non linear
both a and b
all of above
A function calls itself is called ___________.
queue
recursion
function
none of above
Which of the following problems can be solved using recursion?
finding Nth number of the Fibonacci sequence
finding the factorial of a number
finding the length of a string
all of the above
