The statement that is used to replace multiple if statements is called:
Which of the following is NOT a C# (sharp) keyword?
The following code will generate a compiler error.
string GetAgePhrase(int age)
{
if (age > 60) return "Senior";
if (age > 40) return "Middle-aged";
if (age > 20) return "Adult";
if (age > 12) return "Teen-aged";
if (age > 4) return "Toddler";
}
Which of the following statements, inserted as the last line of the
function, would solve the problem?
static void Main(string[] args)
{
try
{
Console.WriteLine("Level 1");
try
{
Console.WriteLine("Level 2");
}
finally
{
Console.WriteLine("Level 2 Finished");
}
}
fsdf
{
Console.WriteLine("Level 1 Finished");
}
exit: ;
}
What is the output?
{
Console.WriteLine("Level 1 Finished");
}
exit: ;
}
What is the output?
What is the default access specifier for a Top-level Class, which are not nested into other Classes?
What is the difference between interface and abstract class?
If a method is marked as protected internal who can access it?
The default type of enum is integer and has a default value 1.
Unboxing of a null reference type will return a null.
Which of these string definitions will prevent escaping on backslashes in C# ?
Can we have protected element as a namespace member?
For example:
namespace mine
{
protected class test
{
}
}
Why can’t you specify the accessibility modifier for methods inside the interface?
Can multiple catch blocks be executed for a single try statement? In other words can code inside multiple catch blocks be executed?