wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Data Structure

Total questions: 150

Worksheet time: 2hrs 53mins

Name
Class
Date
1.

How is an array initialized in C language?

a)

int a= {1,2,3};

b)

int a[3]={1,2,3};

c)

int a = new int[3]

d)

int a(3)= [1,2,3];

2.

Which of the following data items may lead to variable length records when included as items in the record?

a)

age

b)

DOB

c)

Gender

d)

Previous Employer

3.

Which of the following is a linear data structure?

a)

Graph

b)

Binary Tree

c)

Linked list

d)

AVL Tree

4.

What will be the output of the following code snippet?

a)

5

b)

15

c)

6

d)

9

5.

What is the disadvantage of array data structure?

a)

Elements of an array can be accessed in constant time

b)

Elements are stored in contiguous memory location

c)

The amount of memory to be allocated should be known beforehand

d)

Multiple other data structures can be implemented using Array

6.

When a pop() operation is called on an empty queue, what is the condition called?

a)

Overflow

b)

Underflow

c)

Syntax Error

d)

Garbage Value

7.

What is the time complexity of the binary search algorithm?

a)

O(n)

b)

O(1)

c)

O(n2)

d)

O(log2n)

8.

What is the best case time complexity of the binary search algorithm?

a)

O(1)

b)

O(n)

c)

O(log2n)

d)

O(n2)

9.

Identify the two types of efficiencies that are important for computer algorithms.

a)

Time efficiency and High power efficiency

b)

High power efficiency and Computational Efficiency

c)

Computational Efficiency and Space Efficiency

d)

Time Efficiency and Space Efficiency

10.

The running time of an algorithm is O(g(n)) if and only if ___

a)

its worst case running time is O(g(n)) and best case run time is Ω(g(n))

b)

O(g(n))= Ω(g(n))

c)

its worst case running time is Ω(g(n)) and best case run time is O(g(n))

d)

O(g(n)) Ո ω(g(n)) is non-empty set

11.

A queue follows _________

a)

LIFO

b)

FIFO

c)

Linear Tree

d)

Ordered Aray

12.

See the image and answer

a)

[log2n] * n

b)

n

c)

[log2n]

d)

[log2n] + 1

13.

How can we describe an array in the best possible way?

a)

The Array shows a hierarchical structure.

b)

Arrays are immutable (Not Modifiable)

c)

Container that stores the elements of similar types

d)

The Array is not a data structure

14.

Which one of the following is the size of int arr[9] assuming that int is of 4 bytes?

a)

9

b)

36

c)

32

d)

None

15.

Which one of the following is the process of inserting an element in the stack?

a)

Add

b)

Push

c)

Insert

d)

None

16.

If the size of the stack is 10 and we try to add the 11th element in the stack then the condition is known as___

a)

Overflow

b)

Successful Insertion

c)

Underflow

d)

Garbage Collection

17.

Which of the following is not the correct statement for a stack data structure?

a)

Arrays can be used to implement the stack

b)

Stack follows FIFO

c)

Elements are stored in a sequential manner

d)

Top of the stack contains the last inserted element

18.

If the elements '1', '2', '3' and '4' are added in a stack, so what would be the order for the removal?

a)

1234

b)

2134

c)

4321

d)

None

19.

The time complexity of enqueue(insertion) operation in Queue is ___

a)

O(1)

b)

O(n)

c)

O(log n)

d)

O(n log n)

20.

A mathematical-model with a collection of operations defined on that model is called _____

a)

Data Structure

b)

ADT

c)

Primitive Data Type

d)

Algorithm

21.

Which of the following points is/are true about Linked List data structure when it is compared with array

a)

Arrays have better cache locality that can make them better in terms of performance.

b)

It is easy to insert and delete elements in Linked List

c)

The size of array has to be pre-decided, linked lists can change their size any time.

d)

Random access is not allowed in a typical implementation of Linked Lists

e)

All the Above

22.

You are given pointers to first and last nodes of a singly linked list, which of the following operations are dependent on the length of the linked list?

a)

Delete the First element

b)

Inser a new element as the first element

c)

Delete the last element

d)

Add a new element at the end of the list

23.

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

a)

Managing function calls

b)

The stock span problem

c)

Arithmetic expression evaluation

d)

All the above

24.

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

a)

When a resource is shared among multiple consumers.

b)

When data is transferred asynchronously (data not necessarily received at same rate as sent) between two processes

c)

Process Scheduling

d)

All the above

25.

Which of the following is true about linked list implementation of stack?

a)

In push operation, if new nodes are inserted at the beginning of linked list, then in pop operation, nodes must be removed from end.

