Q. Which of the following operations is NOT efficient for a linked list?
-
A.
Insertion at head
-
B.
Insertion at tail
-
C.
Accessing an element by index
-
D.
Deletion of a node
Solution
Accessing an element by index in a linked list requires O(n) time, as it must traverse the list from the head.
Correct Answer:
C
— Accessing an element by index
Learn More →
Q. Which of the following operations is NOT efficient for linked lists?
-
A.
Insertion at head
-
B.
Insertion at tail
-
C.
Accessing an element by index
-
D.
Deletion from head
Solution
Accessing an element by index in a linked list requires O(n) time, as it must traverse the list sequentially.
Correct Answer:
C
— Accessing an element by index
Learn More →
Q. Which of the following operations is not efficient in a linked list?
-
A.
Insertion at the head
-
B.
Deletion from the tail
-
C.
Accessing an element by index
-
D.
Traversal
Solution
Accessing an element by index in a linked list requires traversal from the head, making it O(n) in time complexity.
Correct Answer:
C
— Accessing an element by index
Learn More →
Q. Which of the following operations is not O(log n) in an AVL tree?
-
A.
Insertion
-
B.
Deletion
-
C.
Searching
-
D.
Traversal
Solution
Traversal of an AVL tree is O(n) because it visits every node, while insertion, deletion, and searching are O(log n).
Correct Answer:
D
— Traversal
Learn More →
Q. Which of the following operations is NOT performed during the insertion in a Red-Black tree?
-
A.
Coloring the nodes
-
B.
Rotations
-
C.
Rebalancing
-
D.
Sorting the nodes
Solution
Sorting the nodes is not an operation performed during the insertion in a Red-Black tree.
Correct Answer:
D
— Sorting the nodes
Learn More →
Q. Which of the following operations is not performed during the insertion of a node in a Red-Black tree?
-
A.
Coloring the node
-
B.
Rotating the tree
-
C.
Rebalancing the tree
-
D.
Sorting the tree
Solution
Sorting the tree is not an operation performed during the insertion of a node in a Red-Black tree; the tree remains a binary search tree.
Correct Answer:
D
— Sorting the tree
Learn More →
Q. Which of the following operations is not performed in a Red-Black tree?
-
A.
Insertion
-
B.
Deletion
-
C.
Traversal
-
D.
Balancing
Solution
Traversal is not a specific operation unique to Red-Black trees; it is a general operation applicable to all tree structures.
Correct Answer:
C
— Traversal
Learn More →
Q. Which of the following operations is not supported by a queue?
-
A.
Enqueue
-
B.
Dequeue
-
C.
Peek
-
D.
Pop
Solution
The 'Pop' operation is not supported by a queue; it is associated with stacks. Queues use 'Enqueue' to add and 'Dequeue' to remove elements.
Correct Answer:
D
— Pop
Learn More →
Q. Which of the following operations is not supported by a standard stack?
-
A.
Push
-
B.
Pop
-
C.
Peek
-
D.
Dequeue
Solution
A standard stack supports push, pop, and peek operations, but does not support dequeue, which is an operation specific to queues.
Correct Answer:
D
— Dequeue
Learn More →
Q. Which of the following operations is NOT typically associated with a queue?
-
A.
Enqueue
-
B.
Dequeue
-
C.
Peek
-
D.
Push
Solution
The 'Push' operation is associated with stacks, while queues use 'Enqueue' to add and 'Dequeue' to remove elements.
Correct Answer:
D
— Push
Learn More →
Q. Which of the following operations is not typically associated with a stack?
-
A.
Push
-
B.
Pop
-
C.
Peek
-
D.
Dequeue
Solution
Dequeue is not associated with a stack; it is an operation related to queues.
Correct Answer:
D
— Dequeue
Learn More →
Q. Which of the following operations is not typically associated with stacks?
-
A.
Push
-
B.
Pop
-
C.
Peek
-
D.
Enqueue
Solution
Enqueue is an operation associated with queues, while stacks use push, pop, and peek operations.
Correct Answer:
D
— Enqueue
Learn More →
Q. Which of the following operations is NOT typically performed on a tree data structure?
-
A.
Insertion
-
B.
Deletion
-
C.
Traversal
-
D.
Sorting
Solution
Sorting is not a direct operation performed on a tree; trees are often used to facilitate sorting.
Correct Answer:
D
— Sorting
Learn More →
Q. Which of the following operations is NOT typically supported by a linked list?
-
A.
Insertion
-
B.
Deletion
-
C.
Access by index
-
D.
Traversal
Solution
Linked lists do not support direct access by index, which is a characteristic of arrays.
Correct Answer:
C
— Access by index
Learn More →
Q. Which of the following operations is performed to maintain the balance of an AVL tree?
-
A.
Insertion
-
B.
Deletion
-
C.
Rotation
-
D.
Traversal
Solution
Rotations (single or double) are performed to maintain the balance of an AVL tree after insertions or deletions.
Correct Answer:
C
— Rotation
Learn More →
Q. Which of the following operations is performed to maintain the balance of an AVL tree after insertion?
-
A.
Rotation
-
B.
Traversal
-
C.
Rearrangement
-
D.
Deletion
Solution
After an insertion in an AVL tree, rotations (single or double) are performed to maintain the balance property.
Correct Answer:
A
— Rotation
Learn More →
Q. Which of the following operations is typically O(1) for both stacks and queues?
-
A.
Accessing an element
-
B.
Inserting an element
-
C.
Removing an element
-
D.
All of the above
Solution
Removing an element (pop for stacks and dequeue for queues) is typically O(1) for both data structures.
Correct Answer:
C
— Removing an element
Learn More →
Q. Which of the following operations on a linked list has a time complexity of O(n)?
-
A.
Insertion at head
-
B.
Insertion at tail
-
C.
Deletion from head
-
D.
Searching for an element
Solution
Searching for an element in a linked list requires traversing the list, which takes O(n) time.
Correct Answer:
D
— Searching for an element
Learn More →
Q. Which of the following operations on a stack has a time complexity of O(1)?
-
A.
Push
-
B.
Pop
-
C.
Peek
-
D.
All of the above
Solution
All operations (Push, Pop, and Peek) on a stack are performed in constant time, O(1).
Correct Answer:
D
— All of the above
Learn More →
Q. Which of the following optimizations can be performed on intermediate code?
-
A.
Dead code elimination
-
B.
Lexical analysis
-
C.
Syntax checking
-
D.
Code generation
Solution
Dead code elimination is an optimization technique that can be applied to intermediate code to remove code that does not affect the program's output.
Correct Answer:
A
— Dead code elimination
Learn More →
Q. Which of the following optimizers is commonly used in training neural networks?
-
A.
Stochastic Gradient Descent
-
B.
K-Means
-
C.
Principal Component Analysis
-
D.
Support Vector Machine
Solution
Stochastic Gradient Descent (SGD) is a widely used optimizer for training neural networks.
Correct Answer:
A
— Stochastic Gradient Descent
Learn More →
Q. Which of the following optimizers is known for adapting the learning rate during training?
-
A.
SGD
-
B.
Adam
-
C.
RMSprop
-
D.
Adagrad
Solution
Adam (Adaptive Moment Estimation) adapts the learning rate based on the first and second moments of the gradients.
Correct Answer:
B
— Adam
Learn More →
Q. Which of the following parsing techniques can handle a larger class of grammars?
-
A.
LL parsing
-
B.
LR parsing
-
C.
Recursive descent parsing
-
D.
Predictive parsing
Solution
LR parsing can handle a larger class of grammars compared to LL parsing, including all deterministic context-free grammars.
Correct Answer:
B
— LR parsing
Learn More →
Q. Which of the following problems can be solved using a greedy algorithm?
-
A.
Knapsack problem
-
B.
Minimum spanning tree
-
C.
Shortest path in a graph
-
D.
All of the above
Solution
The minimum spanning tree can be solved using a greedy algorithm, while the knapsack problem is not always solvable by greedy methods.
Correct Answer:
B
— Minimum spanning tree
Learn More →
Q. Which of the following problems can be solved using BFS?
-
A.
Finding connected components in a graph
-
B.
Finding the longest path in a graph
-
C.
Finding the minimum spanning tree
-
D.
Finding the maximum flow in a flow network
Solution
BFS can be used to find connected components in an unweighted graph by exploring all reachable vertices from a starting vertex.
Correct Answer:
A
— Finding connected components in a graph
Learn More →
Q. Which of the following problems can be solved using DFS?
-
A.
Finding a path in a maze
-
B.
Finding the shortest path in a weighted graph
-
C.
Topological sorting
-
D.
All of the above
Solution
DFS can be used for finding paths in a maze and topological sorting, but not for finding the shortest path in a weighted graph.
Correct Answer:
C
— Topological sorting
Learn More →
Q. Which of the following problems can be solved using dynamic programming?
-
A.
Finding the maximum element in an array
-
B.
Calculating the Fibonacci sequence
-
C.
Sorting an array
-
D.
Searching for an element in a sorted array
Solution
The Fibonacci sequence can be efficiently calculated using dynamic programming by storing previously computed values to avoid redundant calculations.
Correct Answer:
B
— Calculating the Fibonacci sequence
Learn More →
Q. Which of the following problems can be solved using recursion?
-
A.
Finding the maximum element in an array
-
B.
Calculating the factorial of a number
-
C.
Sorting an array
-
D.
All of the above
Solution
All of the above problems can be solved using recursion.
Correct Answer:
D
— All of the above
Learn More →
Q. Which of the following properties is NOT true for a Red-Black tree?
-
A.
Every node is either red or black.
-
B.
The root is always black.
-
C.
All leaves (NIL nodes) are red.
-
D.
Red nodes cannot have red children.
Solution
In a Red-Black tree, all leaves (NIL nodes) are black, not red.
Correct Answer:
C
— All leaves (NIL nodes) are red.
Learn More →
Q. Which of the following properties is NOT true for Red-Black trees?
-
A.
Every node is either red or black.
-
B.
The root is always black.
-
C.
All leaves (NIL nodes) are red.
-
D.
Red nodes cannot have red children.
Solution
In Red-Black trees, all leaves (NIL nodes) are black, not red. This is one of the properties that helps maintain balance.
Correct Answer:
C
— All leaves (NIL nodes) are red.
Learn More →
Showing 2911 to 2940 of 3237 (108 Pages)