C# Operators Programming Interview Questions and Answers - 2

Question: 6

Give the advantages of the compound assignment?

Statement is more concise and easier to read.

Use of shorthand operator’s results in a more efficient code.

What appears on the left side need not be repeated and therefore it becomes easier to write.

Question: 7

Classify the operator based on the number of operands?

Unary,

Binary,

Ternary

Question: 8

What is called mixed mode arithmetic?

When one of the operand is real and the other is integer, the expression is called a mixed mode arithmetic expression.

If either operand is of the real type, then the other operand is converted to real and real arithmetic is performed.

Question: 9

Define widening and narrowing?

The process of assigning a smaller type to a larger one is known widening or promotion. The process of assigning a larger type to a smaller one is known as narrowing.

Question: 10

What are the advantages of casting?

It avoids truncation in a division.

Used to round off floating point number to the nearest integer.

Double a= 65.45;

Int b= (int) a//b is 65

Provides methods to convert between numeric values and strings.

Int X = 100;

String S1 = X. ToString (); // integer becomes string

Int y = Int. Parse (S1); // string becomes integer

Related Questions