Constructors Questions and Answers

Practice Mode
Showing 10 of 15 questions
Q11
Which of the following statements are correct about the C#.NET code snippet given below? class Sample {     static int i;     int j;     public void proc1()     {         i = 11;         j = 22;     }     public static void proc2()     {         i = 1;         j = 2;     }     static Sample()     {         i = 0;         j = 0;     } }
  • A i cannot be initialized in proc1().
  • B proc1() can initialize i as well as j.
  • C j can be initialized in proc2().
  • D The constructor can never be declared as static.
Answer: Option B
Q12
Which of the following statements is correct?
  • A There is one garbage collector per program running in memory.
  • B There is one common garbage collector for all programs.
  • C An object is destroyed by the garbage collector when only one reference refers to it.
  • D We have to specifically run the garbage collector after executing Visual Studio.NET.
Answer: Option B
Q13
Is it possible for you to prevent an object from being created by using zero argument constructor?
  • A Yes
  • B No
Answer: Option A
Q14
Which of the following statements are correct about static functions?
  • A Static functions are invoked using objects of a class.
  • B Static functions can access static data as well as instance data.
  • C Static functions are outside the class scope.
  • D Static functions are invoked using class.
Answer: Option D
Q15
Which of the following statements is correct about constructors in C#.NET?
  • A A constructor cannot be declared as private.
  • B A constructor cannot be overloaded.
  • C A constructor can be a static constructor.
  • D A constructor cannot access static data.
Answer: Option C
Questions and Answers for Competitive Exams Various Entrance Test