iGET

C# Programming - MCQ Practice Questions

C# (.NET) MCQs — OOP, collections, LINQ & exception handling.

290 questions | 100% Free

Q.41Hard

In a complex system where a class needs to inherit from multiple sources of functionality while maintaining a single base type, which C# feature is most appropriate?

Q.42Hard

A financial system implements IEquatable<Account> for comparing accounts. What is the primary benefit of implementing this interface?

Q.43Hard

In a real estate system, consider Property (base) with House and Apartment (derived). If Property has a sealed method CalculateTax(), what happens in House class?

Q.44Hard

Consider a scenario where class X implements interfaces IA and IB, and both interfaces have a method named Process(). How should X implement this?

Q.45Hard

In a healthcare system, Doctor is a derived class from Employee. If you want to ensure that Doctor's constructor calls Employee's constructor before executing, which approach is correct?

Q.46Hard

In C# 2024-25, which LINQ method would you use to find all elements matching a condition in a List<T>?

Q.47Hard

What is the space complexity of a HashSet<T> with n elements storing unique values?

Q.48Hard

Consider: var result = list.OrderByDescending(x => x.Age).ThenBy(x => x.Name); What does this do?

Q.49Hard

What is the difference between ICollection<T> and IEnumerable<T> in terms of capabilities?

Q.50Hard

In a concurrent environment, which collection should be used instead of Dictionary<K,V> in C# 2024-25?

Q.51Hard

Which collection type allows you to iterate in reverse order efficiently?

Q.52Hard

What happens when you call Clear() on a Dictionary<TKey, TValue>?

Q.53Hard

Which LINQ method should you use to get distinct elements from a List<int> while maintaining performance?

Q.54Hard

In a competitive exam scenario, if you need both fast lookup and sorted iteration, which should you choose?

Q.55Hard

In a real-time data processing application, which concurrent collection would be best for producer-consumer pattern?

Q.56Hard

Which LINQ method combines multiple sequences into a single result with cartesian product?

Q.57Hard

In a dictionary with 1000 items, what is the expected number of operations for TryGetValue() in C# 2024-25?

Q.58Hard

In a real-time cache system with limited memory, which collection supports automatic eviction of least recently used items?

Q.59Hard

Which collection should be used when you need both indexed access and automatic sorting?

Q.60Hard

In a high-concurrency distributed system, which collection from System.Collections.Concurrent is best for one-to-many relationships?