C# Algorithm Interview Questions and Answers - 1

Question: 1

What is an indexed property?

The notion of properties is to define a way to access data that helps code readability while preserving encapsulation.

Indexed properties is a similar notion, however the “friendly” field like access of regular properties is replaced with the familiar array style indexing.

Question: 2

Differentiate Value types with Reference types?

Value Types

These data types store their data Directly as Values in memory. Includes,

Numeric Types(int32, short, single)

Structures (Custom data types based On System.ValyeType)

Enumerations (Custom types that represent a defined set of values)

        Boolean char.

       Can be accessed directly      

Reference Types

These data types store reference to another memory location that contains the data. Includes

Object

String

Arrays

Can be accessed through the members of the class.

Question: 3

What is the difference between ref and out parameters?

An argument passed to a ref parameter must first be initialized.

Compare this to an out parameter, whose argument does not have to be explicitly initialized before being passed to an out parameter.

Question: 4

What is jagged arrays?

A jagged array is an array whose elements are arrays.

The elements of a jagged array can be of different dimensions and sizes.

A jagged array is sometimes called an “array-of-arrays”.

Question: 5

Can you change the value of a variable while debugging a C# application?

Yes. If you are debugging via Visual Studio.NET, just go to immediate window.

Related Questions