Learn C# .Net MCQs
Prepare C# .Net MCQs (Multiple choice Questions) for exam and job interviews.
Which of the following is used to implement encapsulation in C#?
1) Properties
2) Fields
3) Methods
4) None of the above
Answer : Properties
Which of the following is used to perform type casting in C#?
1) as
2) cast
3) to
4) None of the above
Answer : as
Which of the following is true about inheritance in C#?
1) A class can inherit multiple classes.
2) A class can inherit one class only.
3) A class cannot inherit.
4) None of the above
Answer : A class can inherit one class only.
What is the output of Console.WriteLine("abc".ToUpper());?
1) ABC
2) abc
3) Abc
4) None of the above
Answer : ABC
Which of the following is used to add an item to a list in C#?
1) Add()
2) Insert()
3) Append()
4) None of the above
Answer : Add()
Which of the following is used to stop the execution of a thread in C#?
1) Thread.Abort()
2) Thread.Sleep()
3) Thread.Pause()
4) None of the above
Answer : Thread.Abort()
Which of the following is the correct way to throw an exception in C#?
1) throw new Exception();
2) throw Exception();
3) Exception.throw();
4) None of the above
Answer : throw new Exception();
What is the output of Console.WriteLine(10 / 3);?
1) 3
2) 3.33
3) 0
4) Error
Answer : 3
Which of the following is true about interfaces in C#?
1) An interface can have multiple implementations.
2) An interface can have method bodies.
3) An interface can inherit a class.
4) None of the above
Answer : An interface can have multiple implementations.
Which of the following is the correct way to check if a list contains an item in C#?
1) Contains()
2) Has()
3) Check()
4) None of the above
Answer : Contains()