b)

In push operation, if new nodes are inserted at the end, then in pop operation, nodes must be removed from the beginning.

c)

Both of the above

d)

None of the above

26.

Suppose the numbers 7, 5, 1, 8, 3, 6, 0, 9, 4, 2 are inserted in that order into an initially empty binary search tree. The binary search tree uses the usual ordering on natural numbers. What is the in-order traversal sequence of the resultant tree?

a)

7 5 1 0 3 2 4 6 8 9

b)

0 2 4 3 1 6 5 9 8 7

c)

0 1 2 3 4 5 6 7 8 9

d)

9 8 6 4 2 3 0 1 5 7

27.

Which of the following is not the type of queue?

a)

Priority Queue

b)

Single ended Queue

c)

Ordinary Queue

d)

Circular Queue

28.

When a pop() operation is called on an empty queue, what is the condition called?

a)

Overflow

b)

Underflow

c)

Syntax Error

d)

Garbage Value

29.

Which of the following can be done with LinkedList?

a)

Implementation of Stacks and Queues

b)

Implementation of Binary Trees

c)

Implementation of Abstract Data Structures with dynamic memory allocation

d)

All of the above

30.

What is the information, which a LinkedList’s Node must store?

a)

The address of the next node if it exists

b)

The value of the current node

c)

Both (A) and (B)

d)

None of the above

31.

Which of the following represents the Postorder Traversal of a Binary Tree?

a)

Left -> Right -> Root

b)

Left -> Root -> Right

c)

Right -> Left -> Root

d)

Right -> Root -> Left

32.

Which data structure is mainly used for implementing the recursive algorithm?

a)

Queue

b)

Stack

c)

Array

d)

List

33.

Which of the following data structures allow insertion and deletion from both ends?

a)

Stack

b)

Double Ended Queue(Deque)

c)

Queue

d)

Strings

34.

 

Which of the following data structures can be used to implement queues?

a)

Stack

b)

Arrays

c)

LinkedList

d)

All of the Above

35.

What is the disadvantage of array data structure?

a)

Elements of an array can be accessed in constant time.

b)

The amount of memory to be allocated should be known beforehand.

c)

Elements are stored in contiguous memory blocks.

d)

Multiple other data structures can be implemented using arrays.

36.

Which of the following is not an advantage of trees?

a)

Hierarchical structure

b)

Faster search

c)

Router algorithms

d)

Undo/Redo operations in a notepad

37.

3. What is a full binary tree?

a)

Each node has exactly two children

b)

Each node has exactly zero or two children

c)

All the leaves are at the same level

d)

Each node has exactly one or two children

38.

The number of edges from the node to the deepest leaf is called _________ of the tree.

a)

Height

b)

Depth

c)

Length

d)

Width

39.

The height of a Binary Search Tree is given as h. Consider the height of the tree as the no. of edges in the longest path from root to the leaf. The maximum no. of nodes possible in the tree is?

a)

2(h+1)12^{\left(h+1\right)}-1  

b)

2(h1)12^{\left(h-1\right)}-1  

c)

2(h1)+12^{\left(h-1\right)}+1  

d)

2(h)+12^{\left(h\right)}+1  

40.

If a node having two children is to be deleted from binary search tree, it is replaced by its

a)

Pre-order predecessor

b)

In-order predecessor

c)

in-order successor

d)

Post - order successor

41.

Example of linear data structure except

a)

array

b)

tree

c)

queue

d)

stack

42.
_________________ is a collection of elements used to store the same type of data.
a)
Array
b)
Switch
c)
Case
d)
Loop
43.

Which of these data structures is LIFO?

a)

Stack

b)

Queue

c)

Binary Tree

d)

Double linked list

44.

int nums[ ] =

{2, 3, 5, 8, 9, 11};

How would you access the fourth element in nums

a)

nums[8]

b)

nums[3]

c)

nums(4)

d)

nums(3)

45.
Which of the following is NOT a Type of Data Structures?
a)
Arrays
b)
Tables
c)
Stacks
d)
Trees
46.
Storage for data defined in terms of set of operations to be performed on the data 
a)
Arrays
b)
Variables
c)
Abstract Data Types
d)
Algorithms
47.

A FIFO structure implemented as a ring where the front and rear pointers can wrap around the end of the start of the array.

a)

Linear Queue

b)

Circular Queue

c)

Priority Queue

48.

It use pointer to link nodes.

a)

Variable

b)

Link List

c)

Pointer

d)

Trees

49.
What kind of Data structure would you expect to find utilised to store operations in a CPU?
a)
Stack
b)
Queue
c)
List
d)
Tree
50.

