Learn C# .Net MCQs
Prepare C# .Net MCQs (Multiple choice Questions) for exam and job interviews.
Which of the following is used to sort an array in C#?
1) Array.Sort()
2) SortArray()
3) ArrangeArray()
4) None of the above
Answer : Array.Sort()
What is the output of Console.WriteLine(20 / 2);?
1) 10
2) 20
3) 5
4) None of the above
Answer : 10
Which of the following is used to compare two strings in C#?
1) Equals()
2) Compare()
3) ==
4) All of the above
Answer : All of the above
What is the output of Console.WriteLine(Math.Sqrt(25));?
1) 5
2) 6
3) 4
4) Error
Answer : 5
Which of the following is true about polymorphism in C#?
1) It allows methods to have different implementations.
2) It only applies to interfaces.
3) It allows a class to have multiple methods with the same signature.
4) None of the above
Answer : It allows methods to have different implementations.
Which of the following is used to add an element to a list in C#?
1) Add()
2) Insert()
3) Append()
4) None of the above
Answer : Add()
What is the output of Console.WriteLine("C# is great!".Substring(3));?
1) is great!
2) C#
3) C# is
4) Error
Answer : is great!
Which of the following is used to convert a string to lowercase in C#?
1) ToLower()
2) Lower()
3) ToLowerCase()
4) None of the above
Answer : ToLower()
Which of the following is used to check if a string contains a specific value in C#?
1) Contains()
2) Has()
3) Includes()
4) None of the above
Answer : Contains()
What is the output of Console.WriteLine(Math.Round(3.7));?
1) 4
2) 3
3) Error
4) None of the above
Answer : 4