ADS CCEE Mock
Test1
Total points 29/40
0 of 0 points
Name: *
Nitesh Dilip awati
Centre: *
Juhu
Kharghar
PRN: *
230340320063
MCQ 29 of 40 points
The worst-case time complexity *1/1
for the linear search algorithm
is….
O(n)
O(log n)
O(n²)
O(n log n)
We use a dynamic programming *0/1
approach when
We need an optimal solution
The solution has an optimal
substructure
The given problem can be reduced to
the 3-SAT problem
It’s faster than Greedy
Correct answer
The solution has an optimal
substructure
What is a memory-efficient *1/1
double-linked list?
Each node has only one pointer to
traverse the list back and forth
The list has breakpoints for faster
traversal
An auxiliary singly linked list acts as a
helper list to traverse through the
doubly linked list
None of the mentioned
Consider a binary max-heap *1/1
implemented using an array.
Which one of the following
arrays represents a binary max-
heap?
25,12,16,13,10,8,14
25,14,16,13,10,8,12
25,16,12,13,10,8,14
25,14,12,13,10,8,16
Let H be a binary min-heap *1/1
consisting of n elements
implemented as an array. What
is the worst-case time
complexity of an optimal
algorithm to find the maximum
element in H?
Ө(1)
Ө(log n)
Ө(n)
Ө(n log n)
A hash function h defined *1/1
h(key)=key mod 7, with linear
probing, is used to insert the
keys 44, 45, 79, 55, 91, 18, and
63 into a table indexed from 0 to
6. What will be the location of
key 18?
6
Which of the following algorithm *1/1
design techniques is used in
finding all pairs of shortest
distances in a graph ( Warshall
algorithms)?
Dynamic programming
Back Tracking
Greedy
Divide & Conquer
The recurrence relation *1/1
capturing the optimal time of the
Tower of Hanoi problem with n
discs is.---
T(n) = 2T(n-2)+2
T(n) = 2T(n-1)+n
T(n) = 2T(n/2)+1
T(n) = 2T(n-1)+1
In which of the following tree do *1/1
the height of the left subtree and
the height of the right subtree
differ at most by one?
AVL Tree
Expression Tree
Threaded Binary Tree
Binary Search Tree
Statement 1: When applying the *0/1
Backtracking algorithm, all
choices made can be undone
when needed.
Statement 2: When applying the
Backtracking algorithm, the
worst-case scenario is, that it
exhaustively tries all paths,
traversing the entire search
space
Both, Statements 1 and 2, are true
Statement 1 is true, Statement 2 is
false
Statement 2 is true, Statement 1
is false
Both, Statements 1 and 2, are false
Correct answer
Both, Statements 1 and 2, are true
Consider the following *1/1
undirected graph with edge
weights as shown:
The number of minimum-weight
spanning trees of the graph is ----
2
Which of the following types of *1/1
Linked List support forward and
backward traversal?
Singly Linked List
Doubly Linked List
Circular Singly Linked List
All of these
Suppose prevnode, p, nextnode *0/1
are three consecutive nodes in a
Doubly Linked List. Deletion of
node p in this Doubly Linked List
can be represented by which
code snippet?
[getPrev() method returns the
prev node and getNext() method
returns the next node in DLL.]
[SetPrev() method sets the prev
node value and setNext()
method sets the next node value
in DLL.]
p.getPrev().setPrev(p.getNext());
p.getNext().setNext(p.getPrev());
p.getPrev().setNext(p.getPrev());
p.getNext().setPrev(p.getNext());
p.getNext().setPrev(p.getPrev());
p.getPrev().setNext(p.getNext());
None of the above
Correct answer
p.getNext().setPrev(p.getPrev());
p.getPrev().setNext(p.getNext());
Let ‘m’ and ‘n’ be the number of *1/1
edges and vertices in a graph G,
respectively. Which of the
following is the time complexity
of Kruskal's algorithm to find the
minimum spanning tree of G?
O(n log n)
O(m log m)
O(n2)
O(m2)
The integrity of transmitted data *1/1
can be verified by using ……
Hash Message Authentication
Code (HMAC)
Timestamp comparison
Data length comparison
None of these
In the worst case, the number of *1/1
comparisons needed to search a
singly linked list of length n for a
given element is
O(log2 n)
O(n/2)
O(log2 n – 1)
O(n)
What is the best method to go *1/1
for the game-playing problem?
Optimal Search
Random Search
Heuristic Search
Stratieed Search
The postfix equivalent of prefix *0/1
expression * + a b – c d is
ab+cd-*
abcd+-*
ab+cd*-
ab+-cd*
Correct answer
ab+cd-*
Which is the safest method to *0/1
choose a pivot element?
Choosing a random element as a
pivot
Choosing the erst element as a pivot
Choosing the last element as a pivot
Median-of-three partitioning
method
Correct answer
Choosing a random element as a pivot
Which of the following algorithm *1/1
solves the all-pair shortest path
algorithm?
Prim’s algorithm
Dijkstra's algorithm
Bellman-Ford algorithm
Floyd-Warshall’s algorithm
The value returned by Hash *1/1
Function is called as…….
Digest
Hash value
Hash code
All of these
Which of the following are not *1/1
Associative Containers?
priority queue
map
multimap
multiset
Which one of the following is the *1/1
tightest upper bound that
represents the time complexity
of inserting an object into a
binary search tree of n nodes?
O(1)
O(logn)
O(n)
O(nlogn)
What are the time complexities *0/1
of finding the 8th element from
the beginning and the 8th
element from the end in a singly
linked list? Let n be the number
of nodes in a linked list, you may
assume that n > 8.
O(1) and O(n)
O(1) and O(1)
O(n) and O(1)
O(n) and O(n)
Correct answer
O(1) and O(n)
Depth First Search graph *1/1
traversal method makes use of
………. data structure.
Tree
Stack
Queue
Linked list
The height of a binary tree is the *1/1
maximum number of edges in
any root-to-leaf path. The
maximum number of nodes in a
binary tree of height h is:
2^h -1
2^(h-1) – 1
2^(h+1) -1
2*(h+1)
Consider the following array. *1/1
23,32,45,69,72,73,89,97
Which algorithm out of the
following options uses the least
number of comparisons (among
the array elements) to sort the
above array in ascending order?
Selection sort
Merge sort
Insertion sort
Quicksort using the last element as a
pivot
If you want to store the name *0/1
and marks of N students, which
of the following is the correct
choice?
An array of structures that contains
names and marks as a eeld.
A structure containing arrays of
Names and arrays of Marks
An array of names and an Array of
marks
All of the above
Correct answer
An array of structures that contains
names and marks as a eeld.
Let A[1...n] be an array of n *0/1
distinct numbers. If i < j and A[i]
> A[j], then the pair (i, j) is called
an inversion of A. What is the
expected number of inversions
in any permutation on n
elements?
n(n-1)/2
n(n-1)/4
n(n+1)/4
2n[logn]
Correct answer
n(n-1)/4
A complete n-ary tree is a tree in *1/1
which each node has n children
or no children. Let I be the
number of internal nodes and L
be the number of leaves in a
complete n-ary tree. If L = 41,
and I = 10, what is the value of
n?
A tree node with no children is *1/1
called a…………. node.
Leaf node
Root node
Parent node
Ancestor node
A digraph is said to be *0/1
COMPLETE, if it has N vertices
and ………edges.
N*N
N-1
N*(N-1)
N*(N-1)/2
Correct answer
N*(N-1)
The time required to search an *1/1
element in a linked list of length
n is
O(log n)
O(n)
O(1)
O(n2)
In the worst case, the number of *1/1
comparisons needed to search a
singly linked list of length n for a
given element is---
log2 n
n/2
log2 (n-1)
Which of the following is True *1/1
about the Spanning Tree?
A spanning is a minimal set of
edges in a graph that contains no
cycle, connects all the vertices
A spanning is a maximal set of edges
in a graph that connects all vertices.
A Graph will have only one possible
spanning tree
None of the above
Consider the following sequence *1/1
of operations on an empty stack
indicated by ‘S’.
Push(54);push(52);pop();push(5
5);push(62);s=pop();
Consider the following
sequence of operations on an
empty queue indicated by ‘Q’
enqueuer(21);
enqueuer(24);
dequeuer();
enqueuer(28);
enqueuer(32);
q=dequeuer();
The value of ( S+Q ) is ---------
62
24
86
68
What would be the order in *0/1
which edges are added to form
a minimum spanning tree using
Kruskal’s and Prim’s algorithms
for the following graph:
Kruskal’s - AB CD CF AE FE and Prim’s
- AB AE FE CF CD
Kruskal’s - AB CD CF FE AE and Prim’s
– AB AE FE CF CD
Kruskal’s - AB CD CF FE AE and Prim’s
- AB AE FE CD CF
Kruskal’s – CD AB CF FE AE and
Prim’s - AB AE FE CF CD
Correct answer
Kruskal’s - AB CD CF FE AE and Prim’s
– AB AE FE CF CD
Let G = (V, G) be a weighted *1/1
undirected graph and let T be a
Minimum Spanning Tree (MST)
of G maintained using adjacency
lists. Suppose a new weighed
edge (u, v) ∈ V×V is added to G.
The worst-case time complexity
of determining if T is still an
MST of the resultant graph is
Θ(∣E∣ + ∣V∣)
Θ(∣E∣.∣V∣)
Θ(E∣ log ∣V∣)
Θ(∣V∣)
Which one of the following is an *1/1
application of Stack Data
Structure?
Managing function calls
The stock span problem
Arithmetic expression evaluation
All of the above
Identify the correct sequence of *0/1
the below actions for
implementing decisions?
I. Create an action plan
II. Prioritize actions and assign
roles
III. Break solution into action
steps
IV. Follow‐up at milestones
I, III, II, IV
I, II, III, IV
I, IV, II, III
IV, III, II, I
Correct answer
I, III, II, IV
This content is neither created nor endorsed by Google. -
Terms of Service - Privacy Policy
Forms
ADS Mock CCEE
Total points 25/40
Questions : 40 Time : 40 Minutes
0 of 0 points
PRN (12 Digits) *
230340320063
Center *
Kharghar
Name *
Nitesh Dilip awati
Questions 25 of 40 points
Which of the following *0/1
statements for a simple graph is
correct?
a) Every trail is a path
b) Every path is a trail
c) Every trail is a path as well as every
path is a trail
d) None of the above mentioned
Correct answer
b) Every path is a trail
The complexity of the Binary *1/1
search algorithm is
a) O(n)
b) O(log n)
c) O(n^2)
d) O(n log n)
What is the time complexity of *1/1
enqueue and dequeue
operations in a circular queue of
size n?
a) O(1)
b) O(log n)
c) O(n)
d) O(n^2)
What is the value of the postfix *1/1
expression 6 3 2 4 + - *
40
74
-18
The postfix form of the *0/1
expression (A+ B)*(C*D- E)*F / G
is?
a) AB+ CD*E – FG /**
b) AB + CD* E – F **G /
c) AB + CD* E – *F *G /
d) AB + CDE * – * F *G /
Correct answer
c) AB + CD* E – *F *G /
Which of the following is the *1/1
correct order of complexity from
the best to the worst?
a) O(1), O(log n), O(n), O(n log n),
O(n^2), O(2^n), O(n!)
b) O(n!), O(1), O(log n), O(n log n),
O(2^n), O(n^2), O(n)
c) O(log n), O(1), O(n log n), O(2^n),
O(n), O(n!), O(n^2)
d) O(1), O(n), O(n!), O(log n), O(2^n),
O(n^2), O(n log n)
Which of the following is not the *1/1
type of queue?
a) Ordinary queue
b) Single ended queue
c) Circular queue
d) Priority queue
What is the height of a complete *0/1
binary tree with n nodes?
a) log(n)
b) n/2
c) log(n+1)
d) n
Correct answer
c) log(n+1)
Kruskal’s algorithm is used to *1/1
______
a) find minimum spanning tree
b) find single source shortest path
c) find all pair shortest path algorithm
d) traverse the graph
Prim’s algorithm is a ______ * 1/1
a) Divide and conquer algorithm
b) Greedy algorithm
c) Dynamic Programming
d) Approximation algorithm
What is the disadvantage of *1/1
selection sort?
a) It requires auxiliary memory
b) It is not scalable
c) It can be used for small keys
d) It takes linear time to sort the
elements
What will be the position of the *1/1
array after 2 iterations of bubble
sort?
arr - {5,4,3,2,1}
12345
43215
32145
21345
What are the disadvantages of *0/1
recursion?
a) Increased memory usage due to
multiple function calls.
b) Potential for stack overflow if
recursion depth is too high.
c) Slower execution compared to
iterative approaches.
d) Limited applicability to certain
problems.
Correct answer
a) Increased memory usage due to
multiple function calls.
In a circular queue of size n, if *1/1
the front and rear pointers are
initially pointing at the same
location, what will be the
condition to check if the queue
is full?
a) (rear + 1) % n == front
b) (front + 1) % n == rear
c) (rear - front + 1) % n == 0
d) (front - rear + 1) % n == 0
What will be output of the code? *0/1
int[][] matrix = new int[3][3];
System.out.println(matrix.length
);
a) 3
b) 6
c) 9
d) Error: NullPointerException
Correct answer
a) 3
A flowchart needs to represent a *1/1
situation where the user is
asked to enter his age, the age is
read into the system, and the
system outputs a 'Thank You'
message.
This is an example of which of
the algorithm constructs?
Decision
Loop
Sequence
All of the above
Which of the following data *0/1
structures is suitable for
implementing a LRU (Least
Recently Used) cache?
a) Array
b) Stack
c) Queue
d) Linked List
Correct answer
c) Queue
What is the number of edges *0/1
present in a complete graph
having n vertices?
a) (n*(n+1))/2
b) (n*(n-1))/2
c) n
d) n(n*1)/2
Correct answer
b) (n*(n-1))/2
Consider the following heap *0/1
after buildheap phase. What will
be its corresponding array?
(What will be MAX HEAP)
a) 26,53,41,97,58,59,31
b) 26,31,41,53,58,59,97
c) 26,41,53,97,31,58,59
d) 97,53,59,26,41,58,31
Correct answer
d) 97,53,59,26,41,58,31
How many times is the *1/1
recursive function called, when
the following code is executed?
public class Main
{
static void
my_recursive_function(int n){
if(n == 0)
return;
System.out.printf("%d ",n);
my_recursive_function(n-1);
}
public static void
main(String[] args) {
my_recursive_function(
10);
}
}
a) 9
b) 10
c) 11
d) 12
Which of the following is not a *0/1
characteristic of a good
algorithm?
a) Correctness
b) Efficiency
c) Complexity
d) Simplicity
Correct answer
c) Complexity
Which of the following sorting *1/1
algorithms has the best average-
case time complexity?
a) Bubble Sort
b) Insertion Sort
c) Quicksort
d) Selection Sort
How many swaps are required *0/1
to sort the given array using
bubble sort – { 2, 5, 1, 3, 4}
a) 4
b) 6
c) 8
d) 5
Correct answer
a) 4
Consider an implementation of *1/1
unsorted singly linked list.
Suppose it has its
representation with a head
pointer only.
Given the representation, which
of the following operation can
be implemented in O(1) time?
i) Insertion at the front of the
linked list
ii) Insertion at the end of the
linked list
iii) Deletion of the front node of
the linked list
iv) Deletion of the last node of
the linked list
a) I and II
b) I and III
c) I, II and III
d) I, II and IV
In a binary tree, the maximum *1/1
number of nodes at level i is
given by:
a) 2^i
b) i^2
c) 2^(i-1)
d) i+1
How can we measure the time *1/1
factor when determining the
efficiency of the algorithm?
a) Counting microseconds
b) Counting the number of key
operations
c) Counting the number of
statements
d) Counting the kilobytes of algorithm
What is the time complexity of *0/1
the best-case scenario for most
sorting algorithms?
a) O(1)
b) O(log n)
c) O(n)
d) O(n log n)
Correct answer
d) O(n log n)
How does function complexity *0/1
change during recursion?
a) The function complexity
remains constant throughout the
recursion process.
b) The function complexity increases
with each recursive call.
c) The function complexity decreases
with each recursive call.
d) The function complexity is not
affected by recursion.
Correct answer
b) The function complexity increases
with each recursive call.
What is the maximum number of *1/1
edges in a complete binary tree
with N nodes?
a) N
b) N - 1
c) 2N - 1
d) 2N
What is the time complexity of *1/1
removing an element from the
middle of an ArrayList?
a) O(1)
b) O(log n)
c) O(n)
d) O(n^2)
Which of the following sorting *1/1
algorithms is the most stable?
a) Selection sort
b) Insertion sort
c) Bubble sort
d) Merge sort
From the given expression tree, *1/1
identify the infix expression,
evaluate it and choose the
correct result.
a) 5
b) 10
c) 12
d) 16
Which of the following methods *0/1
is used to insert an element at a
specific index in an ArrayList?
a) add(int index, E element)
b) insert(int index, E element)
c) add(E element, int index)
d) insert(E element, int index)
Correct answer
a) add(int index, E element)
Which of the following is a post- *1/1
order traversal of a binary tree?
a) Diagonal traversal
b) Boundary traversal
c) Breadth-first traversal
d) Depth-first traversal
Time Complexity of Breadth *1/1
First Search is? (V – number of
vertices, E – number of edges)
a) O(V + E)
b) O(V)
c) O(E)
d) O(V*E)
Insert and remove items from a *0/1
heap costs?
a) O(n)
b) O(n^2)
c) O(logn)
d) O(1)
Correct answer
d) O(1)
Which of the following sorting *0/1
algorithms is the most efficient
for sorting a small list of
elements?
a) Selection sort
b) Insertion sort
c) Bubble sort
d) Quicksort
Correct answer
b) Insertion sort
Which of the following sorting *1/1
algorithms can be used to sort a
random linked list with minimum
time complexity?
a) Merge Sort
b) Insertion Sort
c) Quick Sort
d) Heap Sort
What does the following piece *1/1
of code do?
for (int j = i+1; j < arr.length;
j++)
{
if( (arr[i].equals(arr[j])) && (i
!= j) )
{
System.out.println(arr[i]);
}
}
a) Print the duplicate elements in
the array
b) Print the element with maximum
frequency
c) Print the unique elements in the
array
d) Prints the element with minimum
frequnecy
What will be the position of the *1/1
array after 2 iterations of
insertion sort?
arr - {5,4,3,2,1}
12345
23451
34521
45321
0 of 0 points
Feedback *
Exam patter is tought but good exprience for
prepration of CCEE
This content is neither created nor endorsed by Google. -
Terms of Service - Privacy Policy
Forms