Learn C# .Net MCQs
Prepare C# .Net MCQs (Multiple choice Questions) for exam and job interviews.
What is the output of Console.WriteLine(2 * 3 + 4);?
1) 10
2) 8
3) 6
4) None of the above
Answer : 10
Which of the following is used to create an asynchronous method in C#?
1) async
2) await
3) async/await
4) None of the above
Answer : async/await
What is the purpose of the "finally" block in C#?
1) To execute code after try/catch.
2) To catch exceptions.
3) To define a method as final.
4) None of the above
Answer : To execute code after try/catch.
What is the output of Console.WriteLine("Hello".Contains("ell"));?
1) true
2) false
3) Error
4) None of the above
Answer : true
Which of the following is not a valid data type in C#?
1) char
2) bool
3) decimal
4) real
Answer : real
What is the output of Console.WriteLine(10 / 2 * 3);?
1) 15
2) 30
3) 5
4) None of the above
Answer : 15
Which of the following is a method of the string class in C#?
1) Contains()
2) Substring()
3) Length
4) All of the above
Answer : All of the above
What is the output of Console.WriteLine(Math.Sqrt(16));?
1) 4
2) 16
3) 8
4) None of the above
Answer : 4
Which of the following statements is used to include namespaces in C#?
1) using
2) import
3) namespace
4) None of the above
Answer : using
What is the output of Console.WriteLine("a" == "A");?
1) true
2) false
3) Error
4) None of the above
Answer : false