C# QUIZ 8

1
Created on By Sirjana GhimireAcharya

C# Quiz 8

1 / 10

1. Which of the following represents the process of defining two or more methods within the same class having the same name but different parameters list?

2 / 10

2. Which of the following are applicable for overloading?

3 / 10

3. Which of the following statements is correct?

4 / 10

4. Which of the following statements are correct?

5 / 10

5. Which of the following modifier applies when a virtual method is redefined by a derived class?

6 / 10

6. Which of the following keyword should be prefixed to a member of the base class to allow overriding in the derived class?

7 / 10

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

class sample
{
public int x;
public double y;
public int sum(int a, int b)
{
x = a + b;
return x;
}
public int sum(double c, double d)
{
y = c + d;
return (int)y;
}
public sample()
{
this.x = 0;
this.y = 0;
}
}
class Program
{
static void Main(string[] args)
{
sample s = new sample();
int a = 4;
double b = 3.5;
s.sum(a, a);
s.sum(b, b);
Console.WriteLine(s.x + " " + s.y);
Console.ReadLine();
}
}

8 / 10

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

class sample
{
public int func(int k, int y)
{
return k + y;
}
public int func1(int t, float z)
{
return (t+(int)z);
}
}
class Program
{
static void Main(string[] args)
{
sample s = new sample();
int i;
int b = 90;
int c = 100;
int d = 12;
float m = 14.78f;
i = s.func(b, c);
Console.WriteLine(i);
int j = (s.func1(d, m));
Console.WriteLine(j);
Console.ReadLine();
}
}

9 / 10

9. Which of the following represents the process where a method in a subclass has same name & type signature as a method in its superclass?

10 / 10

10.Which of the following modifiers can be used to prevent Method overriding?

Your score is

The average score is 70%

0%