Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Data Structures Lec

Total questions: 124

Worksheet time: 1hrs 2mins

Name
Class
Date
1.

What is a data structure?

a)

A way to store data

b)

A type of algorithm

c)

A programming language

d)

None of the above

2.

What is the difference between linear and non-linear data structures?

a)

Non-linear structures are faster.

b)

Linear structures can only hold integers.

c)

Linear structures store data in a sequential manner, while non-linear structures do not.

d)

There is no difference.

3.

Which operation adds new data elements to a data structure?

a)

Insertion

b)

Deletion

c)

Updating

d)

Searching

4.

Which of the following is an example of a non-primitive data structure?

a)

Integer

b)

Float

c)

Array

d)

Boolean

5.

What is the main advantage of using a linked list over an array?

a)

Linked lists use less memory.

b)

Linked lists allow for dynamic memory allocation.

c)

Linked lists are faster.

d)

Arrays are easier to implement.

6.

When tasked to store a dynamic leaderboard, which structure offers optimal performance for frequent insertions and deletions?

a)

Array

b)

Linked List

c)

Stack

d)

Hash Table

7.

Which operation is LEAST efficient in a large unsorted array?

a)

Traversal

b)

Insertion at end

c)

Searching for a value

d)

Updating an element

8.

If a stack is used for browser “back” navigation, what algorithmic property does this application rely on?

a)

FIFO

b)

Hierarchical traversal

c)

LIFO

d)

Key-value lookup

9.

In a queue implementation for printer jobs, what happens if dequeue is performed when the structure is empty?

a)

An error/underflow condition occurs

b)

The oldest job is removed

c)

The newest job is removed

d)

The structure is reset

10.

Which scenario best demonstrates the application of a graph structure?

a)

Student ID lookup

b)

Modeling city road networks

c)

Storing book titles alphabetically

d)

Maintaining a To-Do list

11.

In which scenario would you use a stack?

a)

When you need to access elements in a specific order.

b)

When you need to manage function calls.

c)

When you need to store data that can grow dynamically.

d)

When you need to store a fixed set of data.

12.

What does the term “complex data structure” refer to?

a)

A structure that is difficult to understand.

b)

A structure composed of multiple primitive data types.

c)

A structure that has more than one dimension.

d)

A structure that is always larger than primitive types.

13.

Which of the following is true about arrays?

a)

They can only store integers.

b)

They have a fixed size.

c)

They can grow dynamically.

d)

They are always faster than linked lists.

14.

Explain the difference between a stack and a queue in terms of data access.

a)

Stacks allow access to the last element added, while queues allow access to the first element added.

b)

Stacks allow access to the first element added, while queues allow access to the last element added.

c)

Both allow access to all elements.

d)

There is no difference.

15.

How does a binary search tree differ from a regular binary tree?

a)

A binary search tree allows duplicate values.

b)

A binary search tree maintains order for efficient searching.

c)

A binary search tree is always balanced.

d)

There is no difference.

16.

When designing a search for all students living in a city, what is the most efficient operation if addresses are indexed in a hash table?

a)

Deletion

b)

Sorting

c)

Searching by key

d)

Traversal

17.

If a linked list’s tail is disconnected, which operation is threatened?

a)

Push

b)

Pop

c)

Traversal to last element

d)

Insertion at head

18.

Two departments implement separate student arrays. Which operation joins them for a whole-college CGPA report?

a)

Traversal

b)

Merging

c)

Sorting

d)

Destruction

19.

In a dynamic family income tracking system, which structure adapts best if data varies monthly?

a)

Linked list

b)

Static array

c)

Stack

d)

Graph

20.

Application: Which structure is optimal to quickly analyze millions of tweets?

a)

Stack

b)

Array

c)

Tree

d)

Hash Table

21.

What property makes algorithm logic portable across languages?

a)

Language independence

b)

Effectiveness

c)

Finiteness

d)

Well-defined outputs

22.

Describe the concept of dynamic programming in relation to data structures.

a)

It is a method of storing data.

b)

It is a way to sort data.

c)

It is a technique for solving problems by breaking them down into simpler subproblems.

d)

It is a type of data structure.

23.

What is a key advantage of using linked lists over arrays?

a)

Linked lists have a fixed size.

b)

Linked lists can grow dynamically.

c)

Linked lists are always faster.

d)

Arrays are easier to implement.

24.

What is the difference between a stack and a queue?

