Learn C# .Net MCQs
Prepare C# .Net MCQs (Multiple choice Questions) for exam and job interviews.
Which of the following is used to find the maximum value in an array in C#?
1) Max()
2) Math.Max()
3) Array.Max()
4) None of the above
Answer : Math.Max()
Which of the following is true about methods in C#?
1) They can have multiple return types.
2) They cannot be overloaded.
3) They must be public.
4) None of the above
Answer : None of the above
What is the output of Console.WriteLine("Hello".StartsWith("He"));?
1) true
2) false
3) Error
4) None of the above
Answer : true
Which of the following is a correct way to declare a constant in C#?
1) const int x;
2) final int x;
3) constant int x;
4) None of the above
Answer : const int x;
What is the default value of a boolean variable in C#?
1) True
2) False
3) 0
4) None of the above
Answer : False
Which keyword is used to create a class in C#?
1) new
2) create
3) class
4) None of the above
Answer : class
What does the "public" access modifier do in C#?
1) Allows access to all classes.
2) Allows access only within the same class.
3) Restricts access to derived classes.
4) None of the above
Answer : Allows access to all classes.
Which of the following is a reference type in C#?
1) int
2) float
3) string
4) None of the above
Answer : string
What is the output of Console.WriteLine(10 / 3);?
1) 3.333
2) 3
3) Error
4) None of the above
Answer : 3
Which of the following is used to handle exceptions in C#?
1) try-catch
2) catch-finally
3) try-catch-finally
4) None of the above
Answer : try-catch-finally