php mcq questions with answers


                                

Which of the following are necessary for Run-time Polymorphism?

  1. The overridden base method must be virtual, abstract or override.
  2. Both the override method and the virtual method must have the same access level modifier.
  3. An override declaration can change the accessibility of the virtual method.
  4. An abstract inherited property cannot be overridden in a derived class.
  5. An abstract method is implicitly a virtual method.

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

Which of the following statements is correct about the C#.NET code snippet given below?

interface IMyInterface
{ 
    void fun1(); 
    int fun2();
}
class MyClass: IMyInterface
{ 
    void fun1()
    { } 
    int IMyInterface.fun2()
    { } 
}

A.A function cannot be declared inside an interface.
B.A subroutine cannot be declared inside an interface.
C.A Method Table will not be created for class MyClass.
D. MyClass is an abstract class.
E.The definition of fun1() in class MyClass should be void IMyInterface.fun1().
                                

Which of the following can be declared in an interface?

  1. Properties
  2. Methods
  3. Enumerations
  4. Events
  5. Structures

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

A class implements two interfaces each containing three methods. The class contains no instance data. Which of the following correctly indicate the size of the object created from this class?

A.12 bytes
B.24 bytes
C.0 byte
D.8 bytes
E.16 bytes
                                

Which of the following statements is correct about an interface used in C#.NET?

A.One class can implement only one interface.
B.In a program if one class implements an interface then no other class in the same program can implement this interface.
C.From two base interfaces a new interface cannot be inherited.
D.Properties can be declared inside an interface.
E.Interfaces cannot be inherited.