NEW
Font size
WorksheetsData Structures and Algorithm Module 4 Quiz
Total questions: 20
Worksheet time: 8mins
Which of the following best describes the primary reason why linked lists do not allow constant-time access to arbitrary elements?
Their memory allocation is handled at runtime
Each node may contain multiple pointers
Elements are not stored in contiguous memory
Their size can grow or shrink dynamically
When inserting a new node at the front of a singly linked list, which of the following must be updated?
Only the last node’s pointer
The new node’s next pointer and the head pointer
Only the new node’s data field
All nodes’ next pointers
In a circular singly linked list, which condition indicates that the list contains only one node?
The node’s next pointer is NULL
The head pointer is equal to NULL
The node’s next pointer points to itself
The previous pointer points to NULL
Which component of a linked list node ensures proper chaining of elements in a singly linked list?
Data field
Head pointer
Next pointer
Tail node
Which part of a linked list node is crucial for preventing data loss during node deletion?
Data field
Head pointer
Previous pointer
Next pointer
Which type of linked list does not contain a NULL pointer in its structure?
Singly linked list
Doubly linked list
Circular linked list
Reversed linked list
If a singly linked list has 5 nodes, how many total next pointers exist in the structure?
4
5
6
0
You are building a queue system for a hospital’s patient list, where patients are added at the rear and served from the front. Which structure is best suited based on the module?
Array
Singly linked list
Circular linked list
Doubly linked list
In a circular linked list with three nodes (A → B → C), what condition must be true to preserve its circular nature?
A’s next = NULL
B’s next = C
C’s next = A
A’s prev = C
Which of the following best explains why arrays are sometimes more suitable than linked lists, based on the module?
Arrays can grow without memory overhead
Arrays support faster sequential insertions
Arrays allow direct access via index
Arrays require fewer pointers per element
a < b
Less than
Greater than
a >= b
Greater than or equal to
Less than or equal to
Not Equal to
Equal to
Use ________ to specify a new condition to test, if the first condition is false
else if
if
else
Use _________ to specify a block of code to be executed, if the same condition is false
else
else if
if
What is the syntax for the If Statement
if [condition]{
// block of code to be executed if the condition is true
}
if ( block of code to be executed if the condition is true) {
//condition
}
if (condition) {
// block of code to be executed if the condition is true
}
if (condition) {}
// block of code to be executed if the condition is true
What is the Output?
Between 2 and 10
10 or more
2 or less
error
What is the Output?
Even
Odd
15
Error
What is the Output?
A is greater
B is greater
A and B are equal
Error
What is the Output?
Zero
Positive
Negative
Error
What is the Output?
A
B
C
D