a)

Stacks are FIFO, queues are LIFO.

b)

Stacks are LIFO, queues are FIFO.

c)

Both are the same.

d)

Stacks can grow dynamically, queues cannot.

25.

Explain the difference between a stack and a queue in terms of data access.

a)

Stacks allow access to the last element added, while queues allow access to the first element added.

b)

Stacks allow access to the first element added, while queues allow access to the last element added.

c)

Both allow access to all elements.

d)

There is no difference.

26.

What algorithm property guarantees clarity in each instruction?

a)

Well-defined outputs

b)

Finiteness

c)

Unambiguity

d)

Effectiveness

27.

To combine student records from two years, what operation is performed?

a)

Destruction

b)

Merging

c)

Traversal

d)

Sorting

28.

To combine student records from two years, what operation is performed?

a)

Destruction

b)

Merging

c)

Traversal

d)

Sorting

29.

Which structure is best for arranging students by last name alphabetically?

a)

Array (with sorting)

b)

Hash Table

c)

Linked List

d)

Queue

30.

What outcome results from deleting the head of a singly-linked list?

a)

List remains unchanged

b)

List is destroyed

c)

All elements become orphaned

d)

Head advances to next node

31.

Which property guards against vague or multi-meaning instructions in algorithms?

a)

Unambiguity

b)

Language independence

c)

Finiteness

d)

Effectiveness

32.

What analytical advantage does a tree have over a stack in representing mentor-student relationships?

a)

Supports hierarchical data

b)

Faster retrieval of last added

c)

Simpler linear traversal

d)

No advantage

33.

What function is used to add an element to the end of an array in Python?

a)

add()

b)

append()

c)

insert()

d)

extend()

34.

Which of the following is an example of a one-dimensional array?

a)

Matrix

b)

Tic-tac-toe board

c)

List of student grades

d)

Rubik's cube

35.

Which Python module is commonly used for numerical arrays?

a)

array

b)

numpy

c)

math

d)

all of the above

36.

What is the first index of an array?

a)

0

b)

1

c)

-1

d)

2

37.

What does the index of an array represent?

a)

The value stored in the array

b)

The location of the array in memory

c)

The unique address of an element in the array

d)

The size of the array

38.

Which of the following is a characteristic of an array?

a)

Dynamic size

b)

Contiguous memory allocation

c)

Elements stored at random locations

d)

Elements of different types

39.

What is an array?

a)

A data structure that stores a fixed-size collection of elements of the same type

b)

A function that performs operations on data

c)

A data type that stores any type of element

d)

A variable that holds different types of data

40.

What function is used to remove an element at a specific index in an array?

a)

delete()

b)

remove()

c)

pop()

d)

discard()

41.

Which of the following is a valid two-dimensional array?

a)

[[1, 2], [3, 4]]

b)

[[1], [2, 3]]

c)

[1, 2, 3]

d)

{"a": 1, "b": 2}

42.

How are arrays stored in memory?

a)

Non-contiguously

b)

Contiguously

c)

Randomly

d)

Sequentially but with gaps

43.

How do you access the third element in an array arr = [10, 20, 30, 40, 50]?

a)

arr[1]

b)

arr[2]

c)

arr[3]

d)

arr[0]

44.

Which method is used to insert an element at a specific position in an array?

a)

insert()

b)

append()

c)

extend()

d)

push()

45.

What happens if you try to access an index beyond the size of the array in Python?

a)

Returns None

b)

Raises an IndexError

c)

Returns the last element

d)

Returns False

46.

What is the output of the following code? arr = [1, 2, 3, 4] arr.insert(2, 10) print(arr)

a)

[1, 2, 10, 3, 4]

b)

[1, 10, 2, 3, 4]

c)

[1, 2, 3, 4, 10]

d)

[1, 2, 3, 10, 4]

47.

Which of the following operations is most efficient in an array?

a)

Searching

b)

Insertion at the end

c)

Deletion at the beginning

d)

Insertion at the beginning

48.

Which Python library is commonly used for multidimensional arrays and matrices?

a)

pandas

b)

math

c)

numpy

d)

array

49.

How can you reverse an array in Python?

a)

arr.reverse()

b)

arr[::-1]

c)

arr.reverse() or arr[::-1]

d)

reversed(arr)

50.

What is the difference between an array and a list in Python?

a)

Arrays can hold elements of different types, while lists cannot

b)

