wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

DSA (Quiz 1) Arrays and Linked Lists

Total questions: 15

Worksheet time: 11mins

Name
Class
Date
1.

What is an array?

a)

A collection of elements identified by an index.

b)

A single element with multiple values.

c)

A data structure with fixed size and dynamic memory.

d)

A collection of nodes with pointers.

2.

Which of the following operations is fastest in an array?

a)

Insertion at the beginning

b)

Deletion at the end

c)

Accessing an element by index

d)

Insertion at the end

3.

Which of the following is an advantage of using arrays?

a)

Dynamic size

b)

Efficient memory usage

c)

Fast indexing

d)

Easy insertion and deletion

4.

In a singly linked list, each node contains:

a)

Data and a reference to the previous node.

b)

Data and a reference to the next node.

c)

Only data.

d)

Data and references to both previous and next nodes.

5.

What is the main disadvantage of using arrays?

a)

Slow access to elements

b)

Fixed size

c)

Complex implementation

d)

None of the above

6.

What does the following code do in an array? int arr[] = {1, 2, 3, 4, 5}; for (int i = 0; i < 5; i++) { cout << arr[i] << " "; }

a)

Adds elements to the array

b)

Removes elements from the array

c)

Displays elements in the array

d)

Searches for an element in the array

7.

Which of the following best describes a circular linked list?

a)

The last node points to the first node.

b)

Each node points to the next node only.

c)

Each node points to the previous node only.

d)

The first node points to the last node.

8.

In a doubly linked list, each node contains:

a)

Data and a reference to the next node.

b)

Data and references to both previous and next nodes.

c)

Only data.

d)

Data and a reference to the previous node.

9.

Which operation is faster in a linked list than in an array?

a)

Accessing an element by index

b)

Insertion at the beginning

c)

Deletion at the end

d)

Accessing the last element

10.

Which data structure is ideal for implementing undo functionality in applications like text editors?

a)

Array

b)

Linked List

c)

Stack

d)

Queue

11.

Arrays can have dynamic sizes in most programming languages.

a)

True

b)

False

12.

In a singly linked list, the last node points to the first node.

a)

True

b)

False

13.

Arrays allow for random access to elements, while linked lists do not.

a)

True

b)

False

14.

Linked lists are more memory-efficient than arrays because they do not require contiguous memory allocation.

a)

True

b)

False

15.

In an array, the index of the first element is:

a)

0

b)

1

c)

-1

d)

n