LIFO stands for

a)

List of Outputs

b)

Last in First Out

c)

First in Last Out

d)

None of them

51.

Act of adding values into a stack is called

a)

Popping

b)

Polling

c)

Pushing

d)

None

52.

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

a)

ABCD

b)

DCBA

c)

DCAB

d)

ABDC

53.

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

54.
a)

circular linked list

b)

linked list

c)

doubly circular linked list

d)

doubly linked list

55.

People have used the word ________ to mean computer information that is transmitted or stored.

a)

Beta

b)

Data

c)

Database

d)

None of above

56.

_____________ specifies how we enter data into our programs and what type of data we enter.

a)

data type

b)

data

c)

datum

d)

all of above

57.

void is __________ data type.

a)

primary

b)

derived

c)

user defined

d)

none of above

58.

int is __________ data type.

a)

user defined

b)

derived

c)

primary

d)

all of above

59.

Array is ___________ data type.

a)

user defined

b)

primary

c)

derived

d)

all of above

60.

Pointer is __________ data type

a)

derived

b)

primary

c)

user defined

d)

none of above

61.

In ____________ data structure, the data items are arranged in a linear sequence.

a)

linear

b)

non linear

c)

both a and b

d)

all of above

62.

In ___________ data structures all elements may or may not be of same type.

a)

linear

b)

non linear

c)

homogeneous

d)

non- homogeneous

63.

In ___________ data structure data items are not in sequence.

a)

non linear

b)

linear

c)

non-homogeneous

d)

all of above

64.

____________data structures are those whose sizes and structures associated memory locations are fixed at compile time.

a)

linear

b)

homogeneous

c)

static

d)

dynamic

65.

Stack uses __________ data structure as the element that was inserted last is the first one to be taken out.

a)

LIPO

b)

FIFO

c)

LIFO

d)

FIPO

66.

Full form of LIFO is ____________

a)

Last Inside First Outside

b)

Last Innner First Outer

c)

Last In First Out

d)

Last Impact First Out

67.

Every stack has a variable _________ associated with it.

a)

TOP

b)

BOT

c)

POT

d)

none of the above

68.

_________ operation adds an element to the top of the stack.

a)

pop

b)

push

c)

peep

d)

all of the above

69.

_________ operation removes the element from the top of the stack.

a)

push

b)

pop

c)

update

d)

none of the above

70.

_________ operation returns the value of the topmost element of the stack.

a)

push

b)

pop

c)

peep

d)

update

71.

_________ operation changes the value of element given by user of the stack.

a)

push

b)

pop

c)

peep

d)

update

72.

A function calls itself is called ___________.

a)

queue

b)

recursion

c)

function

d)

none of above

73.

A queue is a _________ data structure in which each element that was inserted first is the first one to be taken out.

a)

FITO

b)

FIFO

c)

FISO

d)

FIVO

74.

The elements in a queue are added at one end called ________.

a)

front

b)

rear

c)

near

d)

none of above

75.

What is a data structure?

a)

A method of arranging data

b)

A way of keeping data without an order?

c)

A "stack" only

d)

There is no formal definition for "Data Structure"

76.

Which of these data structures is FIFO?

a)

Stack

b)

Queue

c)

Binary Tree

d)

Linked List

77.

Stack is also called as

a)

Last in first out

b)

First in last out

c)

Last in last out

d)

First in first out

78.

Which data structure allows deleting data elements from front and inserting from rear?

a)

Stack

b)

Queue

c)

Array

d)

Linked List

79.

Which of the following data structure is non linear type?

a)

Stack

b)

Queue

c)

Tree

d)

Liked list

80.

Which of the following data structure is linear type?

a)

Stack

b)

Array

c)

Queue

d)

All of the above

81.

Traversing each and every record exactly once is called_______

a)

Insertion

b)

Deletion

c)

Traversing

d)

Searching

82.

Data structure= Organized data +________________

a)

allowed operations on it.

b)

allowed functions on it

c)

None of the above

83.

In linked list each node is divided into ___________parts?

a)

one

b)

two

c)

three

d)

four

84.

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

85.

Algorithm is a __________________ procedure.

a)

shortcut

b)

function

c)

reverse

d)

step by step

86.

In algorithm comment use by ________brackets.

a)

curley

b)

secure

c)

None of the above

d)

both of the above

87.

A field or collection of fields in a record which identifies a record uniquely is called a ______________

a)

Primary Key

b)

Secondary Key

c)

None of the above

88.

Stack performs ____________ operation

a)

PUSH

b)

POP

c)

both of the above

89.

In which algorithm takes less time or space is called

a)

Best case

