0% found this document useful (0 votes)
39 views12 pages

Unit 3 MCQ

This document contains multiple choice questions related to data structures, specifically focusing on linked lists. It covers various topics including types of linked lists, operations, memory allocation, and advantages/disadvantages of linked lists compared to arrays. An answer key is provided at the end for reference.

Uploaded by

darshitp1604
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)
39 views12 pages

Unit 3 MCQ

This document contains multiple choice questions related to data structures, specifically focusing on linked lists. It covers various topics including types of linked lists, operations, memory allocation, and advantages/disadvantages of linked lists compared to arrays. An answer key is provided at the end for reference.

Uploaded by

darshitp1604
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

Data Structures - Multiple Choice Questions

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

a) Linked list

b) Graph

c) Tree

d) Trie

2. What does a node in a singly linked list contain?

a) Data and two pointers

b) Only data

c) Data and one pointer

d) Data and three pointers

3. In a singly linked list, the last node points to:

a) The first node

b) NULL

c) Itself

d) Random node

4. Which linked list allows traversal in both directions?

a) Singly linked list

b) Circular list

c) Doubly linked list

d) Header list

5. Circular linked list has the last node pointing to:

a) NULL

b) Head

c) Middle

d) Any node

Page 1
Data Structures - Multiple Choice Questions

6. In linked lists, memory is allocated:

a) Sequentially

b) Randomly

c) Dynamically

d) Continuously

7. Which pointer in doubly linked list points to the previous node?

a) forward

b) next

c) prev

d) back

8. Which of these operations is easiest with linked list compared to arrays?

a) Traversal

b) Insertion

c) Searching

d) Sorting

9. What is garbage collection in context of linked lists?

a) Allocating memory

b) Collecting unused memory

c) Deleting data

d) Updating node

10. Which of the following is not a type of linked list?

a) Singly

b) Doubly

c) Circular

d) Binary

Page 2
Data Structures - Multiple Choice Questions

11. Which of the following applications uses linked list?

a) Polynomial addition

b) Stacks

c) Queues

d) All of these

12. What is header linked list?

a) First node stores data

b) Last node stores address of header

c) Special node at beginning

d) List with extra memory

13. To traverse a linked list, we use:

a) loop

b) recursion

c) iteration

d) any of these

14. Time complexity for searching in singly linked list is:

a) O(1)

b) O(log n)

c) O(n)

d) O(n log n)

15. Which of these is a non-linear data structure?

a) Linked list

b) Stack

c) Tree

d) Queue

Page 3
Data Structures - Multiple Choice Questions

16. How many pointers does a node in a doubly linked list have?

a) 0

b) 1

c) 2

d) 3

17. Insertion at beginning in singly linked list is done in:

a) O(n)

b) O(log n)

c) O(1)

d) O(n^2)

18. Which is used to implement Linked Stack?

a) Queue

b) Linked List

c) Array

d) Tree

19. Which is an advantage of linked list over arrays?

a) Easy to search

b) Memory reuse

c) Easy access

d) Dynamic size

20. Which of the following is a disadvantage of singly linked list?

a) Requires extra memory

b) Slow search

c) No backward traversal

d) All of the above

Page 4
Data Structures - Multiple Choice Questions

21. How do you delete a node from a singly linked list?

a) Modify previous node pointer

b) Jump to next

c) Directly remove

d) None

22. In linked list, to insert in the middle, we need:

a) Last node

b) Middle node

c) Previous node

d) Head

23. What is required to traverse a circular linked list?

a) Stop when NULL

b) Stop after n nodes

c) Stop when back to head

d) Infinite loop

24. What is the head in a linked list?

a) Middle node

b) Last node

c) First node

d) NULL

25. How to check if a singly linked list is circular?

a) Last node points to NULL

b) Next of head is NULL

c) Loop until node points to head

d) None

Page 5
Data Structures - Multiple Choice Questions

26. Which is better for memory utilization?

a) Array

b) Linked list

c) Stack

d) Heap

27. Which pointer is null in the first node of doubly linked list?

a) next

b) back

c) prev

d) link

28. Which of the following is not true about linked list?

a) It uses dynamic memory

b) Fixed size

c) Elements not stored contiguously

d) Grows in runtime

29. To access the ith element in a singly linked list, time complexity is:

a) O(1)

b) O(log n)

c) O(n)

d) O(n^2)

30. Linked list is suitable for:

a) Static memory

b) Sequential access

c) Large data operations

d) All

Page 6
Data Structures - Multiple Choice Questions

31. Which type of list helps in easy traversal from both ends?

a) Singly

b) Doubly

c) Circular

d) None

32. What happens if free memory is not handled properly?

a) Memory leak

b) Crash

c) Garbage build-up

d) All

33. To insert a node after a given node, you must:

a) Update data

b) Update link of next node

c) Update current and next node

d) All

34. Which is better for implementing dynamic stacks?

a) Arrays

b) Linked lists

c) Trees

d) Vectors

35. Which of these does not require backward traversal?

a) Undo operations

b) Doubly linked list

c) Stack

d) Editor navigation

Page 7
Data Structures - Multiple Choice Questions

36. When would you prefer a linked list over array?

a) Static data size

b) Frequent insert/delete

c) Random access

d) Sorting

37. Which one is used to free memory occupied by deleted node?

a) delete()

b) free()

c) remove()

d) clear()

38. Whats an advantage of header linked list?

a) Easy traversal

b) Decreases memory

c) Simplifies operations

d) Avoids head NULL

39. Which application uses linked queues?

a) Web server requests

b) Reversing string

c) Tower of Hanoi

d) Tree traversal

40. Which type of list allows looping structure naturally?

a) Circular

b) Doubly

c) Header

d) Stack

Page 8
Data Structures - Multiple Choice Questions

41. If head = NULL in a linked list, it means:

a) List is empty

b) One node exists

c) List is full

d) Head is end

42. Linked list is best used when:

a) Need random access

b) Static memory

c) Insertions/deletions frequent

d) None

43. What is used to represent NULL in C?

a) 0

b) NULL

c) nullptr

d) None

44. Which of the following is true for dynamic memory?

a) Fixed size

b) Memory at compile time

c) Allocation during runtime

d) Cannot free

45. What is an application of circular linked list?

a) Polynomial operations

b) CPU scheduling

c) Tower of Hanoi

d) Graph traversal

Page 9
Data Structures - Multiple Choice Questions

46. What is the purpose of a dummy header node?

a) Store data

b) Represent end

c) Simplify edge cases

d) None

47. Which function allocates memory in C?

a) calloc()

b) malloc()

c) realloc()

d) All

48. What happens when you access a freed pointer?

a) Error

b) Garbage value

c) Crash

d) All

Page 10
Data Structures - Multiple Choice Questions

Answer Key

1. a

2. c

3. b

4. c

5. b

6. c

7. c

8. b

9. b

10. d

11. d

12. c

13. d

14. c

15. c

16. c

17. c

18. b

19. d

20. d

21. a

22. c

23. c

24. c

Page 11
Data Structures - Multiple Choice Questions

25. c

26. b

27. c

28. b

29. c

30. c

31. b

32. d

33. d

34. b

35. c

36. b

37. b

38. c

39. a

40. a

41. a

42. c

43. b

44. c

45. b

46. c

47. d

48. d

Page 12

You might also like