wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Activity 3.1 - Data Structures and Algorithms

Total questions: 85

Worksheet time: 3hrs 50mins

Name
Class
Date
1.

If for an algorithm time complexity is given by O(n) then complexity of it is:

a)

linear

b)

exponential

c)

constant

d)

none of the mentioned

2.

Data in the data structures are processed by operations like insertion, deletion, sorting, merging and ______________

a)

A. Traversing

b)

B. Searching

c)

C. Retrieval

d)

D. Both A and B

3.

If the insertion and deletion happens from both the ends then the deletion is called a ______

a)

Deque

b)

Enqueue

c)

peek

d)

full

4.

Process of inserting an element in stack is called

a)

Insert

b)

Pop

c)

Overflow

d)

Push

5.

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)

CBA

b)

ABDC

c)

ABCD

d)

DCAB

6.

What does the following function do for a given Linked List with first node as head?

void fun1(struct node* head)

{

if(head == NULL)

return;

fun1(head->next);

printf("%d ", head->data);

}

a)

Prints all nodes of linked lists

b)

Prints alternate nodes of Linked List

c)

Prints all nodes of linked list in reverse order

d)

Prints alternate nodes in reverse order

7.

. Match the following.


a) Completeness i) How long does it take to find a solution

b) Time Complexity ii) How much memory need to perform the search.

c) Space Complexity iii) Is the strategy guaranteed to find the solution when there in one.

a)

a-iii, b-i, c-ii

b)

a-i, b-ii, c-iii

c)

a-i, b-iii, c-ii

d)

a-iii, b-ii, c-i

8.

Efficiency of an algorithm is measured by

a)

Time and Space complexity

b)

Speed and Capacity complexity

c)

Speed and Space complexity

d)

Time and Capacity complexity

9.

Which of the following data structures are mutable?

a)

Array

b)

List

c)

Tuple

d)

Enum

10.

The algorithm implemented in a stack is?

a)

FIFO- the first element must come out first from the list

b)

WIFI - the worst element must be the first to come in to the list

c)

LIFO - the last element must be the first to come out from the list

d)

all of the above

11.

What will happen by attempting to push another item onto the top of a full stack?

a)

Underflow error

b)

Overload error

c)

Overflow error

d)

Catastrophic error

12.

Look at the diagram of the stack. What would the stack look like after the following operations were called:

peek()

pop()

push("yellow")

a)
b)
c)
d)
13.

It refers to collection of variables, possibly of several different data types connected in various ways.

a)

Database

b)

Arrays

c)

Data Structures

d)

Abstraction

14.

there are primitive data types, meanwhile there are what we call abstract data type, evaluate which is not one.

a)

Stacks

b)

Arrays

c)

Trees

d)

Tables

15.

Data that a variable can hold in a programming language, all programming language has a set of it.

a)

Algorithms

b)

Variables

c)

Data Types

d)

Programming

16.

Finite set of instructions that specify a sequence of operations to be carried out

a)

Flowcharting

b)

Algorithms

c)

Procedure

d)

Pseudocodes

17.

Linear Search checks every element of a list one at a time in sequence, also called as sequential search.

a)

MAYBE

b)

TRUE

c)

FALSE

d)

None of the Choices

18.

It is a mathematical object which arises in many physical problems, consists of m rows and n columns

a)

Array

b)

Matrix

c)

Table

d)

Excel

19.

Which of the following definitions of Array Terms is CORRECT?

a)

Elements - individual data / items in an array indicated by the array name followed by its dimensions appears in a square brackets

b)

Index - each variable or cell in an array

c)

Dimensions - an integer from 1 - n called dimensioned variables

d)

All of the Choices

20.

Which of the following statements is NOT TRUE about PSEUDOCODES?

a)

textual presentation of a flowchart

b)

the control structures impose the logic

c)

close to a natural language

d)

None of the choices

21.

It can be used to encapsulate parts of an algorithm by localizing in one section of a program all the statements relevant to a certain aspect of a program.

a)

Algorithms

b)

Pseudocodes

c)

Flowcharting

d)

Procedures

22.

What is returned by values[5]?

a)

6

b)

9

c)

8

d)

12

23.

Which of these data structures is FIFO?

a)

Stack

b)

Queue

c)

Graph

d)

Linked list

24.

A Queue can only store 6 data items. The Queue has sent 4 data items: Bert, Cynthia, Cedric and Albert. Where does the "Front" pointer point?

a)

0

b)

1

c)

2

d)

3

25.

