Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

data structures mcq1

Total questions: 45

Worksheet time: 30mins

Name
Class
Date
1.

If the insertion and deletion happens from both the ends then the queue is called a______Queue

a)

a) Deque

b)

b) Header

c)

c) Queue

d)

d) Circular Queue

2.

Process of inserting an element in stack is called ____________

a)

Create

b)

Push

c)

Evaluation

d)

Pop

3.

Entries in a stack are “ordered”. What is the meaning of this statement?

a)

A collection of stacks is sortable

b)

Stack entries may be compared with the ‘<‘ operation

c)

The entries are stored in a linked list

d)

There is a Sequential entry that is one by one

4.

Which of the following applications may use a stack?

a)

a) A parentheses balancing program

b)

b) Tracking of local variables at run time

c)

c) Compiler Syntax Analyzer

d)

d) Data Transfer between two asynchronous process

5.

What is the value of the postfix expression 6 3 2 4 + – *:

a)

1

b)

14

c)

74

d)

-18

6.

The data structure required to check whether an expression contains balanced parenthesis is?

a)

a) Stack

b)

b) Queue

c)

c) Array

d)

d) Tree

7.

Circular Queue is also known as ________

a)

a) Ring Buffer

b)

b) Square Buffer

c)

c) Rectangle Buffer

d)

d) Curve Buffer

8.

If the elements “A”, “B”, “C” and “D” are placed in a queue and are deleted one at a time, in what order will they be removed?

a)

a) ABCD

b)

b) DCBA

c)

c) DCAB

d)

d) ABDC

9.

To represent hierarchical relationship between elements, Which data structure is suitable?

a)

Dequeue

b)

Priority

c)

Tree

d)

Graph

10.

Example of linear data structure except

a)

array

b)

tree

c)

queue

d)

stack

11.

LIFO stands for

a)

List of Outputs

b)

Last in First Out

c)

First in Last Out

d)

None of them

12.

Consider the following operation performed on a stack of size 5.


Push(1);

Pop();

Push(2);

Push(3);

Pop();

Push(4);

Pop();

Pop();

Push(5);


After the completion of all operation, get the total number of element present in stack is

a)

1

b)

2

c)

3

d)

4

13.
A Kind of tree where every node in a tree can have at most two children.
a)
Binary Tree
b)
Binary Expression Tree
c)
Tree
d)
Binary Search Tree
14.

Tree

a)

data structure similar to a graph, with no loops.

b)

an object in a graph also known as a vertex

c)

a join of relationship between nodes - also know as an arc

d)

the starting node in a rooted tree structure from which all other nodes branch off./

15.

In preorder traversal of a binary tree the second step is ____________

a)

traverse the right subtree

b)

traverse the left subtree

c)

traverse right subtree and visit the root

d)

visit the root

16.

What are the 3 depth traversals for a tree data structure?

a)

Pre-, In- and Post-order

b)

Pro-, In- and Past-order

c)

Pre-, Out- and Post-order

d)

Pre-, In- and New-order

17.

Given a sequence of number below:

50,60,40,70,45,55,30,80,65,35,25,75,85


When creating a binary search tree, what is the height of the tree?

a)

3

b)

4

c)

5

d)

6

18.

In stack insertion and deletion can take place only at one end call the ____________________ of the stack.

a)

Path

b)

Function

c)

Top

d)

Bottom

19.

How do you call this special function that is used to map a given value with a particular key for faster access of elements?

a)

merge

b)

sorted array

c)

hash

d)

bubble

20.

Which value is assigned/set at front and rear ends during the Initialization of a Queue?

a)

a. 0

b)

b. 1

c)

c. - 1

d)

d. infinity

21.

Which of the following is useful in traversing a given graph by breadth first search?

a)

Op 1: stack

b)

Op 2: set

c)

Op 3: list

d)

Op 4: queue

22.

Which of the following abstract data types can be used to represent a many to-many relation?

a)

Op 1: Tree

b)

Op 2: Stack

c)

Op 3: Graph

d)

Op 4: Queue

23.

The post fix form of (A + B) *C is

a)

AB+ C*

b)

ABC*+

c)

ABC*+

d)

ABC*+

24.

Which one of the following is an application of Stack Data Structure?

a)

Managing function calls

b)

Arithmetic expression evaluation

c)

CPU Scheduling

d)

