wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Fundamentals of Data Structures

Total questions: 15

Worksheet time: 8mins

Name
Class
Date
1.

What is a data structure?

a)

A data structure is a specialized format for organizing, processing, and storing data.

b)

A data structure is a programming language used for data manipulation.

c)

A data structure is a method for analyzing and interpreting data.

d)

A data structure is a type of software application for data visualization.

2.

Define a stack and its main operations.

a)

A stack is a FIFO data structure with operations: enqueue (add), dequeue (remove), and front (view first).

b)

A stack is a LIFO data structure with main operations: push (add), pop (remove), and peek (view top).

c)

A stack is a circular data structure with operations: push (add), pop (remove), and bottom (view base).

d)

A stack is a linear data structure with operations: insert (add), delete (remove), and top (view last).

3.

What is the difference between a stack and a queue?

a)

A stack uses LIFO, while a queue uses FIFO.

b)

A stack is a linear structure, while a queue is a non-linear structure.

c)

A stack allows random access, while a queue does not.

d)

A stack uses FIFO, while a queue uses LIFO.

4.

Explain the concept of recursion with an example.

a)

Recursion involves using loops to repeat a function until a condition is met.

b)

Recursion is a technique where a function runs in parallel to increase efficiency.

c)

Recursion is a method where a function calls itself to solve smaller instances of a problem.

d)

Recursion is a process where a function is executed multiple times without self-reference.

5.

What is infix notation?

a)

Infix notation is a programming syntax used for variable declaration.

b)

Infix notation is a mathematical notation where operators are placed between operands.

c)

Infix notation is a method of writing numbers in a sequence.

d)

Infix notation places operands between operators and parentheses.

6.

What is a queue and its primary operations?

a)

A queue is a FIFO data structure with primary operations 'enqueue' (add) and 'dequeue' (remove).

b)

A queue is a priority data structure with operations 'add' and 'remove'.

c)

A queue is a LIFO data structure with operations 'insert' and 'extract'.

d)

A queue is a circular data structure with operations 'push' and 'pop'.

7.

Describe the Last In First Out (LIFO) principle.

a)

In LIFO, items are processed in a random order.

b)

In LIFO, the oldest item is always removed first.

c)

In LIFO, the first item added is the first to be removed.

d)

In LIFO, the last item added is the first to be removed.

8.

What is the purpose of a stack in programming?

a)

The purpose of a stack in programming is to manage data in a LIFO manner, facilitating operations like function calls and backtracking.

b)

A stack is used to store data in a FIFO manner for quick access.

c)

The purpose of a stack is to sort data in ascending order efficiently.

d)

A stack helps in managing data by allowing random access to elements.

9.

Explain the process of evaluating a postfix expression.

a)

The final value is obtained by reversing the order of operations.

b)

Each operator is applied to the operands in a left-to-right manner.

c)

The result of the postfix expression evaluation is the final value remaining in the stack.

d)

The postfix expression is evaluated by converting it to infix first.

10.

What are the advantages of using recursion?

a)

Recursion is always faster than iteration.

b)

Recursion eliminates the need for base cases.

c)

Recursion is only useful for sorting algorithms.

d)

Advantages of using recursion include simplicity, elegance, and ease of implementation for problems with recursive nature.

11.

How does a stack overflow occur?

a)

A stack overflow occurs when the program runs out of heap space.

b)

A stack overflow happens when memory is allocated incorrectly.

c)

A stack overflow is caused by excessive memory usage in global variables.

d)

A stack overflow occurs when the call stack pointer exceeds the stack bound.

12.

What is the role of a base case in recursion?

a)

The base case allows for multiple solutions to the problem.

b)

The base case defines the maximum depth of recursion allowed.

c)

The base case prevents infinite recursion and provides a direct solution for the simplest instance of the problem.

d)

The base case is used to optimize the recursion process.

13.

How can you implement a stack using an array?

a)

A stack can be implemented using an array by using an array to store elements and a variable to track the top index for push and pop operations.

b)

A stack can be implemented using a linked list with nodes pointing to each other.

c)

A stack can be created by using a queue to store elements in reverse order.

d)

A stack can be implemented using a hash table to track the elements and their positions.

14.

What is the significance of the operator precedence in infix expressions?

a)

Operator precedence defines variable types in expressions.

b)

Operator precedence affects only unary operators.

c)

Operator precedence ensures correct evaluation order in infix expressions.

d)

Operator precedence is irrelevant in mathematical calculations.

15.

What are the common applications of queues in real-world scenarios?

a)

Implementing queues in video streaming services

b)

Using queues for data encryption processes

c)

Common applications of queues include customer service lines, print job management, task scheduling in operating systems, and handling requests in web servers.

d)

Utilizing queues for database indexing operations