Select chapter



Basics (2.papers)
Data Types (2.papers)
enums (2.papers)
OOPS (4.papers)
Arrays (1.papers)
Structs (2.papers)
Properties (2.papers)
Strings (2.papers)
Interfaces (1.papers)
Constructors (2.papers)
Ref-Out-Keywords (1.papers)
Collections (2.papers)
Generics (1.papers)
Hide

Sponsored Links


  

c# interview questions and answers

1
What is an object oriented programming language ?
  1. An object oriented programming language is a language which exhibits 4 properties i.e
    1) Abstraction 2) Encapsulation 3) Inheritance 4) polymorphism 
  2. An object oriented programming language is a language which supports Inheritance and polymorphism.
  3. An object oriented language is a language which supports object creation.
  4. An object oriented language is a language which supports objects, classes and methods.
Show Answer
Share Facebook gmail Twitter
2
Which of the following features are not supported in C# language ?
  1. Static polymorphism
  2. Dynamic polymorphism
  3. Multi level inheritance
  4. Multiple inheritance
Show Answer
Share Facebook gmail Twitter
3
What is polymorphism in C# ?
  1. When a method declared in the base class is overridden in the derived class then the method is said to be exhibiting polymorphism.
  2. When an entity ( method /object ) is appearing in multiple forms then the entity is said to be exhibiting polymorphism.
  3. When a method is appearing with same name and with different signature then the method is said to be exhibiting polymorphism.
  4. All the above definitions are correct.
Show Answer
Share Facebook gmail Twitter
4
What is Encapsulation ?
  1. Placing entire code in one class.
  2. Grouping the related data members (variables) and methods in one place.
  3. Hiding data members ( variables ) and exposing methods to the callers.
  4. None of the above
Show Answer
Share Facebook gmail Twitter
5
Which of the below options must be used for overloading a method?
  1. Method signature must be different.
    
  2. Method name must be same.
    
  3. Both first and second options must be satisfied.
    
  4. None of the above.
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
7
Which of the following is the main advantage of inheritance ?
  1. Inheritance reduces the code duplication and improves the code maintainability.
  2. Inheritance used for achieving abstraction.
Show Answer
Share Facebook gmail Twitter
8
What is the use of base keyword in c# ?
  1. base keyword used for accessing object class static methods from any class.
  2. base keyword used for accessing base class instance methods,properties,variables and constructors from derived class.
  3. base keyword used for accessing base class static methods,properties,variables and constructors from derived class.
  4. base keyword can access protected, internal and public variables, properties and methods in the parent class.
Show Answer
Share Facebook gmail Twitter
9
Which of the following statements is correct about base keyword in Csharp ?
  1. base keyword is used for accessing base class static members from derived class .
  2. base keyword used only for accessing object class static members.
  3. base keyword is specially useful for accessing base class instance members from derived class instance members when the derived class is having members with same name as base class members.
  4. None of the above
Show Answer
Share Facebook gmail Twitter
10
What is the use of this keyword in Csharp ?
  1. this keyword used for accessing instance members of a base class from a derived class.
  2. this keyword used only for accessing instance variables of a class but not methods .
  3. this keyword used for accessing current object instance members.
  4. None of the above.
Show Answer
Share Facebook gmail Twitter
11
What is a method hiding in C#?
  1. When the derived class is having the same method with same signature as base class method then derived class method Is said to be hiding base class member.
  2. When the derived class is having the same method with same signature as base class method including same return type then derived class method Is said to be hiding base class member.
  3. When the derived class is having the same method with different signature as base class method including same return type then derived class method Is said to be hiding base class member.
  4. None of the above.
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
13
Which of the following options are correct about overriding in csharp ?
  1. Base class member must be a virtual or override member for overriding in derived class 
  2. It is not possible to override a static method in the derived class
  3. Changing access specifier of a base class virtual or overridden method is not possible in the derived class override method
  4. All the above options are correct
Show Answer
Share Facebook gmail Twitter
14
What is the use of sealed keyword ?
  1. A sealed keyword is used for stopping behavior overriding in the derived class methods.
  2. For avoiding child class creation on any class apply sealed keyword on the class definition.
  3. Sealed keyword must be applied only on the methods on the methods which are declared using override keyword.
  4. All the above options are correct.
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
16
What is a virtual method ?
  1. A virtual method is a low priority method which will never exists in the run time for accessing.
  2. A method which can be overridden in the derived class.
  3. A method without body is called as a virtual method.
  4. A method or property which can be overridden in the same class.
Show Answer
Share Facebook gmail Twitter
17
What is the difference between overloading and overriding ?
  1. A call to the overloaded method is determined by compiler during compilation time based on method parameters, but method calling incase of virtual and overrided methods usually depends on runtime instance and clr will decide which method has to be called.
  2. A call to the overloaded method is determined by CLR during runtime based on method parameters, but method calling incase of virtual and overrided methods usually depends on instance and compiler will decide which method has to be called.
  3. There is no difference between overloaded and override methods in C#.
  4. While overloading we can not change the method signature but in case of overriding we can change the overrided methods signature.
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Read more papers :