C# QUIZ 5

2
Created on By Sirjana GhimireAcharya

C# Quiz 5

1 / 10

1. Which operator is used to add together two values?

2 / 10

2. The value of a string variable can be surrounded by single quotes.

3 / 10

3. To declare an array in C#, define the variable type with:

4 / 10

4. How do you create a method in C#?

5 / 10

5. Which of the following is true for ReadOnly variables?

6 / 10

6. Which of the following statement is true?

7 / 10

7. What will be the output of the following code snippet?

class program
{
static void Main(string[] args)
{
int x = 4 ,b = 2;
x -= b/= x * b;
Console.WriteLine(x + " " + b);
Console.ReadLine();
}
}

8 / 10

8. What will be the output of the following code snippet?

class program
{
static void Main(string[] args)
{
int x = 8;
int b = 16;
int c = 64;
x /= c /= b;
Console.WriteLine(x + " " + b+ " " +c);
Console.ReadLine();
}
}

9 / 10

9. What will be the output of the following code snippet?

class sample
{
int i;
double k;
public sample (int ii, double kk)
{
i = ii;
k = kk;
double j = (i) + (k);
Console.WriteLine(j);
}
~sample()
{
double j = i - k;
Console.WriteLine(j);
}
}
class Program
{
static void Main(string[] args)
{
sample s = new sample(9, 2.5);

}
}

10 / 10

10. What will be the output of the following code snippet?

class Program
{
static void Main(string[] args)
{
int num = 5;
int square = 0, cube = 0;
Mul (num, ref square, ref cube);
Console.WriteLine(square + " & " +cube);
Console.ReadLine();
}
static void Mul (int num, ref int square, ref int cube)
{
square = num * num;
cube = num * num * num;
}
}

Your score is

The average score is 60%

0%