• Tutorials
  • Courses
  • Tracks

C#: Advanced Collections Quiz

Last Updated :
Discuss
Comments

Question 1

What is the main characteristic of a HashSet in C#?

  • Allows duplicate elements and maintains order

  • Stores unique elements without maintaining order

  • Stores elements in sorted ascending order

  • Stores key-value pairs

Question 2

What is the time complexity of insert, delete, and search operations in a SortedSet?

  • O(1)

  • O(log n)

  • O(n)

  • O(n²)

Question 3

Which of the following correctly describes the Dequeue() method in a Queue<T>?

  • Removes and returns the element at the start

  • Adds an element at the start

  • Adds an element at the end

  • Returns the element at the start without removing

Question 4

Which method of HashSet<T> modifies the set to keep only the elements present in both sets?

  • UnionWith()

  • ExceptWith()

  • IntersectWith()

  • Clear()

Question 5

Which property of a Queue<T> is used to get the number of elements in it?

  • Length

  • Size

  • Count

  • Capacity

Question 6

What is the time complexity of the Pop() operation in a C# Stack<T>?

  • O(n)

  • O(1)

  • O(log n)

  • O(n²)

Question 7

Which of the following is true about LinkedList<T> in C#?

  • It is a singly linked list

  • It stores elements in contiguous memory

  • It is a doubly linked list

  • It does not allow duplicate elements

Question 8

By default, what is the underlying data type of an enum in C#?

  • byte

  • int

  • long

  • short

Question 9

Which keyword is used in C# iterators to return elements one at a time?

  • return

  • break

  • yield return

  • continue

Question 10

Which of the following statements correctly distinguishes a Stack<T> from a LinkedList<T> in C#?

  • Stack allows random access, LinkedList does not.

  • Stack is LIFO-based, LinkedList allows flexible insertions/removals.

  • Stack is faster than LinkedList in all operations.

  • LinkedList is synchronized, Stack is not.

Tags:

There are 10 questions to complete.

Take a part in the ongoing discussion