A Queue can only store 6 data items. The Queue is sent 4 data items: Bert, Cynthia, Cedric and Albert. Where does the "Rear" pointer point?

a)

0

b)

1

c)

2

d)

3

26.

A Queue can only store 6 data items. The Queue has sent 4 data items: Bert, Cynthia, Cedric and Albert. Where does the "Front" pointer point if a deQueue operation is performed.

a)

Bert

b)

Cynthia

c)

Cedric

d)

Albert

27.

In terms of an array, what is an index?

a)

he first element in an array

b)

A value which points to a data element in an array

c)

A list of all the elements in an array

28.

In the known abstract data types, which returns an overflow or underflow error?

a)

Linked List

b)

Stacks

c)

Queues

d)

Graphs

e)

Trees

29.

A Binary search requires the data it is searching to be ordered in some way...

a)

True

b)

FALSE

c)

Not all the time

30.

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, the no of element present on stack are

a)

1

b)

2

c)

3

d)

4

e)

5

31.

Does Abstracts Data Types support the programmer's efficiency?.

a)

Yes

b)

No

32.

choose the two types of the Data

a)

Primitive Data Type

b)

return

c)

User defined Data

d)

void

33.

What is an algorithm?

a)

placeholders for representing data

b)

is a sequence of instructions or a set of rules that are followed to complete a task.

c)

Something that comes somewhere in between formatted English and computer program code

d)

The arrangement of and relations between

the parts or elements of something.

34.

Correct code to define a list C++?

a)

Int[] scores = {15, 29, 4, 50};

b)

int scores [4]= {15, 29, 4, 50}

c)

int scores = (15, 29, 4, 50)

d)

none of the above

35.

It use pointer to link nodes.

a)

Variable

b)

Trees

c)

Pointer

d)

Link List

36.

Differentiate priori and posterio analysis in one sentence (5 points)

4 lines
37.

In doing shell sort algorithm, what will you do after you swapped the values using the Knuth's formula and the interval of 1?

a)

Sort the remaining sub list using bubble sort

b)

Identify the pivot value then implement merge sort

c)

Use insertion sort

d)

all of the above

38.

Why do we use the isFull() function in a queue?

a)

A. to identify if the list has any available position, so we can add if there is or send an overflow error message otherwise

b)

B. to detect the size of the list then resize it when necessary to adjust the size of the queue

c)

both A and B

d)

no answer

39.

What will happen during a dequeue operation and the algorithm found out that the list is already empty?

a)

an underflow error message will appear

b)

an overflow error message will appear

c)

an error message will appear

d)

a queue is full error message will appear

40.

to be able to use interpolation search, we need to get the ______________ from the list

a)

middle position

b)

probing position

c)

interval position

d)

high and low position

41.

When the item being search in binary search does not match to the calculated middle position because the search item is at the upper list, what will you do?

a)

reassign a new value to the lowest position whereas: low = mid + 1

b)

reassign a new value to the highest position whereas: high = mid - 1

c)

reassign a new value to the lowest position whereas: mid = mid + 1

d)

none of the above

42.

It talks about arranging data in a particular format, whether ascending or descending.

a)

Searching

b)

Stacking

c)

Queueing

d)

Sorting

43.

Bonus question: what is the significance of learning Data Structures and understanding the use of algorithm in day to day life as an IT person?

4 lines
44.

Special Format for storing and organizing data

a)

Algorithm

b)

Algorithm Design

c)

Data Structure

d)

Data Algorithm

45.

A complete binary tree where the value of each of each parent node is either higher or lower than the value of its child nodes.

a)

Tree

b)

Heap

c)

Queue

d)

Linked List

46.

an ordered list in which the first element added is the first element retrieved or removed (First-In, FirstOut).

a)

Heap

b)

Tree

c)

Stack

d)

Queue

47.

an ordered list in which the last element added is the first element retrieved or removed (Last-In, First-Out).

a)

Stack

b)

Queue

c)

Tree

d)

Heap

48.

A series of values stored in memory is called ___

a)

an array

b)

a tree

c)

a matrix

d)

a struct

49.

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

a)

a tree

b)

a linked list

c)

a pointer

d)

a queue

50.

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

51.

Which of these data structures is LIFO?

a)

Stack

b)

Queue

c)

Binary Tree

d)

Double linked list

52.

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)

53.

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

54.

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

55.

Consider the following operations performed on a stack of size 5:

Push (a); Pop() ; Push(b); Push(c); Pop(); Push(d); Pop();Pop(); Push (e)

Which of the following statements is correct?

a)

Underflow occurs

b)