b)

Worst case

c)

Average case

d)

None of the above

90.

The algorithm is completed when the statement _______________ is encountered.

a)

Return

b)

Finish

c)

EXIT

d)

None of the above

91.

In algorithm several statements appear in the same step

a)

True

b)

False

92.

Go to statement is the part of ______________

a)

Conditional statement

b)

Unconditional statement

c)

None of the above

93.

In algorithm assignment operation is performed using the symbol__________

a)

=

b)

:=

c)

++

d)

==

94.

In algorithm variable names should be in capital letters.

a)

True

b)

False

95.

A series of values stored in memory is called ___

a)

an array

b)

a tree

c)

a matrix

d)

a struct

96.

In some languages, arrays are also called ___

a)

groups or arrows

b)

roots or leaves

c)

lists or vectors

d)

lines or strings

97.

Almost all programming languages start arrays at ___

a)

index 0

b)

index 1

c)

index 2

d)

the null character

98.

In almost all programming languages, what kind of bracketing is used to denote array access?

a)

round brackets

b)

square brackets

c)

curly braces

d)

quotation marks

99.

Arrays of characters, like letters, numbers, punctuation and other written symbols, are called ___

a)

structs

b)

vectors

c)

strings

d)

groups

100.

Most often, to save a string into memory, you just put it in ___

a)

square brackets

b)

round brackets

c)

quotes

d)

curly braces

101.

A string ends with the binary value 0 in memory, which is called ___

a)

the concatenation character

b)

the floating point

c)

index zero

d)

the null character

102.

What is the operation of joining character strings end-to-end called?

a)

string cataloging

b)

integration

c)

interlocking

d)

string concatenation

103.

A two-dimensional list, which can be thought of as an array of arrays, is called ___

a)

a matrix

b)

a struct

c)

a tree

d)

a grid

104.

A data type that can be used to group items of possibly different types into a single type is called ___

a)

a root

b)

a struct

c)

a tree

d)

a pointer

105.

A type of struct that stores a variable, like a number, and also a pointer is called ___

a)

a nodule

b)

a radix

c)

a node

d)

a root

106.

A flexible data structure that can store many nodes is called ___

a)

a tree

b)

a linked list

c)

a pointer

d)

a queue

107.

Complex data structures built on top of linked lists, that use First-In First-Out behaviour, are called ___

a)

vectors

b)

strings

c)

queues

d)

stacks

108.

When linked lists are used as stacks, what kind of behaviour is implemented?

a)

First-In First-Out, or FIFO

b)

First-In Last-Out, or FILO

c)

Last-In Last-Out, or LILO

d)

Last-In First-Out, or LIFO

109.

Instead of enqueuing and dequeuing, data is pushed onto a stack and ___

a)

grabbed from a stack

b)

popped from a stack

c)

eaten from a stack

d)

pulled from a stack

110.

If a struct contains more than one pointer, what abstract data type is created?

a)

a queue

b)

a stack

c)

a tree

d)

a node

111.

In a tree data structure, the top most node is called ___

a)

the peak

b)

the apex

c)

the crown

d)

the root

112.

In a tree data structure, any nodes that hang from other nodes are called ___

a)

branched nodes

b)

leaf nodes

c)

children nodes

d)

daughter nodes

113.

In a tree data structure, any nodes that have no children (where the tree ends) are called ___

a)

boundary nodes

b)

leaf nodes

c)

orphan nodes

d)

terminal nodes

114.

An important property of trees is that there’s a one-way path from ___

a)

branch to branch

b)

roots to leaves

c)

parent to daughter

d)

peak to trough

115.

Which data structure is used for data that links arbitrarily, and includes things like loops?

a)

binary trees

b)

circular trees

c)

graphs

d)

dynamic linked stacks

116.

In a stack, if a user tries to remove an element from empty stack it is called _________

a)

Underflow

b)

Empty collection

c)

Overflow

d)

Garbage Collection

117.

Process of inserting an element in stack is called ____________

a)

Create

b)

Push

c)

Evaluation

d)

Pop

118.

Consider the usual algorithm for determining whether a sequence of parentheses is balanced.

Suppose that you run the algorithm on a sequence that contains 2 left parentheses and 3 right parentheses (in some order).

The maximum number of parentheses that appear on the stack AT ANY ONE TIME during the computation?

a)

1

b)

2

c)

3

d)

4 or more

119.

User perform following operations on stack of size 5 then -

push(1);

pop();

push(2);

push(3);

pop();

push(2);

pop();

pop();

push(4);

pop();

pop();

push(5);

a)

Overflow Occurs

b)

Stack Operations will be performed Smoothly

