Learn C# .Net MCQs
Prepare C# .Net MCQs (Multiple choice Questions) for exam and job interviews.
What is the purpose of the "async" keyword in C#?
1) To define a synchronous method
2) To define an asynchronous method
3) To declare a variable
4) None of the above
Answer : To define an asynchronous method
Which of the following is true about a constructor in C#?
1) It has no return type
2) It can be private
3) Both a and b
4) None of the above
Answer : Both a and b
What is the output of Console.WriteLine(7.0 / 2);?
1) 3.5
2) 3
3) Error
4) None of the above
Answer : 3.5
Which of the following is NOT a feature of C#?
1) Automatic garbage collection
2) Pointer arithmetic
3) Strongly typed
4) Exception handling
Answer : Pointer arithmetic
What is the output of Console.WriteLine(1 + 2 + "3");?
1) 33
2) 6
3) 12
4) Error
Answer : 33
Which of the following is used to define a read-only property in C#?
1) get
2) set
3) get only
4) None of the above
Answer : get
What is the output of Console.WriteLine("A" + 2);?
1) A2
2) Error
3) A 2
4) None of the above
Answer : A2
Which of the following is used to represent an unsigned integer in C#?
1) uint
2) int
3) long
4) None of the above
Answer : uint
What is the output of Console.WriteLine(5.0 % 2);?
1) 1.0
2) 1
3) 0
4) Error
Answer : 1.0
Which of the following is the correct syntax for a try-catch block in C#?
1) try { } catch { }
2) try { } catch(Exception e) { }
3) try { } catch { } finally { }
4) All of the above
Answer : All of the above