0% found this document useful (0 votes)
14 views3 pages

Q13

Questions of CSharp

Uploaded by

Raj Khan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views3 pages

Q13

Questions of CSharp

Uploaded by

Raj Khan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

Q01.

__________ does not contain any code or data; it just specifies the methods
and properties that a class that implements it must provide.
A. An enumeration
B. A structure
C. An interface
D. An abstract class

Q02. Which one of the following enables you to completely separate the names and
signatures of the methods of a class from the method’s implementation?
A. An enumeration
B. A structure
C. An interface
D. An abstract class

Q03. Which one of the following are similar to interfaces in many ways?
A. An enumeration
B. A structure
C. A delegate
D. An abstract class

Q04. What is the difference between an interface and an abstract class?


A. An interface contains only abstract methods and properties whereas an abstract
class contains only concrete methods and properties
B. An interface contains only concrete methods and properties whereas an abstract
class contains only abstract methods and properties
C. An interface contains only abstract methods and properties whereas an abstract
class contains both concrete and abstract methods and properties
D. An interface contains both abstract and concrete methods and properties whereas
an abstract class contains only abstract methods and properties

Q05. If a class implements an interface, __________________.


A. the interface guarantees that the all instances of the class are created only
using the default constructor
B. the interface guarantees that the class contains all the methods specified in
the interface.
C. the interface guarantees that all methods of the the class can be called without
created any instance
D. the interface guarantees that the class cannot be inherited further

Q06. _____________ does not contain any code or data.


A. An interface
B. An abstract class
C. A static class
D. A sealed class

Q07. In an interface you define ________________________


A. the name, return type, parameters and the body of the method
B. only the name, return type, and parameters of the method, not the method body
C. only the name, parameters of the method
D. only the name, return type of the method

Q08. The interface describes ___________________________________.


A. the functionality that a class should provide
B. how this functionality is implemented
C. all of the above
D. none of the above

Q09. Which one is true for an interface?


A. An interface gives you the name, return type, parameters and implementation of
the method
B. An interface gives you only the name, return type, and parameters of the method
but no implementation
C. An interface gives you the name, return type, and parameters of the method and
sometimes default implementation of the method
D. An interface gives you only properties but no method

Q10. Which one is not true for an interface?


A. You define methods without any access modifier
B. The methods in an interface have no implementation
C. You can add virtual keywords to methods in an interface
D. All methods in an interface are implicitly public

Q11. Which interface definition is correct?


A. interface ILandBound { public int NumberOfLegs(); }
B. interface ILandBound { public virtual int NumberOfLegs(); }
C. interface ILandBound { int NumberOfLegs() { return 0; } }
D. interface ILandBound { int NumberOfLegs(); }

Q12. All methods in an interface are implicitly ______________.


A. public
B. private
C. protected
D. internal

Q13. Which rule is not required to meet, when you implement an interface?
A. The method names and return types match exactly
B. Any parameters (including ref and out keyword modifiers) match exactly
C. The methods have override keyword
D. All methods implementing an interface must be publicly accessible if you are
using an explicit interface implementation

Q15. The Horse class inherits from the Mamma class and implements ILandBound. How
do you define it?
A. class Horse : Mammal ,ILandBound { ... }
B. class Horse : Mammal : ILandBound { ... }
C. class Horse : ILandBound, Mammal { ... }
D. class Horse : Mammal inherits ILandBound { ... }

Q16. Which statement is true?


A. A class can have one base class, but it is allowed to implement an unlimited
number of interfaces.
B. A class can have multiple base classes but it is allowed to implement one
interface.
C. A class can have one base class, and it is allowed to implement one interface.
D. A class can have multiple one base classes, but it is allowed to implement
multiple interfaces.

Q17. Which one is not true?


A. You’re not allowed to define any fields in an interface, not even static fields.
B. You’re not allowed to define a destructor in an interface.
C. You cannot specify an access modifier for any method.
D. An interface is not allowed to inherit from an interface.

Q18. An interface is not allowed to inherit from a structure or a class, although


an interface can inherit from another interface.
A. True
B. False
Q19. A class is allowed to implement an unlimited number of interfaces.
A. True
B. False

Q20. You can use public access modifier to a method when you explicitly
implementing an interface.
A. True
B. False

Q21. You are allowed to define any fields in an interface, not even static fields.
A. True
B. False

Q22. You are allowed to define a default constructor in an interface.


A. True
B. False

Q23. You cannot specify an access modifier for any method in an interface.
A. True
B. False

Q24. You cannot create an instance of an abstract class.


A. True
B. False

Q25. How can you prevent a class from being used as a base class?
A. By adding the abstract keyword
B. By adding the sealed keyword
C. By adding the private keyword
D. By adding the protected keyword

Q26. Which class cannot be inherited?


A. abstract class
B. private class
C. static class
D. sealed class

Q27. Which method a derived class cannot override?


A. abstract method
B. static method
C. protected method
D. sealed method

Q28. A ________ is the first implementation of a method.


A. virtual method
B. sealed method
C. abstract method
D. overridden method

Q29. A ________ is the last implementation of a method.


A. virtual method
B. sealed method
C. abstract method
D. overridden method

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy