Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Data Structures and Algorithms Quiz

Total questions: 70

Worksheet time: 53mins

Name
Class
Date
1.

What is an Abstract Data Type (ADT)?

a)

A specific implementation of a data structure

b)

A mathematical model for data types, specifying operations but not implementation

c)

Any user-defined type in programming

d)

A physical device used for storing data

2.

Which of the following best describes an ADT?

a)

Defines only data storage

b)

Describes both data and allowed operations without implementation

c)

Specifies physical storage

d)

Specifies algorithm efficiency

3.

Which is NOT a feature of an ADT?

a)

Data representation is hidden

b)

Specifies operation set

c)

Specifies hardware for storage

d)

Defines type's behavior

4.

Which operation is essential for stack ADT?

a)

dequeue

b)

insert at start

c)

push

d)

find min

5.

In an algorithm, which property ensures it eventually completes?

a)

Finiteness

b)

Input

c)

Output

d)

Definiteness

6.

Which term describes the rules to perform tasks in an algorithm?

a)

Abstraction

b)

Instruction

c)

Step

d)

Procedure

7.

Which of the following is a property of a good algorithm?

a)

Ambiguous steps

b)

High time complexity

c)

Finiteness

d)

Infinite loops

8.

Algorithm analysis deals primarily with:

a)

Code syntax

b)

Correctness and efficiency

c)

Code documentation

d)

Data input methods

9.

Time complexity measures:

a)

Disk space used

b)

Maximum number of steps for a given input

c)

Amount of output

d)

Code length

10.

Space complexity measures:

a)

Running time

b)

Storage required

c)

Speed of processor

d)

Number of operators in code

11.

Big O notation describes:

a)

Best-case complexity

b)

Worst-case upper bound

c)

Average-case only

d)

Space complexity only

12.

Big Omega (Ω) notation expresses:

a)

Minimum time algorithm takes in the worst case

b)

Lower bound time complexity

c)

Space usage only

d)

Compiled code size

13.

Big Theta (Θ) denotes:

a)

The tightest lower bound

b)

The tightest upper bound

c)

The exact asymptotic bound

d)

Best-case only

14.

f(n) = O(g(n)) means:

a)

f(n) grows faster than g(n)

b)

g(n) is an upper bound for f(n)

c)

f(n) equals g(n) for all n

d)

None

15.

If f(n) = Θ(g(n)), then:

a)

f(n) grows slower than g(n)

b)

f(n) and g(n) grow at the same rate

c)

f(n) is always less than g(n)

d)

g(n) is a lower bound for f(n)

16.

The notation O(1) denotes:

a)

Constant time complexity

b)

Linear time complexity

c)

Quadratic time

d)

Exponential time

17.

Which notation is used to describe the best-case of an algorithm?

a)

O()

b)

Ω()

c)

Θ()

d)

None

18.

Which asymptotic notation signifies the lower bound?

a)

Big O

b)

Big Theta

c)

Big Omega

d)

Small o

19.

If an algorithm has time complexity O(n²), what happens as input size doubles?

a)

Time remains same

b)

Time quadruples

c)

Time halves

d)

Time doubles

20.

For f(n) = 5n + 20, what is the Big O complexity?

a)

O(1)

b)

O(n)

c)

O(n²)

d)

O(log n)

21.

What defines time complexity?

a)

Amount of time algorithm takes to run

b)

Amount of memory used

c)

Number of variables declared

d)

Code length

22.

Which has higher time complexity?

a)

O(n)

b)

O(n²)

c)

O(log n)

d)

O(1)

23.

Which function grows fastest as n increases?

a)

log n

b)

n

c)

n²

d)

n log n

24.

O(log n) efficiency is commonly found in:

a)

Linear search

b)

Binary search

c)

Bubble sort

d)

Selection sort

25.

What is the time complexity of iterating through all elements in a list of size n?

a)

O(1)

b)

O(n)

c)

O(n²)

d)

O(log n)

26.

If an algorithm doubles its steps with each input added, time complexity is:

a)

O(1)

b)

O(n)

c)

O(n²)

d)

O(2ⁿ)

27.

Which of these has the least time complexity?

a)

O(1)

b)

O(log n)

c)

O(n)

d)

O(n²)

28.

An algorithm uses an array of n elements and a constant number of variables. What is its space complexity?

a)

O(1)

b)

O(n)

c)

O(n²)

d)

O(log n)

29.

For recursive algorithms, space complexity includes:

a)

Only input size

b)

Only call stack

c)

Call stack plus all variables

d)

None

30.

Which affects space complexity?

a)

Number of function calls

b)

Use of auxiliary data structures

c)

Size of input data

d)

All of the above

31.

A stack is a:

a)

FIFO structure

b)

LIFO structure

c)

Random access

d)

Tree

32.

Which operation removes top from stack?

a)

Push

b)

Pop

c)

Pick

d)

Insert

33.

Which operation adds to stack?

a)

InsertFirst

b)

Push

c)

