Learn C# .Net MCQs
Prepare C# .Net MCQs (Multiple choice Questions) for exam and job interviews.
Which of the following is a collection type in C#?
1) List
2) Dictionary
3) Array
4) All of the above
Answer : All of the above
What is the output of Console.WriteLine(5 == 5 || 3 < 2);?
1) true
2) false
3) Error
4) None of the above
Answer : true
Which of the following is the correct syntax for an if statement in C#?
1) if (condition) {}
2) if condition {}
3) if: condition {}
4) None of the above
Answer : if (condition) {}
What is the output of Console.WriteLine(10 + "5");?
1) 105
2) 15
3) Error
4) None of the above
Answer : 105
Which of the following is used to create an instance of a class in C#?
1) new
2) create
3) instance
4) None of the above
Answer : new
What is the output of Console.WriteLine(7 % 3);?
1) 1
2) 3
3) 2
4) None of the above
Answer : 1
What is the output of Console.WriteLine(10 / 4);?
1) 2
2) 2.5
3) 3
4) Error
Answer : 2
Which of the following is a correct way to declare a string in C#?
1) string str;
2) string str = "Hello";
3) string str = new string();
4) None of the above
Answer : string str = "Hello";
What does the "async" keyword do in C#?
1) Defines an asynchronous method.
2) Prevents a method from executing.
3) Defines a method as abstract.
4) None of the above
Answer : Defines an asynchronous method.
Which of the following is a valid way to define a method in C#?
1) void MyMethod() {}
2) MyMethod void() {}
3) def MyMethod() {}
4) None of the above
Answer : void MyMethod() {}