C# Interfaces, Inheritance & Polymorphism Mcqs

Our collections of Multiple choice questions and answers focuses on study of Interfaces, Inheritance & Polymorphism. These questions are chosen from a collection of most authoritative and best reference books on C# Interfaces,Inheritance & Polymorphism. Our aim is to prepare an individual for competitive exams like NTS, GAT, ECAT, University and College entrance exams and various Interfaces,Inheritance & Polymorphism comprehensively.

  1. Home
  2. »
  3. Languages
  4. »
  5. Programming Languages Mcqs
  6. »
  7. C# Programming Mcqs
  8. »
  9. Interfaces,Inheritance & Polymorphism Mcqs
  10. »
  11. Page 3

31.
Which of the following keyword is used to change the data and behavior of a base class by replacing a member of a base class with a new derived member?

New

Base

Overloads

Override

32.
Which of the following statements is correct?

When used as a modifier, the new keyword explicitly hides a member inherited from a base class.

Operator overloading works in different ways for structures and classes.

It is not necessary that all operator overloads are static methods of the class.

The cast operator can be overloaded.

34.
Which of the followings is the correct way to overload + operator?

Public sample operator + ( sample a, sample b )

Public abstract operator + ( sample a, sample b)

Public abstract sample operator + (sample a, sample b )

Public static sample operator + ( sample a, sample b )

35.
Which of the following statements is correct?

Static methods can be a virtual method.

Abstract methods can be a virtual method.

It is necessary to override a virtual method.

When overriding a method, the names and type signatures of the override method must be the same as the virtual method that is being overriden.

36.
Which of the following statements are correct?

1. All operators in C#.NET can be overloaded.
2. We can use the new modifier to modify a nested type if the nested type is hiding another type.
3. In case of operator overloading all parameters must be of the different type than the class or struct that declares the operator.
4. Method overloading is used to create several methods with the same name that performs similar tasks on similar data types.
5. Operator overloading permits the use of symbols to represent computations for a type.

1, 3

2, 4

2, 5

3, 4

37.
Which of the following statement is correct about the C#.NET code snippet given below?
public class Sample
{
    public int x;
    public virtual void fun()
    { }
}
public class DerivedSample : Sample
{
    new public void fun()
    { }
} 

DerivedSample class hides the fun() method of base class.

The DerivedSample class version of fun() method gets called using Sample class reference which holds DerivedSample class object.

The code replaces the DerivedSample class version of fun() method with its Sample class version.

It is not possible to hide Sample class version of fun() method without use of new in DerivedSample class.

38.
Which of the following statements is correct?

The conditional logical operators cannot be overloaded.

When a binary operator is overloaded the corresponding assignment operator, if any, must be explicitly overloaded.

We can use the default equality operator in an overloaded implementation of the equality operator.

A public or nested public reference type does not overload the equality operator.

41.
In order for an instance of a derived class to completely take over a class member from a base class, the base class has to declare that member as

New

Base

Virtual

Overrides

43.
Which of the following statements is correct?

Only one object can be created from an abstract class.

By default methods are virtual.

If a derived class does not provide its own version of virtual method then the one in the base class is used.

If the method in the derived class is not preceded by override keywords, the compiler will issue a warning and the method will behave as if the override keyword were present.

44.
Which of the following are necessary for Run-time Polymorphism?

1. The overridden base method must be virtual, abstract or override.
2. Both the override method and the virtual method must have the same access level modifier.
3. An override declaration can change the accessibility of the virtual method.
4. An abstract inherited property cannot be overridden in a derived class.
5. An abstract method is implicitly a virtual method.

1, 3

1, 2, 5

2, 3, 4

4 only

45.
The capability of an object in Csharp to take number of different forms and hence display behaviour as according is known as:

Encapsulation

Polymorphism

Abstraction

None of the mentioned

error: You are not allowed to do so.....
0Shares
0
Scroll to Top