Stack operations are performed smoothly

c)

Overflow occurs

d)

None of the above

56.

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

57.

Consider above is a Stack implemented using the array.

In this implementation of stack maximum value of top which cannot cause overflow will _________.

a)

11

b)

10

c)

9

d)

None of the answer

58.

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)

59.

Pointer is __________ data type

a)

derived

b)

primary

c)

user defined

d)

none of above

60.

Array is ___________ data type.

a)

user defined

b)

primary

c)

derived

d)

all 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 structure data items are not in sequence.

a)

non linear

b)

linear

c)

non-homogeneous

d)

all of above

63.

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

a)

linear

b)

homogeneous

c)

static

d)

dynamic

64.
Which of the following is the best description of the linear search algorithm?
a)
Put the elements in order, then go through them one by one until target is found or the end of the list is reached.
b)
Put the elements in order, compare with the middle value, if not the target: continue to the left or right of the middle and repeat. 
c)
Elements do not need to be in order. Go through them one by one until target is found or the end of the list is reached.
d)
Elements do not need to be in order, compare with the middle value, if not the target: continue to the left or right of the middle and repeat. 
65.
What is the maximum number of comparisons a linear search algorithm could make while searching a 100 item list?
a)
50
b)
51
c)
100
d)
101
66.
What is the average number of comparisons for a successful linear search on a list with 100 items?
a)
50
b)
101
c)
100
d)
50.5
67.

What does LIFO stand for?

a)

Last In First Out

b)

Least In Flow Out

c)

Last In Flow Out

d)

Last In First Object

68.

Why do we need to organize data in a computer? Check all possible answers.

a)

You will easily direct someone to access a file for you.

b)

You will easily update back-ups or switch computers.

c)

You will always know where to find what you need.

d)

You will never waste time where to save anything.

69.

_is a way to classify various types of data such as integer, string, etc.

a)

Dynamic programming

b)

Data Type

c)

Data object

d)

Basic Operations

70.

_is used where we have problems, which can be divided into similar sub-problems, so that their results can be re-used. Mostly, these algorithms are used for optimization.

a)

Top-down approach

b)

Bottom-up approach

c)

Data type

d)

Dynamic Programming

71.

which one is the example of built in data type

a)

Deletion

b)

List

c)

Stack

d)

Integers

72.

_similar to divide and conquer in breaking down the problem into smaller and yet smaller possible sub-problems.

a)

Fibonacci series

b)

Dynamic programming approach

c)

Algorithm

d)

tabulation

73.

 Fibonacci sequence looks like

a)

0,0,1,2,3,5,8,

b)

0,0,1,2,3,5,8,13

c)

0,1,1,1,2,3,5,8,

d)

0,1,1,2,3,5,8,13

74.

a linear data structure, in which the elements are not stored at contiguous memory locations.

a)

arrays

b)

stack

c)

Queue

d)

Linked list

75.

a collection of items stored at contiguous memory locations.

a)

index

b)

Array

c)

stack

d)

queue

76.

a linear data structure in which elements can be inserted and deleted only from one side of the list, called the top

a)

Queue

b)

Stack

c)

Array

d)

Linked List

77.

is a linear structure that follows a particular order in which the operations are performed. The order is First In First Out (FIFO).

a)

Queue

b)

Stack

c)

Array

d)

tabulation

78.

_is a way to classify various types of data such as integer, string, etc.

a)

Dynamic programming

b)

Data Type

c)

Data object

d)

Basic Operations

79.

_is used where we have problems, which can be divided into similar sub-problems, so that their results can be re-used. Mostly, these algorithms are used for optimization.

a)

Top-down approach

b)

Bottom-up approach

c)

Data type

d)

Dynamic Programming

80.

_is a region of storage that contains a value or group of values.

a)

Built-in Data Type

b)

Data Object

c)

Derived Data Type

d)

Basic Operations

81.

which one is the example of built in data type

a)

Deletion

b)

List

c)

Stack

d)

Integers

82.

which one is the example of basic operations

a)

Searching

b)

Array

c)

Character

& Strings

d)

Integers

83.

_similar to divide and conquer in breaking down the problem into smaller and yet smaller possible sub-problems.

a)

Fibonacci series

b)

Dynamic programming approach

c)

Algorithm

d)

tabulation

84.

a collection of items stored at contiguous memory locations.

a)

index

b)

Array

c)

stack

d)

queue

85.

a linear data structure in which elements can be inserted and deleted only from one side of the list, called the top

a)

Queue

b)

Stack

c)

Array

d)

Linked List