wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Mock test - Data Structures

Total questions: 60

Worksheet time: 37mins

Name
Class
Date
1.

In doubly linked lists, traversal can be performed?

a)

a) Only in forward direction

b)

b) Only in reverse direction

c)

c) In both directions

d)

d) In circular fashion

2.

A node in a doubly linked list has at least _____ fields

a)

4

b)

2

c)

3

d)

5

3.

In a stack, if a user tries to remove an element from empty stack it is called _________

a)

Underflow

b)

Empty collection

c)

Overflow

d)

Garbage Collection

4.

Process of inserting an element in stack is called ____________

a)

Create

b)

Push

c)

Evaluation

d)

Pop

5.

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);

a)

Overflow Occurs

b)

Stack Operations will be performed Smoothly

c)

Underflow Occurs

d)

None of these

6.

Which one of the following is an application of Stack Data Structure?

a)

Managing function calls

b)

The Knight-Tour problem

c)

Maze Problem

d)

All of the above

7.

List of data in which element can be inserted and removed at the same end is called as __________.

a)

array

b)

stack

c)

linked list

d)

queue

8.

Which of the following is not an application of stack?

a)

Job scheduling

b)

Undo-redo feature

c)

Balancing of symbols

d)

Tower of hanoi

9.

The stack uses which policy out of the following

a)

LIFO

b)

FIFO

c)

FILO

d)

NONE

10.

An array elements are always stored in ________ memory locations.

a)

sequential

b)

Random

c)

Sequential and Random

d)

None of the above

11.

Select operations that can be performed on a stack Data Structure...

a)

isEmpty()

b)

pop()

c)

push()

d)

isFull()

12.

A stack is a data structure in which elements

a)

can be added to any position and removed only from the top

b)

can be only added to the top and removed from any position

c)

can be added and removed from the top only

d)

can be added and removed from any position

13.
What is returned by values[5]?
a)

9

b)

12

c)

6

d)

8

14.

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?

a)

ABCD

b)

ABDC

c)

CDBA

d)

DCAB

15.

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?

a)

ABCD

b)

DCBA

c)

ABDA

d)

ABDC

16.

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)?

a)

Queue Empty

b)

Queue Full

c)

None

d)

5

17.

A normal queue, if implemented using an array of size MAX_SIZE, gets full when

a)

Rear = MAX_SIZE – 1

b)

Front = (rear + 1)mod MAX_SIZE

c)

Front = rear + 1

d)

Rear = front

18.

Insertion and Deletion operation in Queue is known as ?

a)

Push and Pop

b)

Enqueue and Dequeue

c)

Array and Linked List

d)

Stack and Linked List

19.

What is the reason for using a "circular queue" instead of a regular one?

a)

running time of enqueue() is improved

b)

reuse empty spaces

c)

you can traverse all the elements more efficiently

d)

none of the above

20.

In Queue Insertion & Deletion take place at ________________.

a)

same end

b)

first end

c)

different end

d)

last end

21.

If the numbers 5, 10, 3, 42 are enqueued onto a queue in that order, what does dequeue return?

a)

5

b)

10

c)

3

d)

42

22.

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)

A,B,C,W,Y

b)

A,B,C,D,W

c)

C,D,W,X,Y

d)

W,Y,X,C,D

23.

If front=rear, then the queue is?

a)

full

b)

undeflow

c)

Empty or has data only at the end (at rear = size-1)

d)

empty only

24.

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?

a)

'hello', 'dog'

b)

'dog', 3

c)

'hello', 3

d)

'hello', 'dog', 3

25.

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?

a)

0

b)

1

c)

2

d)

3

26.

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?

a)

Bert

b)

Cynthia

c)

Cedric

d)

Albert

27.

Select ALL the situations that a Queue data structure would be used?

a)

Printer in a room full of computers

b)

Characters typed on a keyboard

c)

Back Button

d)

Undo Button

28.

What advantage does a linked list have over an array?

a)

Size of the list doesn't need to be mentioned at the beginning of the program

b)

You can add or remove elements from the middle of the list.

c)

The linked list doesn't have a size limit

d)

All of these are true.

29.

Nodes can be located anywhere in the memory.

a)

True

b)

False

30.

Nodes in a linked list contain two things

a)

Direction and a pointer

b)

Data and a pointer

c)

A Pointer and a reference

d)

A pointer and a node

31.

The situation when in a linked list Head==NULL

is

a)

Full

b)

Empty

c)

Half full

d)

saturated

32.

In the above image what will be printed when Head->next->data?

a)

83

b)