Arrays are fixed size, lists are dynamic

c)

Lists are faster than arrays

d)

Arrays allow duplicate elements, while lists do not

51.

What is a multidimensional array?

a)

An array with a single index

b)

An array with two or more indices

c)

An array with no elements

d)

A list of arrays

52.

Which of the following best describes stack?

a)

A linear data collection of data elements where elements are inserted in the container.

b)

A linear data structure that holds FIFO protocol.

c)

A linear data structure that takes out first the last element.

d)

A linear structure that uses push and pop.

53.

The one that tells that stack is empty.

a)

top = -1

b)

top = 0

c)

top = 1

d)

no answer

54.

It is the condition where stack is full and push operation keeps trying to insert elements.

a)

overflow

b)

underflow

c)

peek

d)

no answer

55.

A condition where stack is trying to pop elements in the stack while it is empty.

a)

overflow

b)

underflow

c)

peek

d)

no answer

56.

The initial value of the TOP pointer when the stack is empty is usually:

a)

0

b)

1

c)

-1

d)

Null

57.

Which data structure works on the principle of LIFO?

a)

queue

b)

stack

c)

tree

d)

graph

58.

The operation that adds an element to the top of the stack is called:

a)

push

b)

pop

c)

enqueue

d)

deque

59.

The process of reversing a string using stack operations can be achieved by:

a)

pushing all characters and popping them in sequence

b)

removing all middle characters first

c)

using two stacks

d)

using random access

60.

The process of reversing a string …

a)

pushing all characters and popping them in sequence

b)

removing all middle characters first

c)

using two stacks

d)

using random access

61.

When evaluating a postfix expression, what happens when an operator is encountered?

a)

push operator

b)

skip it

c)

pop operator and push result

d)

pop required operands and push result

62.

If a function is called recursively five times before base case… how many activation records stored?

a)

3

b)

4

c)

5

d)

6

63.

Equivalent postfix notation of (1+2)+(3+6+7)/2(1+2) + (3+6+7) / 2

a)

12+367++2/+

b)

12+367+2/+

c)

12+3672/++

d)

123672+6++/+

64.

In the given infix notation (1+2)+(3+6+7)/2(1+2) + (3+6+7) / 2 — which operation comes first?

a)

temp holder created

b)

2 was pushed

c)

two pointer created

d)

a new holder created

65.

In the infix (1+2)+(3+6+7)/2(1+2)+(3+6+7)/2 when (3+6+7)(3+6+7) will be evaluated?

a)

when 2 & / already pushed

b)

when 2 and 7 pushed

c)

when 2 / already in stack

d)

when 2,7,6 was already pushed

66.

In (1+2)+(3+6+7)/2(1+2)+(3+6+7)/2 Operator / ) and var 2,16 will appear in after _____ push execution

a)

10th

b)

9th

c)

11th

d)

8th

67.

How many operations will it take to evaluate the notation (1+2)+(3+6+7)/2(1+2)+(3+6+7)/2

a)

16

b)

18

c)

17

d)

19

68.

Prefix of (1+2)+(3+6+7)/2(1+2)+(3+6+7)/2

a)

+++/276321

b)

/+++-123672

c)

/+++/+12345678

d)

+++/123672

69.

If p=4,q=3,r=5,s=7,t=6,u=2p=4, q=3, r=5, s=7, t=6, u=2 — corresponding infix of p q r * s + t u / - * ?

a)

4 * ((3*5)+7) - (6/2)

b)

4357*62/-*

c)

4*(3*5)+7-(6/2)

d)

no answer

70.

Evaluate postfix p q r * s + t u / - ?

a)

64

b)

80

c)

90

d)

no answer

71.

Prefix of X/((3+4)/Y)−Z∗X/((3+4)/Y)-Z*

a)

-/+*X34YZ

b)

*X/-+34YZ

c)

*X/+34Y-Z

d)

no answer

72.

Program recursion stack overflow — what prevents it?

a)

Add base condition

b)

Use global variables

c)

Increase loop iterations

d)

Use queue-based recursion

73.

What should be done when encountering a lower precedence operator than the operator at the top of the stack?

a)

push it immediately

b)

pop and evaluate top operator

c)

swap operators

d)

ignore it

74.

Reverse Polish calculator stopped working after modifying stack size. Most likely flaw?

a)

Incorrect precedence

b)

Overflow check logic failure

c)

Infinite recursion

d)

