C# Interview Questions and Answers for Experienced - 1

Question: 1

Can you override private virtual methods?

No. Private methods are not accessible outside the class.

Question: 2

Define Inheritance?

Inheritance is deriving the new class from the already existing one.

Question: 3

Differentiate the terms Public, Friend, Protected, and Private.

Public:

Declared with the Public keyword

Accessible from anywhere in the same module

Friend:

Declared with the Friend keyword

Accessible from anywhere in the same module as well as the namespace containing the same module.

Protected:

Declared with the Protected keyword

Accessible only within the class in which they’re declared or a class that inherits from that class.

Private:

Declared with the Private keyword

Accessible from the module, class, or structures in which they’re declared.

Private keyword cannot be used within the procedure.

Question: 4

Differentiate the terms ByVal and ByRef?

By Val:    A copy of the value is passed to the procedure.

By Ref: A reference to the location of the value is passed to the procedure, which allows the procedure to modify the original value.

Question: 5

What is a bubbled event?

When you have a complex control, like Data Grid, writing an event processing routine for each object (cell, button, row, etc.) is quite tedious.

Related Questions