wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Data Structures and Algorithm Module 4 Quiz

Total questions: 20

Worksheet time: 8mins

Name
Class
Date
1.

Which of the following best describes the primary reason why linked lists do not allow constant-time access to arbitrary elements?

a)

Their memory allocation is handled at runtime

b)

Each node may contain multiple pointers

c)

Elements are not stored in contiguous memory

d)

Their size can grow or shrink dynamically

2.

When inserting a new node at the front of a singly linked list, which of the following must be updated?

a)

Only the last node’s pointer

b)

The new node’s next pointer and the head pointer

c)

Only the new node’s data field

d)

All nodes’ next pointers

3.

In a circular singly linked list, which condition indicates that the list contains only one node?

a)

The node’s next pointer is NULL

b)

The head pointer is equal to NULL

c)

The node’s next pointer points to itself

d)

The previous pointer points to NULL

4.

Which component of a linked list node ensures proper chaining of elements in a singly linked list?

a)

Data field

b)

Head pointer

c)

Next pointer

d)

Tail node

5.

Which part of a linked list node is crucial for preventing data loss during node deletion?

a)

Data field

b)

Head pointer

c)

Previous pointer

d)

Next pointer

6.

Which type of linked list does not contain a NULL pointer in its structure?

a)

Singly linked list

b)

Doubly linked list

c)

Circular linked list

d)

Reversed linked list

7.

If a singly linked list has 5 nodes, how many total next pointers exist in the structure?

a)

4

b)

5

c)

6

d)

0

8.

You are building a queue system for a hospital’s patient list, where patients are added at the rear and served from the front. Which structure is best suited based on the module?

a)

Array

b)

Singly linked list

c)

Circular linked list

d)

Doubly linked list

9.

In a circular linked list with three nodes (A → B → C), what condition must be true to preserve its circular nature?

a)

A’s next = NULL

b)

B’s next = C

c)

C’s next = A

d)

A’s prev = C

10.

Which of the following best explains why arrays are sometimes more suitable than linked lists, based on the module?

a)

Arrays can grow without memory overhead

b)

Arrays support faster sequential insertions

c)

Arrays allow direct access via index

d)

Arrays require fewer pointers per element

11.

a < b

a)

Less than

b)

Greater than

12.

a >= b

a)

Greater than or equal to

b)

Less than or equal to

c)

Not Equal to

d)

Equal to

13.
  • Use ________ to specify a new condition to test, if the first condition is false

a)

else if

b)

if

c)

else

14.
  • Use _________ to specify a block of code to be executed, if the same condition is false

a)

else

b)

else if

c)

if

15.

What is the syntax for the If Statement

a)

if [condition]{
  // block of code to be executed if the condition is true
}

b)

if ( block of code to be executed if the condition is true) {

//condition
}

c)

if (condition) {
  // block of code to be executed if the condition is true
}

d)

if (condition) {}
  // block of code to be executed if the condition is true

16.

What is the Output?

a)

Between 2 and 10

b)

10 or more

c)

2 or less

d)

error

17.

What is the Output?

a)

Even

b)

Odd

c)

15

d)

Error

18.

What is the Output?

a)

A is greater

b)

B is greater

c)

A and B are equal

d)

Error

19.

What is the Output?

a)

Zero

b)

Positive

c)

Negative

d)

Error

20.

What is the Output?

a)

A

b)

B

c)

C

d)

D