Incorrect parsing

75.

Prevent stack corruption in multi-threaded program?

a)

Share one global stack

b)

Disable recursion

c)

Allocate separate stack for each thread

d)

Push all thread IDs into one stack

76.

Which is true about QUEUE?

a. FIFO

b. rear is front, front is rear

c. uses push and pop

d. uses enqueue and dequeue

a)

a & d

b)

b & d

c)

c only

d)

no answer

77.

Queue [A,B,C,D], after 2 dequeues?

a. C is front

b. D is rear

c. queue is empty

d. B is first

a)

c only

b)

b and d

c)

a and b

d)

no answer

78.

Which describes linear queue properties?

a. front is first

b. rear is last

c. both increase when inserting

d. underflow if full

a)

b and d is correct

b)

a and b is correct

c)

c and d

d)

no answer

79.

Which statements about enqueue are correct?

a)

adds item at rear

b)

modifies front

c)

increments rear

d)

overflow if full

80.

Empty queue scenario?

a)

front = rear = -1

b)

dequeue returns error

c)

enqueue not possible

d)

rear > front

81.

After Enqueue(Pikachu, Charmander, Bulbasaur), Dequeue(), Enqueue(Squirtle) Remaining:

a)

Pikachu, Charmander, Bulbasaur

b)

Charmander, Bulbasaur, Squirtle

c)

Bulbasaur, Charmander, Squirtle

d)

Pikachu, Squirtle

82.

Healing queue receives Eevee, Onix, Scyther, Psyduck. After two healed, which remain?

a)

Scyther, Psyduck

b)

Onix, Scyther, Psyduck

c)

Eevee, Onix, Scyther

d)

queue empty

83.

Circular queue (size 5) enqueue 5 pokemon … After Dequeue() + two Enqueue(Mewtwo, Squirtle)

a)

[Snorlax, Eevee, Onix, Bulbasaur, Mewtwo]

b)

[Pikachu, Eevee, Squirtle, Snorlax, Onix]

c)

Overflow

d)

[Eevee, Onix, Bulbasaur, Mewtwo, Squirtle]

84.

Ash’s Battling Queue = [Charmander, Squirtle, Bulbasaur]. After Dequeue + Enqueue(Pidgeotto) Remaining:

a)

[Squirtle, Bulbasaur, Pidgeotto]

b)

[Bulbasaur, Squirtle, Pidgeotto]

c)

[Charmander, Bulbasaur, Squirtle]

d)

[Pidgeotto, Squirtle, Charmander]

85.

Nurse Joy’s queue = [Lapras, Onix, Gengar]. After 2 Dequeues + Enqueue(Machamp)

a)

[Gengar, Machamp]

b)

[Lapras, Machamp]

c)

[Onix, Gengar]

d)

[Machamp]

86.

Circular queue size 6, front=4, rear=1. How many Pokémon in queue?

a)

2

b)

3

c)

4

d)

5

87.

Ash wants queue reversed. Which operation?

a)

Stack conversion

b)

Concurrent queue access

c)

Double-ended queue

d)

Heap-based priority queue

88.

Digital queue displays wrong order due to concurrency. Fix?

a)

Implement mutex locks

b)

Allow non-FIFO

c)

Increase size

d)

Reinitialize pointer

89.

Ash creates a queue simulation where defeated pokemon leaves when new pokemon comes… Ensure FIFO when max size reached?

a)

utilize circular queue

b)

stop enqueue

c)

reset all elements

d)

store backup as stack

90.

Queue storage not wrapping when rear exceeds MAX demonstrates…

a)

true overflow

b)

false overflow

c)

dynamic shrinkage

d)

stack mismatch

91.

Brock’s schedule queue has lag due to array cycles. Efficient redesign?

a)

recursion

b)

add priority queue

c)

apply linked-list queue

d)

use two stacks

92.

Tournament model requires front & rear insertion flexibility. Best structure?

a)

Stack

b)

Tree

c)

Priority queue

d)

Deque

93.

Each node in singly linked list contains:

a)

value + pointer

b)

only value

c)

two pointers

d)

only address

94.

Easiest operation in linked list vs array

a)

searching

b)

random access

c)

insertion

d)

sorting

95.

What makes linked lists dynamic?

a)

fixed size

b)

always sorted

c)

cannot be modified

d)

can grow or shrink during execution

96.

Disadvantage of linked list

a)

searching is slow & time-consuming

