Data Structures and Algo FINALS 2

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 23

Started on Thursday, 21 January 2021, 1:08 PM

State Finished
Completed on Thursday, 21 January 2021, 2:00 PM
Time taken 52 mins 31 secs
Marks 48/50
Grade 96 out of 100
Question 1
Complete
Mark 1 out of 1

Flag question

Question text

A _______________ is a data structure that organizes data similar to a line in the


supermarket, where the first one in line is the first one out.
Select one:
a. Queue linked list
b. Neither of these
c. Stacks linked list
d. Both of these

Question 2
Complete
Mark 1 out of 1

Flag question

Question text

Stack is also called the ________________.


Select one:
a. Last in, first out
b. First in, last out
c. First in, first out
d. Last in, last out
Question 3
Complete
Mark 1 out of 1

Flag question

Question text

A list may be linear or nonlinear, depending on its implementation.


Select one:
True
False

Question 4
Complete
Mark 1 out of 1

Flag question

Question text

This is very useful in situation when data have to be stored and then retrieved in
reverse order.
Select one:
a. queue
b. stack
c. list
d. link list

Question 5
Complete
Mark 1 out of 1

Flag question

Question text
Which data structure is suitable to represent the hierarchal relationship between
elements?
Select one:
a. Tree
b. Graph
c. Priority
d. Dequeue

Question 6
Complete
Mark 1 out of 1

Flag question

Question text

Which of the following is not the part of ADT description?


Select one:
a. Both of these
b. Data
c. None of these
d. Operations

Question 7
Complete
Mark 1 out of 1

Flag question

Question text

The root of a tree is the node that has no ancestors.


Select one:
True
False

Question 8
Complete
Mark 1 out of 1

Flag question

Question text

Which of the following data structure can't store the non-homogeneous data
elements?
Select one:
a. Arrays
b. Records
c. Stacks
d. Pointers

Question 9
Complete
Mark 1 out of 1

Flag question

Question text

Which of the following is/are the levels of implementation of data structure?


Select one:
a. All of these
b. Application level
c. Abstract level
d. Implementation level

Question 10
Complete
Mark 1 out of 1

Flag question

Question text
Algorithms that use a list must know whether the list is array based or linked.
Select one:
True
False

Question 11
Complete
Mark 1 out of 1

Flag question

Question text

Which of the following is true about the characteristics of abstract data types?
i. It exports a type.
ii. It exports a set of operations.
Select one:
a. True, True
b. False, False
c. False, True
d. True, False

Question 12
Complete
Mark 1 out of 1

Flag question

Question text

Which of the following data structures is linear type?


Select one:
a. Binary tree
b. Trees
c. Graph
d. Stack
Question 13
Complete
Mark 1 out of 1

Flag question

Question text

Which of the following is non-linear data structure?


Select one:
a. List
b. Trees
c. Strings
d. Stacks

Question 14
Complete
Mark 1 out of 1

Flag question

Question text

____________________ is not the component of data structure.


Select one:
a. Storage structures
b. Algorithms
c. None of these
d. Operations

Question 15
Complete
Mark 1 out of 1

Flag question
Question text

Identify the data structure which allows deletions at both ends of the list but
insertion at only one end.
Select one:
a. Output restricted dequeue
b. Stack
c. Input restricted dequeue
d. Priority queues

Question 16
Complete
Mark 1 out of 1

Flag question

Question text

A binary search tree whose left subtree and right subtree differ in height by at
most 1 unit is called ____________________.
Select one:
a. Red-black tree
b. AVL tree
c. Lemma tree
d. None of these

Question 17
Complete
Mark 1 out of 1

Flag question

Question text

A binary tree is a tree in which each node can have zero, one, or two children.
Select one:
True
False

Question 18
Complete
Mark 0 out of 1

Flag question

Question text

What is written by the following algorithm?


Push(myStack, 5)
Push(myStack, 4)
Push(myStack, 4)
Pop(myStack, item)
Pop(myStack, item)
Push(myStack, item)
WHILE (NOT IsEmpty(myStack))
Pop(myStack, item)
Write item, ' '
25
Answer:

Question 19
Complete
Mark 1 out of 1

Flag question

Question text