Dequeue

d)

Remove

34.

The element inserted last in stack is:

a)

Removed first

b)

Never removed

c)

Removed at last

d)

None

35.

What happens when attempting to pop from an empty stack?

a)

Stack overflow

b)

Stack underflow

c)

No effect

d)

Program restarts

36.

Which is not a stack operation?

a)

Enqueue

b)

Push

c)

Pop

d)

Peek

37.

Peek operation in stack:

a)

Returns and removes top element

b)

Returns but does not remove top element

c)

Removes but does not return top element

d)

None

38.

Stack can be implemented by:

a)

Array

b)

Linked list

c)

Either A or B

d)

Tree

39.

Which application uses stack?

a)

Expression evaluation

b)

Recursion tracking

c)

Undo in editors

d)

All of the above

40.

The initial value of top in an empty stack (array implementation) is:

a)

0

b)

1

c)

-1

d)

None

41.

Applications of Stack: Infix to Postfix, Expression Evaluation, Towers of Hanoi

a)

Queue implementation

b)

Infix to postfix conversion

c)

Tree traversals only

d)

None

42.

Infix expression A+B is converted to postfix as:

a)

AB+

b)

+AB

c)

AB

d)

B+A

43.

The main advantage of postfix notation is:

a)

Difficult computation

b)

No need for parentheses

c)

Needs more space

d)

More time-consuming

44.

Which data structure is used for expression evaluation?

a)

Queue

b)

Stack

c)

Array

d)

Heap

45.

How many stacks are needed for evaluating a postfix expression?

a)

1

b)

2

c)

3

d)

4

46.

What is the postfix of the expression (A+B)C?

a)

ABC+*

b)

AB+C*

c)

+ABC*

d)

None

47.

The number of moves required to solve Tower of Hanoi with n disks is:

a)

n

b)

n²

c)

2ⁿ-1

d)

n!

48.

In Tower of Hanoi, to move n disks, the recursive solution:

a)

Is not feasible

b)

Moves n-1 disks, then nth disk

c)

Does not use stack

d)

Ignores recursive calls

49.

Which data structure is mirrored in recursion?

a)

Queue

b)

Stack

c)

Array

d)

Heap

50.

Which structure is used by compilers to implement function calls?

a)

Queue

b)

Stack

c)

Heap

d)

Array

51.

A queue is:

a)

LIFO

b)

FIFO

c)

FILO

d)

None

52.

Which queue operation inserts an element?

a)

Push

b)

PoP

c)

Enqueue

d)

Peek

53.

Which operation removes the front element?

a)

push

b)

pop

c)

dequeue

d)

remove

54.

Which queue operation checks the element at the front without removing?

a)

Front

b)

Rear

c)

Empty

d)

Insert

55.

Initial state of front and rear in an empty queue (array) is:

a)

0, 0

b)

-1, -1

c)

1, 1

d)

Null

56.

A queue can be implemented using:

a)

Stack

b)

Array

c)

Linked List

d)

B or C

57.

In queue, insertion takes place at:

a)

Rear

b)

Front

c)

Middle

d)

Top

58.

Which is NOT an application of queues?

a)

Job scheduling

b)

Printing tasks

c)

Function call management

d)

Breadth First Search

59.

Queue overflow occurs when:

a)

Removing element from empty queue

b)

Adding element to full queue

c)

Both A and B

d)

None

60.

If front = rear in a queue with n elements, the queue is:

a)

Empty

b)

Full

c)

Not Defined

d)

None of the above

61.

Circular Queue overcomes which problem of regular queues?

a)

Underflow

b)

Wasted space due to space unavailability at front

c)

Overflow

d)

Duplicates allowed

62.

In circular queue, front = (front + 1) % size removes element from:

a)

Front

b)

Rear

c)

Random

d)

top

63.

Deque allows insertions and deletions at:

a)

Rear only

b)

Front only

c)

Both ends

d)

Middle only

64.

Which operation is not allowed in a simple queue?

a)

Enqueue at rear

b)

Dequeue at rear

c)

Dequeue at front

d)

Enqueue at rear

65.

Which is a real-life application of circular queue?

a)

CPU Scheduling

b)

Browser History

c)

Expression Evaluation

d)

Recursion

66.

In circular queue, what condition for overflow if rear is at the last position?

a)

rear == front

b)

(rear+1)%size == front

c)

rear == size

d)

None

67.

Which of the following is NOT a queue type?

a)

Priority Queue

b)

Simple Queue

c)

Circular Queue

d)

Binary Queue

68.

Deque stands for:

a)

Double-ended queue

b)

Data-ended queue

c)

Dual queue

d)

Data enqueue

69.

What is a Queue Underflow?

a)

Queue is full

b)

Queue is empty and a delete operation is tried

c)

Queue exists but not full

d)

Both Queue is full and Queue exists but not full

70.

Which operation can add element at front of deque?

a)

enqueueFront

b)

enqueueRear

c)

dequeueFront

d)

dequeueRear