php mcq questions with answers


                                

Which of the following are reuse mechanisms available in C#.NET?

  1. Inheritance
  2. Encapsulation
  3. Templates
  4. Containership
  5. Polymorphism

A.1, 4
B.1, 3
C.2, 4
D.3, 5
                                

Which of the following should be used to implement a 'Like a' or a 'Kind of' relationship between two entities?

A.Polymorphism
B.Containership
C.Templates
D.Encapsulation
E.Inheritance
                                

How can you prevent inheritance from a class in C#.NET ?

A.Declare the class as shadows.
B.Declare the class as overloads.
C.Declare the class as sealed.
D.Declare the class as suppress.
E.Declare the class as override.
                                

Which of the following statements are correct about Inheritance in C#.NET?

  1. A derived class object contains all the base class data.
  2. Inheritance cannot suppress the base class functionality.
  3. A derived class may not be able to access all the base class data.
  4. Inheritance cannot extend the base class functionality.
  5. In inheritance chain construction of object happens from base towards derived.

A.1, 2, 4
B.2, 4, 5
C.1, 3, 5
D.2, 4
                                

Assume class B is inherited from class A. Which of the following statements is correct about construction of an object of class B?

A.While creating the object firstly the constructor of class B will be called followed by constructor of class A.
B.While creating the object firstly the constructor of class A will be called followed by constructor of class B.
C.The constructor of only class B will be called.
D.The constructor of only class A will be called.
E.The order of calling constructors depends upon whether constructors in class A and class B are private or public.