All of the above

25.

The prefix form of A-B/ (C * D ^ E) is?

a)

-/*^ACBDE

b)

-ABCD*^DE

c)

-A/B*C^DE

d)

-A/BC*^DE

26.

What is An Array ?

a)

Named Collection of Homogeneous Data Element with unique Index for each element .

b)

collection of data elements .

c)

Named Collection of Data Elements Stored on Secondary Storage.

d)

Data stored in a fashion that first inserted value will be deleted always first.

27.

Efficiency of an algorithm is measured by

a)

Time and Capacity complexity

b)

Time and Space complexity

c)

Speed and Space complexity

d)

Speed and Capacity complexity

28.

Types of data structures are ...

a)

Primitive and non-primitive.

b)

Linear and non-linear.

c)

Static and dynamic.

d)

All above

29.

A data structure that changes in size as a program needs it by allocating and de-allocating memory is about ...

a)

Static data structures

b)

Dynamic data structues

30.
What does a linear search do?
a)
Looks at the first item of data, then each one in turn, until it finds the data item requested
b)
Organises the data into alphabetical order
c)
Splits the data until the requested data is found
31.
What does a binary search do?
a)
Looks at the first item of data, then each one in turn, until it finds the data item requested
b)
Converts all the data into binary
c)
Takes the data and splits it in half repeatedly until it finds the data item requested
32.
Which search algorithm would be best to use with ordered data?
a)
A binary search
b)
Either binary search or a linear search
c)
A linear search
33.
How many passes will a bubble sort go through?
a)
Only one pass
b)
Two passes
c)
Several passe - until the data is fully ordered
34.
Which of the following is an advantage of a insertion sort when compared with a bubble sort?
a)
It is quicker than a bubble sort algorithm
b)
It is simpler than a bubble sort algorithm
c)
There is no advantage.
35.
How many passes will an insertion sort go through?
a)
Only one pass
b)
Two passes
c)
Several passes - until the data is fully ordered
36.

Identify the INCORRECT statement about searching


i. Binary search starts by testing the largest data

ii. Linear search can be done for unsorted data only

iii. Linear search starts by testing data at the middle of list

iv. Binary search can be done for sorted homogeneous data

a)

i, ii and iii

b)

ii, iii and iv

c)

i, iii and iv

d)

i, ii, iii and iv

37.

Suppose a list is {2, 9, 5, 4, 8, 1}. After the first phase of bubble sort, the list becomes …

a)

2, 9, 5, 4, 8, 1

b)

2, 9, 5, 4, 1, 8

c)

2, 5, 9, 4, 8, 1

d)

2, 5, 4, 8, 1, 9

38.

The worst case occurs in linear search algorithm when ______________________

a)

Item is not in the array at all

b)

Item is somewhere in the middle of the array

c)

Item is the last element in the array or item is not there at all

d)

Item is the last element in the array

39.

With a data set of 0,1,3,6,7,8,9


How many steps would a binary search take to find the value 8?

a)

2

b)

4

c)

3

d)

7

40.

Identify the sorting algorithm that apply divide-and-conquer method.

a)

Linear Sort

b)

Merge Sort

c)

Heap Sort

d)

Binary Sort

41.
Which data structure uses hashing to store information with constant lookup time?
a)
Hash table
b)
1D Array
c)
Linked List
d)
2D Array
e)
Stack
42.

Which of the following is not a collision resolution technique?

a)

Separate chaining

b)

Linear probing

c)

Quadratic probing

d)

Hashing

43.

Given the following input (4322, 1334, 1471, 9679, 1989, 6171, 6173, 4199) and the hash function x mod 10, which of the following statements are true?

i. 9679, 1989, 4199 hash to the same value

ii. 1471, 6171 has to the same value

iii. All elements hash to the same value

iv. Each element hashes to a different value

a)

i only

b)

ii only

c)

i and ii only

d)

iii or iv

44.

What is the advantage of using a doubly linked list for chaining over singly linked list?

a)

it takes less memory

b)

it is easy to implement

c)

it makes the process of insertion and deletion faster

d)

it causes less collisions

45.

A hash function h defined h(key)=key mod 7, with linear probing, is used to insert the keys 44, 45, 79, 55, 91, 18, 63 into a table indexed from 0 to 6. What will be the location of key 18?

a)

3

b)

4

c)

5

d)

6