Learn C# .Net MCQs

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

Which of the following is used to compare two strings in C#?

1) String.Compare()

2) CompareString()

3) String.Equals()

4) None of the above

Answer : String.Compare()

What is the output of Console.WriteLine(Math.Round(2.5));?

1) 2

2) 3

3) Error

4) None of the above

Answer : 2

Which of the following is used to create a new thread in C#?

1) Thread.Start()

2) Thread.Run()

3) Thread.New()

4) None of the above

Answer : Thread.Start()

What is the output of Console.WriteLine(10 >= 10);?

1) true

2) false

3) Error

4) None of the above

Answer : true

Which of the following is used to check if an object is null in C#?

1) == null

2) isNull()

3) nullCheck()

4) None of the above

Answer : == null

What is the output of Console.WriteLine(100 / 5);?

1) 20

2) 25

3) 10

4) None of the above

Answer : 20

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

1) for

2) foreach

3) while

4) None of the above

Answer : foreach

What is the output of Console.WriteLine("Hello".Substring(1, 2));?

1) el

2) ll

3) He

4) None of the above

Answer : el

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

1) new[]

2) create[]

3) init[]

4) None of the above

Answer : new[]

Which of the following is used to add elements to a list in C#?

1) Add()

2) Insert()

3) Append()

4) None of the above

Answer : Add()