Data Structures MCQs with Answers
Practice important Data Structures MCQs with answers and explanations.
Multiple Choice Questions
Q11: What does the List data structure allow you to do?
- A: Store elements of different types
- B: Insert and remove elements in any order
- C: Access elements without order
- D: Store data in random memory locations
View Answer
B
Q12: How are array elements accessed in a program?
- A: By their index
- B: By their type
- C: By their memory address
- D: By their name
View Answer
A
Q13: What is a characteristic of arrays in memory?
- A: They occupy random memory locations
- B: They occupy non-contiguous memory locations
- C: They occupy contiguous memory locations
- D: They cannot store integers
View Answer
C
Q14: Which of the following operations is not allowed with array name 'x'?
- A: x[0] = 5;
- B: x = &n;
- C: x[1] = 10;
- D: x = y;
View Answer
B
Q15: What is a key difference between arrays and lists?
- A: Arrays store data in random order, lists do not
- B: Lists allow different data types, arrays do not
- C: Lists allow insertion and deletion at various positions, arrays have fixed positions
- D: Arrays and lists are identical in behavior
View Answer
C
Q16: Which of the following statements is true about dynamically allocated arrays?
- A: Their size is fixed at compile time
- B: They occupy non-contiguous memory locations
- C: They require manual memory management using delete
- D: They are faster than static arrays
View Answer
C
Q17: What does the start() method do in a list implementation?
- A: Moves current to the end
- B: Moves current to the beginning
- C: Moves current forward one step
- D: Moves current backward one step
View Answer
B
Q18: What happens when you use the next() method at the last element of an array?
- A: It moves to the first element
- B: It stays at the last element
- C: It throws an error
- D: It adds a new element
View Answer
C
Q19: Which method is used to remove an element at the current position in a list?
- A: remove()
- B: add()
- C: find()
- D: delete()
View Answer
A
Q20: How does the find(x) method behave when the element x is not found in the list?
- A: Returns 1
- B: Sets current to the last element
- C: Returns 0
- D: Deletes current element
View Answer
C