Q221
Open questionp = q
struct employee
{
private int employee id;
private string city;
}
employee q = new employee();
employee p;
p = q;Select an option to see the answer and solution.
Practice every MCQ with options. Use Show answers when you want the correct option and solution.
238
Questions
12/12
Page
Pick an option on a question to see the right answer and solution.
Q221
Open questionstruct employee
{
private int employee id;
private string city;
}
employee q = new employee();
employee p;
p = q;Select an option to see the answer and solution.
Q222
Open questionSelect an option to see the answer and solution.
Q223
Open questionclass baseclass
{
protected int a = 20;
}
class derived : baseclass
{
int a = 10;
public void math()
{
/* add code here */
}
}Select an option to see the answer and solution.
Q224
Open questionSelect an option to see the answer and solution.
Q225
Open questionSelect an option to see the answer and solution.
Q226
Open questionSelect an option to see the answer and solution.
Q227
Open questioninterface calc
{
void cal(int i);
}
class displayA :calc
{
public int x;
public void cal(int i)
{
x = i * i;
}
}
class displayB :calc
{
public int x;
public void cal(int i)
{
x = i / i;
}
}
class Program
{
public static void Main(string[] args)
{
displayA arr1 = new displayA();
displayB arr2 = new displayB();
arr1.x = 0;
arr2.x = 0;
arr1.cal(2);
arr2.cal(2);
Console.WriteLine(arr1.x + " " + arr2.x);
Console.ReadLine();
}
}Select an option to see the answer and solution.
Q228
Open questionSelect an option to see the answer and solution.
Q229
Open questionSelect an option to see the answer and solution.
Q230
Open questionclass box
{
public int volume;
int width;
int height;
int length;
public box ( int w, int h, int l)
{
this.width = w;
this.height = h;
this.length = l;
}
~ box()
{
volume = this.width * this.length * this.height;
console.writeline(volume);
}
}
class Program
{
public static void Main(string[] args)
{
box b = new box(4, 5, 9);
Console.ReadLine();
}
}Select an option to see the answer and solution.
Q231
Open questionSelect an option to see the answer and solution.
Q232
Open questionclass nameSelect an option to see the answer and solution.
Q233
Open questionclass base
{
public void f1() {}
public virtual void f2() {}
public virtual void f3() {}
}
class derived :base
{
new public void f1() {}
public override void f2() {}
public new void f3() {}
}
class Program
{
static void Main(string[] args)
{
baseclass b = new derived();
b.f1 ();
b.f2 ();
b.f3 ();
}
}Select an option to see the answer and solution.
Q234
Open questionclass sample
{
int i = 10;
int j = 20;
public void display()
{
Console.WriteLine("base method ");
}
}
class sample1 : sample
{
public int s = 30;
}
class Program
{
static void Main(string[] args)
{
sample1 obj = new sample1();
Console.WriteLine("{0}, {1}, {2}", obj.i, obj.j, obj.s);
obj.display();
Console.ReadLine();
}
}Select an option to see the answer and solution.
Q235
Open questionSelect an option to see the answer and solution.
Q236
Open questionSelect an option to see the answer and solution.
Q237
Open questionpublic static void Main(string[] args)
{
p();
void p()
{
Console.WriteLine("hi");
}
}Select an option to see the answer and solution.
Q238
Open questionpublic int add() { }
public float add(){ }Select an option to see the answer and solution.