Beruflich Dokumente
Kultur Dokumente
Q.No 1 What is Common Language Runtime (CLR)? List the services that CLR
provide. [3 +7] 10
Answer:
The Common Language Runtime (CLR)
The Common Language Runtime or CLR is the .NET equivalent of Java Virtual Machine (JVM).
The primary goal of the CLR is to locate, load, and manage .NET types. The term runtime can be
understood as a collection of external services that are required to execute a given compile unit
of code.
Bitwise logical OR
Ones Complement
<<
Shift left
>>
Shift right
Answer:
C# language supports the following control or decision making statements:
1) if statement
2) switch statement
3) conditional operator statement
The if statement is a powerful decision making statement and is used to control the flow of
execution. It is a two way decision statement and is used in conjunction with an expression. It
takes the following forms:
1) Simple if statement
2) ifelse statement
3) Nested ifelse statement
4) elseif ladder
Simple if
The general form of a simple if statement is shown below. The statement block may be a single
statement or a group of statements. If the Boolean expression is true, the statement block will be
executed; otherwise the statement block will be skipped and the execution will jump to
statement-x. If the condition is true both the statement block and the statement x is executed
in sequence.
ifelse
The ifelse construct tests a condition and if that condition is true, it executes either the next
code statement or several code statements if they are enclosed in curly braces. If the condition
does not evaluate to true, then it either skips the code segment, or executes code in an else
statement.
Nested ifelse
When a series of decisions are involved, we may have to use more than one ifelse statement in
nested form as follows:
Note: Writing an if statement within the scope of another if statement is known as Nested If.
The ifelseif Ladder
There may be situations wherein we need multiple if statements nested within each other to
check and execute multiple conditions. In case, where none of the conditions within these if
statements is satisfied, then the default statement following the last else would be executed.
{
Derived d = new Derived();
d.Display();
Console.Read();
}
}