C# Screening Questions
C# Screening Questions
1. Insert the missing part of the code below to output "Hello World!".
6. Use the addition assignment operator to add the value 5 to the variable
x.
int x = 10;
x Answer Here 5;
8. Use substitution to join the firstName and lastName strings into fullName
Here";
int x = 50;
int y = 50;
Answer Here(x Answer Here y)
{
code to execute…;
}
10. Insert the missing parts to complete the following switch statement.
int day = 2;
switch (Answer Here)
{
Answer Here 1:
code to execute…;
break;
Answer Here 2:
code to execute…;
Answer Here;
int i = 1;
Answer Here(i Answer Here 6)
{
code to execute…;
Answer Here;
}
12. Complete the syntax to execute as long as i is less than 10.
int i = 1;
Answer Here
{
Console.WriteLine(i);
Answer Here;
}
Answer Here(i Answer Here 10);
15. Fill in the missing parts to output an error message if an error occurs.
Answer Here
{
int[] myNumbers = {1, 2, 3};
code to execute…(myNumbers[10]);
}
Answer Here(Exception e)
{
code to output error…(e.Message);
}