c)

Underflow Occurs

d)

None of these

120.

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

a)

1

b)

40

c)

74

d)

-18

121.

The following postfix expression with single digit operands is evaluated using a stack:

8 2 3 ^ / 2 3 * + 5 1 * -

a)

6,1

b)

5,7

c)

3,2

d)

1,5

122.

To evaluate an expression without any embedded function calls:

a)

One stack is enough

b)

Two stacks are needed

c)

As many stacks as the height of the expression tree are needed

d)

A Turing machine is needed in the general case

123.

What will be the postfix form of the above expression -

(A+B)∗(C∗D-E)∗F/G

a)

None of these

b)

A B + C D ∗ E − F G ∗ / ∗

c)

A B + C D E ∗ − F G / ∗ ∗

d)

A B + C D ∗ E − F G / ∗ ∗

124.

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

a)

Managing function calls

b)

The stock span problem

c)

Arithmetic expression evaluation

d)

All of the above

125.

List of data in which element can be inserted and removed at the same end is called as __________.

a)

array

b)

stack

c)

linked list

d)

queue

126.

A binary search tree whose left subtree and right subtree differ in height by at most 1 unit is called

a)

AVL tree

b)

Red-black tree

c)

Lemma tree

d)

None of the above

127.

________is very useful in situation when data have to stored and then retrieved in reverse order.

a)

Stack

b)

Queue

c)

List

d)

Link list

128.

In the __________traversal we process all of a vertex’s descendents before we move to an adjacent vertex.

a)

Depth First

b)

Breadth First

c)

With First

d)

Depth Limited

129.

There is an extra element at the head of the list called a ________

a)

Antinel

b)

Sentinel

c)

List header

d)

List head

130.

A graph is a collection of nodes, called __________ And line segments called arcs or__________ that connect pair of nodes.

a)

vertices, edges

b)

edges, vertices

c)

vertices, paths

d)

graph node, edges

131.

The disadvantage in using a circular linked list is __________

a)

it is possible to get into infinite loop

b)

last node points to fist node.

c)

time consuming

d)

requires more memory space.

132.

State true of false.

i) A node is a parent if it has successor nodes.

ii) A node is child node if out degree is one.

a)

True, True

b)

False, True

c)

True, False

d)

False, False

133.

A tree sort is also known as__________ sort.

a)

quick

b)

heap

c)

shell

d)

selection

134.

_____________is the method used by card sorter?

a)

Radix sort

b)

Insertion

c)

Heap

d)

Quick

135.

______________the condition indicate the queue is empty.

a)

Front=Null

b)

Null=Front

c)

Front=Rear

d)

Rear=Null

136.

TREE[1]=NULL indicates is _____________

a)

Overflow

b)

Empty

c)

Underflow

d)

Full

137.

A terminal node in a binary tree is called __________

a)

Root

b)

Branch

c)

Child

d)

Leaf

138.

If node N is a terminal node in a binary tree then its ________

a)

Right tree is empty

b)

Left tree is empty

c)

Both left & right sub trees are empty

d)

Root node is empty

139.

Other name for directed graph is _________

a)

Direct graph

b)

Digraph

c)

Dir-graph

d)

Dgraph

140.

In a graph if E=(u,v) means _____________

a)

u is adjacent to v but v is not adjacent to u

b)

e begins at u and ends at v

c)

u is processor and v is successor

d)

both b and c

141.

1. Example of linear data structure except

a)

array

b)

queue

c)

tree

d)

stack

142.

2. _________________ is a collection of elements used to store the same type of data.

a)

Array

b)

Switch

c)

Case

d)

Loop

143.

3. Types of data structure are....

a)

primitive data structure

b)

non-primitive data structure

c)

both

d)

none of them

144.

4. Input/output function prototypes and macros are defined in which header file?

a)

conio.h

b)

stdlib.h

c)

stdio.h

d)

dos.h

145.

5. Which of the following is not a correct variable type?

a)

int

b)

real

c)

float

d)

char

146.

6. Which of the following is the correct operator to compare two variables?

a)

equal

b)

=

c)

:=

d)

==

147.

7. What is the only function all C programs must contain?

a)

start()

b)

system()

c)

main()

d)

program()

148.

8. What punctuation is used to signal the beginning and end of code blocks?

a)

{ }

b)

-> and <-

c)

BEGIN and END

d)

( and )

149.

9. The "\n" character does which of the following operations?

a)

Double line spacing

b)

Character deletion

c)

Character backspace

d)

Places cursor on the next line

150.

10. Is the syntax for the following C statement correct?:


scanf("%d", input);

a)

True

b)

False