Indicate which structure would be a more suitable choice for each of the
following applications.
A program to maintain the routes in an airline.
Select one:
a. Stack
b. Binary search tree
c. Queue
d. Graph
e. Tree

Question 20
Complete
Mark 1 out of 1

Flag question

Question text

Indicate which structure would be a more suitable choice for each of the
following applications.

A program to receive data that is to be saved and processed in the reverse


order.
Select one:
a. Queue
b. Binary search tree
c. Stack
d. Graph
e. Tree

Question 21
Complete
Mark 1 out of 1

Flag question

Question text

The following algorithm is a count-controlled loop going from 1 through 5. At


each iteration, the loop counter is either printed or put on a queue depending on
the result of Boolean function RanFun(). (The behavior of RanFun() is
immaterial.) At the end of the loop, the items on the queue are dequeued and
printed. Because of the logical properties of a queue, this algorithm cannot
print certain sequences of the values of the loop counter. You are given an
output and asked if the algorithm could generate the output.
Set count to 0
WHILE (count < 5)
Set count to count + 1
IF (RanFun())
Write count, ' '
ELSE
Enqueue(myQueue, count)
WHILE (NOT IsEmpty(myQueue))
Dequeue(myQueue, number)
Write number, ' '
The following output is possible using a queue: 1 3 5 2 4

Select one:
True
False

Question 22
Complete
Mark 1 out of 1

Flag question

Question text

____________________ level is where the model becomes compatible executable


code.
Select one:
a. Abstract level
b. Application level
c. All of these
d. Implementation level

Question 23
Complete
Mark 1 out of 1
Flag question

Question text

Indicate which structure would be a more suitable choice for each of the
following applications.
A dictionary of words used by a spelling checker to be built and maintained.
Select one:
a. Tree
b. Binary search tree
c. Stack
d. Graph
e. Queue

Question 24
Complete
Mark 1 out of 1

Flag question

Question text

Indicate which structure would be a more suitable choice for each of the
following applications.

A bank simulation of its teller operation to see how waiting times would be
affected by adding another teller.
Select one:
a. Queue
b. Stack
c. Graph
d. Binary search tree
e. Tree

Question 25
Complete
Mark 1 out of 1

Flag question

Question text

Indicate which structure would be a more suitable choice for each of the
following applications.
A word processor to have a PF key that causes the preceding command to be
redisplayed. Every time the PF key is pressed, the program is to show the
command that preceded the one currently displayed
Select one:
a. Graph
b. Stack
c. Queue
d. Tree
e. Binary search tree

Question 26
Complete
Mark 1 out of 1

Flag question

Question text

Indicate which structure would be a more suitable choice for each of the
following applications.
A program to keep track of the soccer teams in a city tournament
Select one:
a. Queue
b. Graph
c. Binary search tree
d. Stack
e. Tree
Question 27
Complete
Mark 1 out of 1

Flag question

Question text

Which data structure allows deleting data elements from and inserting at rear?
Select one:
a. dequeues
b. binary search tree
c. stacks
d. queues

Question 28
Complete
Mark 1 out of 1

Flag question

Question text

Inserting an item into the stack when stack is not full is called ____________ while
operation and deletion of item from the stack, when stack is not empty is called
________________ operation.
Select one:
a. pop, push
b. push, pop
c. delete, insert
d. insert, delete

Question 29
Complete
Mark 1 out of 1
Flag question

Question text

What is written by the following algorithm?


Enqueue(myQueue, 5)
Enqueue(myQueue, 4)
Enqueue(myQueue, 4)
Dequeue(myQueue, item)
Dequeue(myQueue, item)
Enqueue(myQueue, item)
WHILE (NOT IsEmpty(myQueue))
Dequeue(myQueue, item)
Write item, ' '
44
Answer:

Question 30
Complete
Mark 1 out of 1

Flag question

Question text

Binary search trees are ordered.


Select one:
True
False

Question 31
Complete
Mark 1 out of 1

Flag question

Question text
A leaf in a tree is a node with no children.
Select one:
True
False

Question 32
Complete
Mark 1 out of 1

Flag question

Question text

Draw the binary search tree whose elements are inserted in the following order:
50 72 96 94 107 26 12 11 9 2 10 25 51 16 17 95
If Print is applied to the tree formed above, in which order would the elements
be printed?
2 9 10 11 12 16 17 25 26 50 51 72 94 95 96 107
Answer:

Question 33
Complete
Mark 1 out of 1

Flag question

Question text

It is a pile in which items are added at one end and removed from the other.
Select one:
a. list
b. queue
c. none of these
d. stack

Question 34
Complete
Mark 0 out of 1
Flag question

Question text

The following algorithm is a count-controlled loop going from 1 through 5. At


each iteration, the loop counter is either printed or put on a queue depending on
the result of Boolean function RanFun(). (The behavior of RanFun() is
immaterial.) At the end of the loop, the items on the queue are dequeued and
printed. Because of the logical properties of a queue, this algorithm cannot
print certain sequences of the values of the loop counter. You are given an
output and asked if the algorithm could generate the output.
Set count to 0
WHILE (count < 5)
Set count to count + 1
IF (RanFun())
Write count, ' '
ELSE
Enqueue(myQueue, count)
WHILE (NOT IsEmpty(myQueue))
Dequeue(myQueue, number)
Write number, ' '
The following output is possible using a queue: 1 3 5 4 2

Select one:
True
False

Question 35
Complete
Mark 1 out of 1

Flag question

Question text
A stack displays FIFO behavior.
Select one:
True
False

Question 36
Complete
Mark 1 out of 1

Flag question

Question text

The value in the right child of a node (if it exists) in a binary search tree will be
greater than the value in the node itself.
Select one:
True
False

Question 37
Complete
Mark 1 out of 1

Flag question

Question text

Indicate which structure would be a more suitable choice for each of the
following applications.
A program to keep track of patients as they check into a medical clinic,
assigning patients to doctors on a first-come, first-served basis.
Select one:
a. Queue
b. Stack
c. Binary search tree
d. Tree
e. Graph
Question 38
Complete
Mark 1 out of 1

Flag question

Question text

Which of the following data structure is non-linear type?


Select one:
a. Stacks
b. Strings
c. Graph
d. Lists

Question 39
Complete
Mark 1 out of 1

Flag question

Question text

A binary search tree is another name for a binary tree.


Select one:
True
False

Question 40
Complete
Mark 1 out of 1

Flag question

Question text
A queue displays LIFO behavior.
Select one:
True
False

Question 41
Complete
Mark 1 out of 1

Flag question

Question text

A binary search cannot be applied to a tree.


Select one:
True
False

Question 42
Complete
Mark 1 out of 1

Flag question

Question text

Indicate which structure would be a more suitable choice for each of the
following applications.
An electronic address book ordered by name
Select one:
a. Queue
b. Graph
c. Binary search tree
d. Tree
e. Stack

Question 43
Complete
Mark 1 out of 1

Flag question

Question text

On average, searching in a binary search tree is faster than searching in a list.


Select one:
True
False

Question 44
Complete
Mark 1 out of 1

Flag question

Question text

In a graph, the vertices represent the items being modeled.


Select one:
True
False

Question 45
Complete
Mark 1 out of 1

Flag question

Question text

Indicate which structure would be a more suitable choice for each of the
following applications.
A program keeping track of where canned goods are located on a shelf.
Select one:
a. Queue
b. Tree
c. Binary search tree
d. Stack
e. Graph

Question 46
Complete
Mark 1 out of 1

Flag question

Question text

Which data structure is used in breadth first search of a graph to hold nodes?
Select one:
a. Stack
b. Tree
c. Queue
d. Array

Question 47
Complete
Mark 1 out of 1

Flag question

Question text

The value in the left child of a node (if it exists) in a binary search tree will be
greater than the value in the node itself.
Select one:
True
False

Question 48
Complete
Mark 1 out of 1
Flag question

Question text

Herder node is used as sentinel in __________________.


Select one:
a. Binary tree
b. Graphs
c. Stacks
d. Queues

Question 49
Complete
Mark 1 out of 1

Flag question

Question text

A stack and a queue are different names for the same ADT.
Select one:
True
False

Question 50
Complete
Mark 1 out of 1

Flag question

Question text

Indicate which structure would be a more suitable choice for each of the
following applications.
A program to keep track of family relationships
Select one:
a. Tree
b. Stack
c. Binary search tree
d. Queue
e. Graph

You might also like