9

c)

27

d)

Error

33.

What is value in the head -> next -> next below?

a)

12

b)

4600

c)

1600

d)

88

34.

Linked list is a collection of

a)

Nodes

b)

Arrays

c)

Address

d)

None

35.

Circular Linked List the Address part of last node holds the address of

a)

First Node

b)

Null

c)

Intermediate Node

d)

None of the Above

36.

What is the operation of the below statements?

a)

Create a new node for a linked list

b)

Insert a new node to the front of a linked list

c)

Delete a new node from a linked list

d)

Insert a new node to the end of the linked list

37.

How to insert a node after a position P in singly linked list?

a)

Newnode -> data = P ;

Newnode -> next = p ->next ;

P -> next = newnode ;

b)

Newnode -> data = x ;

Newnode -> next = p ->next ;

P -> next = L ;

c)

Newnode -> data = x ;

Newnode -> next = p ->node ;

P -> nextnode = next ;

d)

Newnode -> data = x ;

Newnode -> next = p ->next ;

P -> next = newnode ;

38.

The last node of the singly-linked list contains__________.

a)

INFO

b)

NULL

c)

NEXT

d)

None of the above

39.

......................... is a way of arranging data on a computer so that it can be accessed and updated efficiently.

a)

Data Structures

b)

Data

c)

Structure

d)

None

40.

If a linked list has a head node and 5 other data nodes, what would the size of the linked list return?

a)

5

b)

6

c)

none of the above

d)

both

41.

A singly linked list can be visualized as a chain of nodes, where every node points to the previous node.

a)

TRUE

b)

FALSE

42.

A singly linked structure is introduced to overcome the limitations of arrays and allow easy

a)

Insertion only

b)

Deletion only

c)

Insertion and Deletion

d)

traversing backward and forward

43.

Select the all the applications of Stack,

a)
  • Converting infix to postfix expressions.

  • x

b)
  • Undo/Redo button/operation in word processors.

c)

While switching multiple applications, windows

d)

In Escalators

44.

Select the all the applications of Queue.

a)

Printer spooler

b)

To handle congestion in the networking

c)

Forward-backward surfing in the browser

d)

Recursion

45.

Select the applications of Linked List.

a)

The music player

b)

Train coaches

c)

Random access of elements

d)

None

46.

What will be the postfix expression for following infix expression

b * c + d / e

a)

b c * d e / +

b)

b*cde/+

c)

bc*de+/

d)

bcd*e/+

47.

what is postfix of expression a+b+c+d*e/f

a)

ab+c+de*f+

b)

a+bc+def/*+

c)

abc++de*f/+

d)

ab+c*de/f+

48.

what will be the result of 2,3,4,*,+

a)

13

b)

12

c)

10

d)

14

49.

the postfix expression of a-b*c-e

a)

a b c * - e -

b)

a b - c * e -

c)

none of above

50.

Stack can be implemented using _________ and ________ ?

a)

Array and Binary Tree

b)

Linked List and Graph

c)

Array and Linked List

d)

none of above

51.

Which of the following is an example for a postfix expression?

a)

a*b(c+d)

b)

abc*+de-+

c)

+ab

d)

a+b-c

52.

The postfix form of the expression (A+ B)*(C*D- E)*F / G is?

a)

AB+ CD*E - FG /**

b)

AB + CD* E - F **G /

c)

AB + CD* E - *F *G /

d)

AB + CDE * - * F *G /

53.

The result of evaluating the postfix expression 5, 4, 6, +, *, 4, 9, 3, /, +, * is?

a)

600

b)

350

c)

650

d)

588

54.

Minimum number of steps required in TOH to solve the problem is

a)

2^n

b)

2n-1

c)

2^n-1

d)

2n

55.

Minimum number of steps required in TOH to solve the problem is

a)

2^n

b)

2n-1

c)

2^n-1

d)

2n

56.

Which of the following is the advantage of recursion

a)

Takes less memory

b)

Decreases code size

c)

Less space complexity

d)

take less time

57.

In ___________ data structure data items are not in sequence.

a)

non linear

b)

linear

c)

non-homogeneous

d)

all of above

58.

In ____________ data structure, the data items are arranged in a linear sequence.

a)

linear

b)

non linear

c)

both a and b

d)

all of above

59.

A function calls itself is called ___________.

a)

queue

b)

recursion

c)

function

d)

none of above

60.

Which of the following problems can be solved using recursion?

a)

finding Nth number of the Fibonacci sequence

b)

finding the factorial of a number

c)

finding the length of a string

d)

all of the above