Learn C# .Net MCQs

Prepare C# .Net MCQs (Multiple choice Questions) for exam and job interviews.

What is the output of Console.WriteLine(3 * 3 + 3 / 3);?

1) 10

2) 9

3) 11

4) None of the above

Answer : 10

Which keyword is used to create a destructor in C#?

1) ~

2) delete

3) destructor

4) None of the above

Answer : ~

What is the output of Console.WriteLine("Test".ToUpper());?

1) TEST

2) Test

3) error

4) None of the above

Answer : TEST

Which of the following is a correct way to define a multi-dimensional array in C#?

1) int[,] arr = new int[3, 4];

2) int arr[][];

3) int arr = new int[3][4];

4) None of the above

Answer : int[,] arr = new int[3, 4];

What is the output of Console.WriteLine(3 == 3 ? "Yes" : "No");?

1) Yes

2) No

3) Error

4) None of the above

Answer : Yes

Which of the following is true about tuples in C#?

1) They can hold multiple types of data.

2) They are reference types.

3) Both A and B

4) None of the above

Answer : Both A and B

What is the output of Console.WriteLine(7 % 3);?

1) 1

2) 2

3) 3

4) 4

Answer : 1

Which of the following is a valid way to declare a variable in C#?

1) int x = 5;

2) 5 = x int;

3) int x;

4) None of the above

Answer : int x = 5;

Which of the following keywords is used to define an interface in C#?

1) interface

2) define

3) abstract

4) None of the above

Answer : interface

What is the default value of a boolean variable in C#?

1) true

2) false

3) null

4) 0

Answer : false