[go: up one dir, main page]

0% found this document useful (0 votes)
35 views3 pages

Data Structure MCQs

The document contains multiple-choice questions (MCQs) on the topic of data structures, covering definitions, types, advantages, and complexities. Key concepts include linear vs non-linear data structures, time complexities for operations, and specific programming language syntax related to data structures. The questions also address pointers, memory allocation, and the characteristics of various data structures.

Uploaded by

chanchalmajhi69
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views3 pages

Data Structure MCQs

The document contains multiple-choice questions (MCQs) on the topic of data structures, covering definitions, types, advantages, and complexities. Key concepts include linear vs non-linear data structures, time complexities for operations, and specific programming language syntax related to data structures. The questions also address pointers, memory allocation, and the characteristics of various data structures.

Uploaded by

chanchalmajhi69
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

MCQs on Introduction to Data Structure

1. What is a Data Structure?


A) A way to store and organize data
B) A type of programming language
C) A collection of algorithms
D) A database management system
**Answer:** A

2. Which of the following is a linear data structure?


A) Tree
B) Graph
C) Array
D) Hash Table
**Answer:** C

3. What is the main advantage of using a linked list over an array?


A) Dynamic memory allocation
B) Faster access time
C) Requires less memory
D) Elements are stored in contiguous locations
**Answer:** A

4. Which of the following is a non-linear data structure?


A) Stack
B) Queue
C) Linked List
D) Graph
**Answer:** D

5. What is the worst-case time complexity for searching an element in an unsorted array?
A) O(1)
B) O(log n)
C) O(n)
D) O(n log n)
**Answer:** C

6. Which data structure follows the Last In, First Out (LIFO) principle?
A) Queue
B) Stack
C) Linked List
D) Graph
**Answer:** B

7. Which of the following operations is performed in constant time O(1) in a stack?


A) Insertion (Push)
B) Deletion (Pop)
C) Both A and B
D) Searching
**Answer:** C

8. What is the correct syntax for declaring an array in C?


A) int array[10];
B) array int[10];
C) int[10] array;
D) array{10} int;
**Answer:** A

9. What does a pointer store?


A) Value of a variable
B) Address of a variable
C) Garbage value
D) None of the above
**Answer:** B

10. Which of the following is true about structures in C?


A) A structure can store multiple data types
B) Structure members can only be integers
C) Structure members cannot be accessed individually
D) Structures are the same as arrays
**Answer:** A

11. Which of the following data structures allows insertion and deletion at both ends?
A) Stack
B) Queue
C) Deque
D) Linked List
**Answer:** C

12. What is the main disadvantage of an array?


A) Dynamic size allocation
B) Random access of elements
C) Fixed size
D) Efficient memory usage
**Answer:** C

13. In which data structure do elements follow the First In, First Out (FIFO) principle?
A) Stack
B) Queue
C) Linked List
D) Graph
**Answer:** B

14. What is the time complexity of accessing an element in an array by index?


A) O(1)
B) O(n)
C) O(log n)
D) O(n log n)
**Answer:** A

15. What is the purpose of the malloc() function in C?


A) Allocate memory dynamically
B) Free allocated memory
C) Resize allocated memory
D) Deallocate static memory
**Answer:** A

16. Which of the following statements is true about linked lists?


A) They require contiguous memory locations
B) Insertion and deletion are easier compared to arrays
C) They have a fixed size
D) They do not require pointers
**Answer:** B

17. Which data structure is used for recursion?


A) Queue
B) Stack
C) Array
D) Graph
**Answer:** B

18. How can a structure be accessed using a pointer?


A) Using the dot '.' operator
B) Using the arrow '->' operator
C) Using the ampersand '&' operator
D) Using the hash '#' operator
**Answer:** B

19. What is a NULL pointer in C?


A) A pointer that stores zero
B) A pointer that stores an invalid memory address
C) A pointer that does not point to any memory location
D) A pointer that points to the first element of an array
**Answer:** C

20. What is the size of a pointer in a 64-bit system?


A) 2 bytes
B) 4 bytes
C) 8 bytes
D) 16 bytes
**Answer:** C

You might also like