Learn C# .Net MCQs

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

What is the output of Console.WriteLine("CSharp".Remove(2, 2));?

1) CSp

2) CSharp

3) C#

4) None of the above

Answer : CSp

Which of the following is used to remove the first element of a list in C#?

1) RemoveAt(0)

2) RemoveFirst()

3) RemoveStart()

4) None of the above

Answer : RemoveAt(0)

What is the output of Console.WriteLine(5 <= 5);?

1) true

2) false

3) Error

4) None of the above

Answer : true

Which of the following is used to reverse an array in C#?

1) Array.Reverse()

2) Reverse()

3) Flip()

4) None of the above

Answer : Array.Reverse()

Which of the following is used to convert a string to a character array in C#?

1) ToCharArray()

2) CharArray()

3) SplitChars()

4) None of the above

Answer : ToCharArray()

What is the output of Console.WriteLine(5 < 2);?

1) false

2) true

3) Error

4) None of the above

Answer : false

Which of the following is used to handle multiple exceptions in C#?

1) try-catch

2) try-catch-finally

3) if-else

4) None of the above

Answer : try-catch-finally

What is the output of Console.WriteLine(Math.Floor(3.7));?

1) 3

2) 4

3) Error

4) None of the above

Answer : 3

Which of the following is used to get the length of an array in C#?

1) Length

2) Size

3) Count

4) None of the above

Answer : Length

Which of the following is true about the "readonly" keyword in C#?

1) It prevents modification of fields.

2) It prevents instantiation of a class.

3) It is used for method overriding.

4) None of the above

Answer : It prevents modification of fields.