C# Properties, Indexers Interivew Questions and Answers - 2

Question: 6

What is called query method?

A property consists of a name along with get and set accessors. The get is used to get the value. It is called query method.

Question: 7

What are the restrictions of the property?

Properties have some important restrictions. They are

Properties are not having storage locations so it cannot be passed as ref or out parameter to a method.

Properties cannot be overloaded.

A get operation should be non intrusive

Question: 8

What are the purposes of the property?

The get accessor not only used to get the values, it also has the capability to decide the data for the purpose of data integrity.

Property is also inheritable.

Hiding the implementation details of the methods and prevention of direct access to data is also achieved. For that the modifiers abstract, virtual, new and override are used.

Question: 9

Write down the classifications of the properties?

Read – only property.

Write – only property.

Read-write property.

Question: 10

Define CLR?

The common language runtime, popularly known as CLR is the heart and soul of the .NET framework.

It is a runtime environment in which programs written in .NET languages (C#, VB.NET, etc..) are executed.

It also supports Cross language interoperability.

Related Questions