C Sample Test,Sample questions

Question:
  
Which of the following can implement an interface?

1.1,3

2.2,4

3.3,5

4.4only

Posted Date:-2021-02-25 03:11:55


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

1. An interface can contain properties, methods and events.
2. The keyword must implement forces implementation of an interface.
3. Interfaces can be overloaded.
4. Interfaces can be implemented by a class or a struct.
5. Enhanced implementations of an interface can be developed without breaking existing code.

1.1,2

2.1,4,5

3.3,4

4.3 only

Posted Date:-2021-02-25 03:11:55


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

interface IPerson
{ 
    String FirstName
    { 
        get; 
        set;
    }
    String LastName
    {
        get; 
        set;
    }
    void Print(); 
    void Stock(); 
    int Fun(); 

1.Properties cannot be declared inside an interface.

2.This is a perfectly workable interface.

3.The properties in the interface must have a body.

4.Subroutine in the interface must have a body.

Posted Date:-2021-02-25 03:11:55


Question:
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?

1.12 bytes

2.24 bytes

3.0 bytes

4.8 bytes

Posted Date:-2021-02-25 03:11:55


Question:
Which of the following can be declared in an interface?1. Properties2. Methods3. Enumerations4. Events5. Structures

1.1,3

2.1,2,4

3.3,5

4.4,5

Posted Date:-2021-02-25 03:11:55


Question:
Which of the following statements are correct about an interface in C#.NET?

1. A class can implement multiple interfaces.
2. Structures cannot inherit a class but can implement an interface.
3. In C#.NET, : is used to signify that a class member implements a specific interface.
4. An interface can implement multiple classes.
5. The static attribute can be used with a method that implements an interface declaration.

1.1,2,3

2.2,4

3.3,5

4. None of the above.

Posted Date:-2021-02-25 03:11:55


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

1.One class can implement only one interface.

2.In a program if one class implements an interface then no other class in the same program can implement this interface.

3. From two base interfaces a new interface cannot be inherited.

4.Properties can be declared inside an interface.

Posted Date:-2021-02-25 03:11:55


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

1.If a class implements an interface partially, then it should be an abstract class.

2.A class cannot implement an interface partially.

3.An interface can contain static methods.

4.An interface can contain static data.

Posted Date:-2021-02-25 03:11:55


Question:
Which of the following statements is correct about an interface?

1.One interface can be implemented in another interface.

2.An interface can be implemented by multiple classes in the same program.

3.A class that implements an interface can explicitly implement members of that interface.

4.The functions declared in an interface have a body.

Posted Date:-2021-02-25 03:11:55


Question:
Which of the following statements is correct about Interfaces used in C#.NET?

1. All interfaces are derived from an Object class.

2.Interfaces can be inherited.

3.All interfaces are derived from an Object interface.

4. Interfaces can contain only method declaration.

Posted Date:-2021-02-25 03:11:55


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

interface IMyInterface 
{
    void fun1(); 
    void fun2();
}
class MyClass: IMyInterface
{ 
    private int i; 
    void IMyInterface.fun1()
    { 
        // Some code
    } 
}

1.Class MyClass is an abstract class.

2.Class MyClass cannot contain instance data.

3.Class MyClass fully implements the interface IMyInterface.

4.The compiler will report an error since the interface IMyInterface is only partially implemented.

Posted Date:-2021-02-25 03:11:55


Question:
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()     { }  }

1. A function cannot be declared inside an interface.

2.A subroutine cannot be declared inside an interface.

3.A Method Table will not be created for class MyClass.

4.The definition of fun1() in class MyClass should be void IMyInterface.fun1().

Posted Date:-2021-02-25 03:11:55


Question:
Which of the following statements is correct?

1.When a class inherits an interface it inherits member definitions as well as its implementations.

2.An interface cannot contain the signature of an indexer.

3.Interfaces members are automatically public.

4.To implement an interface member, the corresponding member in the class must be public as well as static.

Posted Date:-2021-02-25 03:11:55


More MCQS

  1. C# MCQS -Programming (.NET Framework)
  2. C# MCQS -Programming(Control Instructions)
  3. C# MCQS - Functions and Subroutines(.NET Framework)
  4. C# Programming-Constructors
  5. C# Programming- Arrays
  6. C# Programming -Structures
  7. C# Programming-Properties
  8. C# Programming -Exception Handling
  9. C# Programming -Interfaces
  10. C# Programming -Delegates
  11. C# Programming -Generics
  12. C# Programming - Datatypes
  13. C# Programming- Operators
  14. C# Programming -Classes and Objects
Search
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!