Sail E0 Webinar

MCQs

Total Questions : 13 | Page 2 of 2 pages
Question 11. Choose the correct output for given set of code?
enum per {     a,      b,      c,      d,  } per.a = 10; Console.writeline(per.b);
  1.    11
  2.    1
  3.    2
  4.    compile time error
 Discuss Question
Answer: Option D. -> compile time error


It will report an error since enum element cannot be assigned a value outside the enum declaration.


Question 12. In Inheritance concept, which of the following members of base class are accessible to derived class members?
  1.    static
  2.    protected
  3.    private
  4.    shared
 Discuss Question
Answer: Option B. -> protected




Question 13. Select the statement which should be added to the current set of code to get the output as 10 20 ?
class baseclass{    protected int a = 20;}class derived : baseclass{    int a = 10;    public void math()    {         /* add code here */    }   }
  1.    Console.writeline( a + " " + this.a);
  2.    Console.Writeline( mybase.a + " " + a);
  3.    console.writeline(a + " " + base.a);
  4.    console.writeline(base.a + " " + a);
 Discuss Question
Answer: Option B. -> Console.Writeline( mybase.a + " " + a);




Latest Videos

Latest Test Papers