OBJECTIVE ASSESSMENT EXAM 300 QUESTIONS AND
CORRECT DETAILED ANSWERS WITH RATIONALES
(VERIFIED ANSWERS) |AGRADE
Question 1
Which data structure uses a Last-In, First-Out (LIFO) principle?
A) Queue
B) Stack
C) Linked List
D) Array
E) Tree
Correct Answer: B) Stack
Rationale: A stack is an abstract data type that serves as a
collection of elements, with two principal operations: Push (adds an
element to the collection) and Pop (removes the most recently
added element). This behavior is known as LIFO.
Question 2
What is the time complexity of accessing an element by its index in an array?
A) O(n)
B) O(log n)
C) O(1)
D) O(n log n)
E) O(n^2)
Correct Answer: C) O(1)
Rationale: Arrays provide direct access to any element via its index
because elements are stored in contiguous memory locations. This
means the time to access any element is constant, regardless of the
array's size.
Question 3
Which algorithm divides the input array into two halves, recursively sorts
them, and then merges the two sorted halves?
A) Bubble Sort
B) Selection Sort
C) Insertion Sort
D) Merge Sort
E) Quick Sort
Correct Answer: D) Merge Sort
Rationale: Merge Sort is a divide-and-conquer algorithm that
recursively splits an array in half until individual elements remain,
then merges these sorted halves back together.
,Question 4
A binary tree in which each node has at most two children, and the left child
is always less than or equal to the parent, and the right child is always
greater than or equal to the parent, is called a:
A) Complete Binary Tree
B) Full Binary Tree
C) Binary Search Tree (BST)
D) Balanced Binary Tree
E) Heap
Correct Answer: C) Binary Search Tree (BST)
Rationale: A Binary Search Tree (BST) is a hierarchical data
structure where for any given node, all values in its left subtree are
less than or equal to the node's value, and all values in its right
subtree are greater than or equal to the node's value.
Question 5
What is the worst-case time complexity of searching for an element in an
unsorted array?
A) O(n)
B) O(log n)
C) O(1)
D) O(n log n)
E) O(n^2)
Correct Answer: A) O(n)
Rationale: In an unsorted array, you might have to check every
element in the worst-case scenario (if the element is at the end or
not present), making the search complexity linear, or O(n).
Question 6
Which data structure uses a First-In, First-Out (FIFO) principle?
A) Stack
B) Queue
C) Linked List
D) Hash Table
E) Tree
Correct Answer: B) Queue
Rationale: A queue is an abstract data type that maintains elements
in a sequence, allowing additions (enqueue) only at one end (rear)
and removals (dequeue) only from the other end (front). This is
FIFO.
, Question 7
What is the primary disadvantage of using a linked list compared to an
array?
A) Slower random access to elements.
B) Fixed size.
C) More complex insertion at the end.
D) Requires less memory.
E) Only allows sequential access.
Correct Answer: A) Slower random access to elements.
Rationale: In a linked list, to access an element at a specific
position, you must traverse the list from the beginning, leading to
linear time complexity (O(n)). Arrays allow constant-time (O(1))
random access.
Question 8
Which sorting algorithm repeatedly steps through the list, compares adjacent
elements, and swaps them if they are in the wrong order?
A) Selection Sort
B) Insertion Sort
C) Bubble Sort
D) Merge Sort
E) Quick Sort
Correct Answer: C) Bubble Sort
Rationale: Bubble Sort compares adjacent elements and swaps them
if they are out of order, repeating this process until no more swaps
are needed, effectively "bubbling" the largest (or smallest)
elements to their correct positions.
Question 9
What is the time complexity of inserting an element into a sorted linked list
in the worst case?
A) O(1)
B) O(log n)
C) O(n)
D) O(n log n)
E) O(n^2)
Correct Answer: C) O(n)
Rationale: In the worst case, to insert an element into a sorted
linked list, you might need to traverse almost the entire list to find
the correct insertion point, making the operation linear, or O(n).