iGET

C# Programming - MCQ Practice Questions

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

290 questions | 100% Free

Q.1Medium

What will be the output of the following code snippet? int x = 5; int y = ++x; Console.WriteLine(x + " " + y);

Q.2Medium

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

Q.3Medium

What is the correct way to declare a constant variable in C#?

Q.4Medium

What is the difference between '==' and 'Equals()' when comparing strings in C#?

Q.5Medium

Which of the following will correctly convert a string to an integer in C#?

Q.6Medium

Which of the following correctly declares a nullable integer in C#?

Q.7Medium

What is the output of the following code? bool result = (5 > 3) && (2 < 1); Console.WriteLine(result);

Q.8Medium

Which keyword is used to prevent a class from being inherited in C#?

Q.9Medium

What will happen when you try to access an array index that is out of bounds in C#?

Q.10Medium

Which keyword is used to create an immutable class member in C#?

Q.11Medium

What is the difference between 'var' and explicit type declaration in C#?

Q.12Medium

What will happen if you try to access an array element beyond its bounds?

Q.13Medium

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

Q.14Medium

Which of the following statements about abstract classes is correct?

Q.15Medium

Which access modifier allows access from derived classes only?

Q.16Medium

What is the output of: Console.WriteLine(5 == 5.0);

Q.17Medium

Which of the following correctly declares a jagged array?

Q.18Medium

What is the purpose of the 'using' statement in C#?

Q.19Medium

What will be the output of: int x = 10; int y = x; y = 20; Console.WriteLine(x);

Q.20Medium

What will be the output of: sbyte x = -128; sbyte y = x - 1; Console.WriteLine(y);