Q. Which data structure is best suited for implementing a playlist in a music application?
A.
Array
B.
Linked List
C.
Stack
D.
Queue
Show solution
Solution
A linked list is best suited for implementing a playlist because it allows for easy insertion and deletion of songs.
Correct Answer:
B
— Linked List
Learn More →
Q. Which data structure is best suited for implementing a priority queue?
A.
Array
B.
Linked List
C.
Heap
D.
Stack
Show solution
Solution
A heap is the most efficient data structure for implementing a priority queue, allowing for O(log n) insertion and deletion.
Correct Answer:
C
— Heap
Learn More →
Q. Which data structure is best suited for implementing a queue?
A.
Array
B.
Linked List
C.
Stack
D.
Both Array and Linked List
Show solution
Solution
Both arrays and linked lists can be used to implement a queue, as they can efficiently support FIFO operations.
Correct Answer:
D
— Both Array and Linked List
Learn More →
Q. Which data structure is best suited for implementing a stack?
A.
Array
B.
Linked List
C.
Both Array and Linked List
D.
None of the above
Show solution
Solution
Both arrays and linked lists can be used to implement stacks, as they both support LIFO (Last In First Out) operations.
Correct Answer:
C
— Both Array and Linked List
Learn More →
Q. Which data structure is commonly used to implement Dijkstra's algorithm?
A.
Stack
B.
Queue
C.
Priority Queue
D.
Array
Show solution
Solution
A priority queue is used in Dijkstra's algorithm to efficiently retrieve the next node with the smallest tentative distance.
Correct Answer:
C
— Priority Queue
Learn More →
Q. Which data structure is commonly used to implement the priority queue in Dijkstra's algorithm?
A.
Array
B.
Linked List
C.
Binary Heap
D.
Stack
Show solution
Solution
A binary heap is commonly used to implement the priority queue in Dijkstra's algorithm, allowing for efficient extraction of the minimum element.
Correct Answer:
C
— Binary Heap
Learn More →
Q. Which data structure is commonly used to represent the intermediate code in syntax-directed translation?
A.
Parse tree
B.
Abstract syntax tree
C.
Symbol table
D.
Control flow graph
Show solution
Solution
An abstract syntax tree is commonly used to represent the intermediate code in syntax-directed translation.
Correct Answer:
B
— Abstract syntax tree
Learn More →
Q. Which data structure is more efficient for implementing a queue?
A.
Array
B.
Linked List
C.
Stack
D.
Tree
Show solution
Solution
A linked list is more efficient for implementing a queue as it allows dynamic size and easy insertion/removal.
Correct Answer:
B
— Linked List
Learn More →
Q. Which data structure is more efficient for implementing a stack?
A.
Array
B.
Linked List
C.
Both are equally efficient
D.
None of the above
Show solution
Solution
While both can be used to implement a stack, a linked list is often more efficient for dynamic size management, as it does not require resizing like an array.
Correct Answer:
B
— Linked List
Learn More →
Q. Which data structure is more memory efficient for dynamic data storage?
A.
Array
B.
Linked List
C.
Stack
D.
Queue
Show solution
Solution
Linked lists are more memory efficient for dynamic data storage as they do not require a predefined size like arrays.
Correct Answer:
B
— Linked List
Learn More →
Q. Which data structure is more memory efficient for storing a collection of elements?
A.
Array
B.
Linked List
C.
Stack
D.
Queue
Show solution
Solution
Arrays are generally more memory efficient than linked lists because they do not require additional memory for pointers.
Correct Answer:
A
— Array
Learn More →
Q. Which data structure is more memory efficient for storing a list of elements with frequent insertions and deletions?
A.
Array
B.
Linked List
C.
Stack
D.
Queue
Show solution
Solution
Linked lists are more memory efficient for frequent insertions and deletions as they do not require resizing like arrays.
Correct Answer:
B
— Linked List
Learn More →
Q. Which data structure is more memory efficient for storing a list of elements?
A.
Array
B.
Linked List
C.
Both are equal
D.
None of the above
Show solution
Solution
Linked lists can be more memory efficient for dynamic lists since they do not require a contiguous block of memory like arrays.
Correct Answer:
B
— Linked List
Learn More →
Q. Which data structure is more memory efficient for storing a list of items with frequent insertions and deletions?
A.
Array
B.
Linked List
C.
Stack
D.
Queue
Show solution
Solution
Linked lists are more memory efficient for frequent insertions and deletions compared to arrays, which may require resizing.
Correct Answer:
B
— Linked List
Learn More →
Q. Which data structure is most suitable for implementing binary search?
A.
Linked List
B.
Array
C.
Stack
D.
Queue
Show solution
Solution
Binary search is most efficiently implemented on arrays due to their random access capabilities.
Correct Answer:
B
— Array
Learn More →
Q. Which data structure is used to implement a breadth-first search (BFS) algorithm?
A.
Stack
B.
Queue
C.
Array
D.
Linked List
Show solution
Solution
A Queue is used to implement the breadth-first search (BFS) algorithm to explore nodes level by level.
Correct Answer:
B
— Queue
Learn More →
Q. Which data structure is used to implement a queue?
A.
Array
B.
Linked List
C.
Both Array and Linked List
D.
None of the above
Show solution
Solution
A queue can be implemented using both arrays and linked lists, depending on the requirements.
Correct Answer:
C
— Both Array and Linked List
Learn More →
Q. Which data structure is used to implement BFS?
A.
Stack
B.
Queue
C.
Linked List
D.
Array
Show solution
Solution
BFS is implemented using a queue to keep track of the nodes to be explored.
Correct Answer:
B
— Queue
Learn More →
Q. Which data structure is used to implement depth-first search (DFS) in a binary tree?
A.
Queue
B.
Stack
C.
Array
D.
Linked List
Show solution
Solution
Depth-first search (DFS) is typically implemented using a stack.
Correct Answer:
B
— Stack
Learn More →
Q. Which data structure is used to implement depth-first search in a binary tree?
A.
Queue
B.
Stack
C.
Array
D.
Linked List
Show solution
Solution
Depth-first search in a binary tree is typically implemented using a stack.
Correct Answer:
B
— Stack
Learn More →
Q. Which data structure is used to implement recursion?
A.
Array
B.
Stack
C.
Queue
D.
Linked List
Show solution
Solution
Recursion is implemented using a stack, which keeps track of function calls and local variables.
Correct Answer:
B
— Stack
Learn More →
Q. Which data structure uses FIFO (First In First Out) principle?
A.
Stack
B.
Queue
C.
Array
D.
Linked List
Show solution
Solution
A Queue uses the FIFO principle, where the first element added is the first one to be removed.
Correct Answer:
B
— Queue
Learn More →
Q. Which data structure uses LIFO (Last In, First Out) principle?
A.
Queue
B.
Array
C.
Stack
D.
Linked List
Show solution
Solution
A stack uses the LIFO (Last In, First Out) principle.
Correct Answer:
C
— Stack
Learn More →
Q. Which data structure uses the Last In First Out (LIFO) principle?
A.
Queue
B.
Stack
C.
Array
D.
Linked List
Show solution
Solution
A stack uses the Last In First Out (LIFO) principle, where the last element added is the first one to be removed.
Correct Answer:
B
— Stack
Learn More →
Q. Which data structure would you use to implement a backtracking algorithm?
A.
Queue
B.
Stack
C.
Linked List
D.
Array
Show solution
Solution
A stack is used in backtracking algorithms to keep track of the previous states and to backtrack when necessary.
Correct Answer:
B
— Stack
Learn More →
Q. Which data structure would you use to implement a breadth-first search (BFS)?
A.
Stack
B.
Queue
C.
Linked List
D.
Array
Show solution
Solution
A queue is used to implement breadth-first search (BFS) because it processes nodes in the order they are discovered.
Correct Answer:
B
— Queue
Learn More →
Q. Which data structure would you use to implement a call stack?
A.
Queue
B.
Array
C.
Linked List
D.
Stack
Show solution
Solution
A call stack is implemented using a stack data structure, which allows for the last function called to be the first one to return (LIFO).
Correct Answer:
D
— Stack
Learn More →
Q. Which data structure would you use to implement a function call stack?
A.
Queue
B.
Array
C.
Stack
D.
Linked List
Show solution
Solution
A stack is used to implement a function call stack because it follows the LIFO principle, allowing the most recent function call to be completed first.
Correct Answer:
C
— Stack
Learn More →
Q. Which data structure would you use to implement a function that checks for balanced parentheses in an expression?
A.
Array
B.
Stack
C.
Queue
D.
Linked List
Show solution
Solution
A stack is the ideal data structure for checking balanced parentheses, as it allows for the last opened parenthesis to be matched with the next closing parenthesis.
Correct Answer:
B
— Stack
Learn More →
Q. Which data structure would you use to implement a function that checks for balanced parentheses?
A.
Array
B.
Stack
C.
Queue
D.
Linked List
Show solution
Solution
A stack is ideal for checking balanced parentheses because it allows you to match opening and closing symbols in the correct order.
Correct Answer:
B
— Stack
Learn More →
Showing 2191 to 2220 of 3237 (108 Pages)