iGET

C# Programming - MCQ Practice Questions

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

290 questions | 100% Free

Q.1Hard

Consider the following code. What will be the output? int x = 10; int y = 20; int z = x++ + ++y; Console.WriteLine(x + " " + y + " " + z);

Q.2Hard

Which of the following statements about structs and classes in C# is TRUE?

Q.3Hard

Which of the following is NOT a valid C# data type?

Q.4Hard

Consider: int[] arr = {1, 2, 3}; What happens when you try to resize it using Array.Resize(ref arr, 5)?

Q.5Hard

What is the difference between 'struct' and 'class' in C# regarding memory allocation?

Q.6Hard

Which of the following correctly describes method overloading in C#?

Q.7Hard

In C#, what is the primary purpose of the 'using' statement?

Q.8Hard

What will be the result of: string text = null; Console.WriteLine(text ?? "Default");

Q.9Hard

Which of the following correctly demonstrates method overloading in C#?

Q.10Hard

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

Q.11Hard

In C#, which keyword is used to implement multiple interface inheritance?

Q.12Hard

What will be the output of: decimal price = 19.99m; Console.WriteLine(price.GetType().Name);

Q.13Hard

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

Q.14Hard

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

Q.15Hard

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