NEW
Font size
WorksheetsMajor Data Structures and Algorithm
Total questions: 80
Worksheet time: 2hrs 31mins
What is an algorithm?
A way to store and organize data
A well-defined computational procedure
A collection of data values
An operation used to measure time complexity
What is a data structure?
A way to store and organize data
A well-defined computational procedure
A collection of data values
An operation used to measure time complexity
Which of the following is NOT a common data structure?
Array
Linked List
Stack
Database
What is the time complexity of an algorithm?
The number of operations used by the algorithm
The size of the input and the use of many structures in a program
The comparison of integers and different algorithms in a program
The addition of integers
What is the purpose of algorithm analysis?
To define and familiarize algorithms
To measure the time complexity of algorithms
To store and organize data
To solve a problem
What is the purpose of big-Θ notation?
To define and familiarize algorithms
To measure the time complexity of algorithms
To store and organize data
To solve a problem
What is a linked list?`
A linear collection of data elements
A data structure consisting of a group of nodes
A sequence of nodes
A collection of elements with linear order
Nodes in a linked list contain two things
Direction and a pointer
Data and a pointer
A Pointer and a reference
A pointer and a node
What advantage does a linked list have over an array?
Size of the list doesn't need to be mentioned at the beginning of the program
The linked list doesn't have a size limit
You can add or remove elements from the middle of the list.
All of these are true.
A linked list contains a list pointer variable _____that stores the address of the first node of the list.
Head
NULL
NEXT
LAST
What is the time complexity to count the number of elements in the linked list?
O(1)
O(n)
O(log n)
none of these
Each Node contain minimum two fields one field called data field to store data. Another field is of type _________.
A
pointer to an integer
pointer to a node
pointer to a class
pointer to a character
What is the time complexity to adding an elements in front of the linked list?
O(1)
O(n)
O(log n)
none of these
The situation when in a linked list START=NULL is
underflow
overflow
list full
saturated
A linear dynamic data structure to store data items is called
Linked list
Stack
Tree
Queue
An item in linked list is called
Node
Head
Tail
Pointer
The first and last node is called
Head and tail
Head and leg
Eye and tail
Eye and leg
Which one is the advantage of linked list:
- 1 Linked list random access is not allowed
- Linked lists need more memory
- Linked lists have dynamic size
3
1
2 and 3
1, 2, and 3
Which one is the disadvantage of linked list:
- Linked lists have dynamic size
- Linked lists cannot randomly access
- Linked lists are linked with pointer
2
1
1 and 3
1, 2, and 3
Which one of these pictures is the insertion in the middle of linked list
Which are the correct statements?
- Linked List insertion of new element is expensive
- Linked list random access is not possible
- Linked List need extra memory space for next pointer
1 and 2
1 and 3
2 and 3
1
Stacks have LIFO ordering
TRUE
FALSE
The postfix form of the expression (A+ B)*(C*D- E)*F / G is?
AB + CDE * - * F *G /
AB+ CD*E - FG /**
AB + CD* E - F **G /
AB + CD* E - *F *G /
Which of them is an abstract data structure (ADT)?
Stacks
Functions
Queues
Both A and C
LIFO stands for
List of Outputs
Last in First Out
First in Last Out
None of them
Act of adding values into a stack is called
Popping
Polling
Pushing
None
The postfix form of A*B+C/D is?
*AB/CD+
AB*CD/+
A*BC+/D
ABCD+/*
The prefix form of A-B/ (C * D ⋀ E) is?
-/*⋀ACBDE
-ABCD*⋀DE
-A/B*C⋀DE
-A/BC*⋀DE
Which of the following statement(s) about stack data structure is/are NOT correct?
Stack data structure can be implemented using linked list
New node can only be added at the top of the stack
Stack is the FIFO data structure
The last node at the bottom of the stack has a NULL link
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?
ABCD
DCBA
DCAB
ABDC
What will be the postfix form of the above expression -
(A+B)∗(C∗D-E)∗F/G
None of these
A B + C D ∗ E − F G ∗ / ∗
A B + C D E ∗ − F G / ∗ ∗
A B + C D ∗ E − F G / ∗ ∗
A queue is called a FIFO data structure?
True
False
a QUEUE in a computer acts just like people queuing for a bus - the first person in queue is going to be the first to get on the bus.
True
False
A Queue can only store 6 data items. The Queue is sent 4 data items: Bert, Cynthia, Cedric and Albert. Where does the "Front" pointer point?
Bert
Cynthia
Cedric
Albert
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?
Bert
Cynthia
Cedric
Albert
is a linear structure that follows a particular order in which the operations are performed. The order is First In First Out (FIFO).
Queue
Stack
Array
tabulation
Which is the correct operation for:
"Add a item to the rear of the queue."
enQueue(item)
Append.Queue(item)
enQueue()
AddItem(EnQueue())
In queue, an element can be inserted in location pointed by
top
front (or head)
rear (or tail)
none of the above
What is the value of the ROOT node in this Tree?
35
24
42
20
Binary TREE
data structure similar to a graph, with no loops.
an object in a graph also known as a vertex
a join of relationship between nodes - also know as an arc
a tree where each node can only have 2 child nodes attached to it
How many leaf are there in the tree?
1
3
4
7
What are the 3 depth traversals for a tree data structure?
Pre-, In- and Post-order
Pro-, In- and Past-order
Pre-, Out- and Post-order
Pre-, In- and New-order
When traversing a binary tree, which diagram is post-order?
What is the degree of a vertex in an undirected graph?
The number of edges incident on the vertex
The number of vertices connected to the vertex
The length of the shortest path to the vertex
The weight of the vertex
It is a graph in which edges do not have any direction
Connected graph
Trivial graph
Undirected graph
null graph
A graph in which edge has direction. That is the nodes are ordered pairs in the definition of every edge.
Directed graph
undirected graph
Connected graph
Regular graph
A graph in which vertex can be divided into two sets such that vertex in each set does not contain any edge between them.
Weighted graph
bipartite graph
Cyclic graph
connected graph
What is a cycle in a graph?
A path that visits each vertex exactly once
A path that starts and ends at the same vertex
A path with the minimum possible weight
A path with the minimum possible weight
When is a walk considered open?
.When there are no repeated edges
When the starting and ending vertices are the same
When the starting and ending vertices are the same
When the starting and ending vertices are different
What is a trail in a graph?
A closed walk with repeated edges
An open walk with no repeated edges
An open walk with no repeated vertices
A closed walk with no repeated vertices
How is a circuit different from a trail?
A circuit has repeated edges, while a trail does not
A circuit has repeated vertices, while a trail does not
A circuit is always open, while a trail is always closed
A circuit is always closed, while a trail is always open
When is a cycle formed in a graph?
When there are repeated vertices but no repeated edge
When there are repeated edges but no repeated vertices
When both vertices and edges are repeated, and the starting and ending vertices are the same
When both vertices and edges are repeated, and the starting and ending vertices are different
What is the purpose of Dijkstra's Algorithm?
Finding cycles in a graph
Finding the minimum spanning tree
Finding the shortest paths from a source vertex to all vertices
Detecting disconnected subgraphs
In Dijkstra's Algorithm, how is the shortest path tree (SPT) generated?
By including vertices with maximum distance values
By including vertices with minimum distance values
By including vertices randomly
By including vertices with maximum weight
What does BFS stand for in the context of graphs?
Best-First Search
Breadth-First Search
Binary-First Search
Balanced-First Search
When using Dijkstra's Algorithm, what is the purpose of the set "sptSet"?
To keep track of vertices included in the shortest path tree
To store the distances between vertices
To identify disconnected subgraphs
To maintain a list of all vertices in the graph
In Dijkstra's Algorithm, what does the distance value of a vertex represent?
The weight of the vertex
b The number of edges to reach the vertex from the source
The maximum distance to any vertex in the graph
The sum of distances from the source to that vertex
What is the primary purpose of a sorting algorithm?
To delete elements from an array
To search for a specific element in an array
To find the maximum element in an array
To rearrange elements based on a comparison operator
How does the Selection Sort algorithm work?
By repeatedly swapping adjacent elements
By dividing the array into two halves
By selecting the smallest element and moving it to the sorted portion
By recursively merging subarrays
What is an advantage of the Selection Sort algorithm?
It has a time complexity of O(N logN)
It works well on large datasets
It is stable
It is simple and easy to understand
How does Insertion Sort work?
By repeatedly swapping adjacent elements of the array
By recursively dividing the array
By selecting the smallest element
By splitting the array into sorted and unsorted parts
What is a drawback of Merge Sort?
It requires additional memory for the merged subarrays
It has a worst-case time complexity of O(N logN)
It is not stable
It is not suitable for large datasets
What is a characteristic of Quick Sort?
It is always a stable sort
It is not suitable for large datasets
It uses a divide-and-conquer approach
It requires additional memory for sorting
In the Partition Algorithm of Quick Sort, what is the role of the pivot?
What is an advantage of Quick Sort over other algorithms?
Which sorting algorithm works by repeatedly swapping adjacent elements if they are in the wrong order?
Selection Sort
Bubble Sort
Insertion Sort
Quick Sort
What is a characteristic of Merge Sort that makes it stable?
It uses a divide-and-conquer approach
It maintains the relative order of equal elements
It works well for large datasets
It has low time complexity for average cases
What characteristic makes Insertion Sort adaptive?
It is naturally parallelizable
It is stable
It is suitable for partially sorted datasets
It is suitable for partially sorted datasets
Consider a situation where swap operation is very costly. Which of the following sorting algorithms should be preferred so that the number of swap operations are minimized in general?
Selection Sort
Which of the following is not true about comparison-based sorting algorithms?
Suppose we are sorting an array of eight integers using quicksort, and we have just finished the first partitioning with the array looking like this: [5 1 7 9 12 11 10] Which statement is correct?
Which of the following sorting algorithms has the lowest worst-case complexity?
Which sorting algorithms is most efficient to sort string consisting of ASCII characters?
none of the options
For the given graph(G), which of the following statements is true?
A connected planar graph having 6 vertices, 7 edges contains _____________ regions.
Which of the following properties does a simple graph not hold?
Which of the following ways can be used to represent a graph?
Adjacency List and Adjacency Matrix
Incidence Matrix
Adjacency List, Adjacency Matrix as well as Incidence Matrix
All of the choices
What is the maximum number of edges in a bipartite graph having 10 vertices?
24
21
25
16
