iGET

C# Programming - MCQ Practice Questions

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

290 questions | 100% Free

Q.21Medium

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

Q.22Medium

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

Q.23Easy

Which of the following is a reference type in C#?

Q.24Medium

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

Q.25Medium

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

Q.26Medium

Which of the following statements about abstract classes is correct?

Q.27Easy

What is the correct syntax for a multi-line comment in C#?

Q.28Medium

Which access modifier allows access from derived classes only?

Q.29Medium

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

Q.30Medium

Which of the following correctly declares a jagged array?

Q.31Medium

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

Q.32Hard

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

Q.33Hard

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

Q.34Medium

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

Q.35Medium

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

Q.36Easy

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

Q.37Medium

Which of the following correctly demonstrates nullable type syntax in C#?

Q.38Medium

Which access modifier provides access within the same assembly only?

Q.39Easy

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

Q.40Medium

How many dimensions does a jagged array have in the following declaration: int[][] arr;