iGET

C# Programming - MCQ Practice Questions

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

290 questions | 100% Free

Q.81Medium

Which of the following best describes LINQ in C#?

Q.82Medium

What is the main purpose of the 'finally' block in C#?

Q.83Easy

Which of the following is NOT a value type in C#?

Q.84Medium

What is the output of: int x = 10; int y = x++; Console.WriteLine(x + " " + y);

Q.85Easy

Which of the following correctly declares and initializes an array in C#?

Q.86Medium

Which keyword is used to create a constant variable in C# that cannot be changed?

Q.87Easy

What will be the result of: Console.WriteLine();

Q.88Medium

Which of the following is true about the 'var' keyword in C#?

Q.89Medium

What is the output of: char ch = 'A'; Console.WriteLine((int)ch);

Q.90Medium

Which statement about method overloading in C# is correct?

Q.91Medium

Which of the following correctly demonstrates the ternary operator in C#?

Q.92Hard

In C# 2024, what is the latest feature for null-safety introduced in recent versions?

Q.93Hard

What is the output of: string s = "Hello"; Console.WriteLine(s.GetHashCode() == s.GetHashCode());

Q.94Easy

Which collection type in C# is best suited for key-value pair storage with unique keys?

Q.95Medium

Which of the following statements about ref and out parameters in C# is correct?

Q.96Medium

What will be the behavior of the following code snippet? string str = null; string result = str?.ToUpper() ?? "DEFAULT"; Console.WriteLine(result);

Q.97Hard

In C# 2024, which feature allows you to use pattern matching to deconstruct objects and filter simultaneously in a single expression?

Q.98Medium

What is the difference between 'is' and '==' operators when comparing object references in C#?

Q.99Easy

Consider this code: int[] arr = new int[5]; foreach(var item in arr) { Console.Write(item + " "); } What is the output?

Q.100Easy

Which of the following is a correct way to declare a property with auto-implementation in C#?