What is a data structure?
A. A way to store and organize data efficiently.
B. A type of computer hardware.
C. A programming language.
D. A collection of algorithms.
ANSWER:A
Which of the following is a linear data structure?
A. Tree
B. Graph
C. Array
D. Heap
ANSWER: C
What is the primary advantage of using an array?
A. Dynamic size
B. Efficient random access
C. Insertion and deletion at any position
D. Storage of different data types
ANSWER:B
What is the time complexity of accessing an element in an array by its index?
A. O
B. O(log n)
C. O(1)
D. O(n log n)
ANSWER:C
What is the main difference between a stack and a queue?
A. A stack uses FIFO (First-In, First-Out) while a queue uses LIFO (Last-In, First-Out).
B. A stack uses LIFO (Last-In, First-Out) while a queue uses FIFO (First-In, First-Out).
C. Both use FIFO.
D. Both use LIFO.
ANSWER:B
- Teacher: Admin User