b)

takes less memory

c)

elements cannot be deleted

d)

efficient random access

97.

It is known as the immediate predecessor of a node.

a)

root

b)

siblings

c)

child node

d)

parent node

98.

A node with at least one child.

a)

height of nodes

b)

levels of node

c)

internal nodes

d)

external nodes

99.

It is also called as strictly binary tree.

a)

complete binary tree

b)

extended binary tree

c)

full binary tree

d)

skewed binary tree

100.

Which of the following is true about binary tree?

a)

A root node may have one or two child nodes. Each node forms a binary tree itself.

b)

The number of child nodes cannot be more than two.

c)

It has a unique path from the root to every other node.

d)

A binary tree has a root node. It may not have any child nodes (0 child nodes, NULL tree).

101.

It represents the number of connections between the node and the root.

a)

height of nodes

b)

external nodes

c)

internal nodes

d)

levels of node

102.

It represents the nodes connected by edges.

a)

Full Binary Tree

b)

Binary Search Tree

c)

Binary Tree

d)

Tree

103.

It is a non-linear data structure compared to arrays, linked list, stack and queue.

a)

Full Binary Tree

b)

Binary Search Tree

c)

Binary Tree

d)

Tree

104.

All nodes in this tree have only one child node.

a)

skewed binary tree

b)

full binary tree

c)

extended binary tree

d)

complete binary tree

105.

It represents the height of its root node.

a)

height of node

b)

edge

c)

degree of node

d)

depth of node

e)

height of tree

106.

It is used to represent mathematical expressions.

a)

extended binary tree

b)

full binary tree

c)

skewed binary tree

d)

complete binary tree

107.

It is also called Perfect Binary Tree.

a)

complete binary tree

b)

skewed binary tree

c)

extended binary tree

d)

full binary tree

108.

It represents the generation of a node.

a)

internal nodes

b)

levels of node

c)

height of nodes

d)

external nodes

109.

A tree which is dominated by left child node or right child node.

a)

full binary tree

b)

extended binary tree

c)

skewed binary tree

d)

complete binary tree

110.

It is a hierarchical data structure which stores the information naturally in the form of hierarchy style.

a)

Full Binary Tree

b)

Binary Tree

c)

Binary Search Tree

d)

Tree

111.

Which one is an advantage of tree?

a)

It provides an efficient insertion and searching operations.

b)

Tree reflects structural relationships in the data.

c)

It allows to move subtrees around with minimum effort.

d)

It is used to represent hierarchies.

e)

Trees are flexible.

112.

A number of edges on the longest path between that node and a leaf.

a)

internal nodes

b)

height of node

c)

levels of node

d)

external nodes

113.

Type of tree where each node of binary tree has either two children or no children at all.

a)

complete binary tree

b)

extended binary tree

c)

full binary tree

d)

skewed binary tree

114.

It represents a number of children of a node.

a)

edge

b)

height of tree

c)

height of node

d)

degree of node

e)

depth of node

115.

If all levels of a tree are completely filled except the last level and the last level has all keys as far as possible is called ________.

a)

skewed binary tree

b)

full binary tree

c)

extended binary tree

d)

complete binary tree

116.

Every internal node has exactly two children and all leaf nodes are at same level.

a)

extended binary tree

b)

skewed binary tree

c)

complete binary tree

d)

full binary tree

117.

A node without a child.

a)

height of nodes

b)

levels of node

c)

external nodes

d)

internal nodes

118.

Every node in the tree has either 0 or 2 children.

a)

full binary tree

b)

extended binary tree

c)

skewed binary tree

d)

complete binary tree

119.

Most of its node have the left child without corresponding right child.

a)

full binary tree

b)

extended binary tree

c)

skewed binary tree

d)

complete binary tree

120.

It consists of replacing every null subtree of the original tree with special nodes.

a)

complete binary tree

b)

extended binary tree

c)

skewed binary tree

d)

full binary tree

121.

A node with the same parent.

a)

root

b)

siblings

c)

child node

d)

parent node

122.

It is known as the connection between one node to another.

a)

height of node

b)

degree of node

c)

height of tree

d)

depth of node

e)

edge

123.

It represents the number of edges from the tree's root node to the node.

a)

depth of node

b)

edge

c)

height of node

d)

degree of node

e)

height of tree

124.

The immediate successors of a node.

a)

child node

b)

root

c)

siblings

d)

parent node