TRUE OR FALSE 1. To implement an interface, a class must provide an implementati
ID: 3603475 • Letter: T
Question
TRUE OR FALSE
1. To implement an interface, a class must provide an implementation of every member in the interface.
(a) True (b) False
2. To declare a get accessor for a property in an interface, you code "get".
(a) True (b) False
3. Write the declaration for a class named Book that implements the ICloneable and IDisplayable interfaces: public class Book : ICloneable, IDisplayable
(a) True (b) False
4. The abstract methods and properties of a class do not provide an implementation.
(a) True (b) False
5. Concrete classes provide implementations for every method and property they define.
(a) True (b) False
6. An abstract class may be derived from another abstract class.
(a) True (b) False
7. Objects of abstract base classes can be instantiated.
(a) True (b) False
8. An abstract class cannot have instance data and non-abstract methods.
(a) True (b) False
9. A concrete class that implements an interface must define all methods and properties of that interface.
(a) True (b) False
10. An interface can not provide properties with get and set accessors.
(a) True (b) False
11. A class that implements an interface may not act as a base class for other classes.
(a) True (b) False
12. An interface reference may invoke only the methods that the interface declares.
(a) True (b) False
Explanation / Answer
1. TRUE
Explanation: The class that implements interface must implement all the methods of that interface
2. TRUE
Explanation: syntax for creating interface
public Interface interface_name
{
type method_name(parameters)
type propertyName
{
[get];
[set];
}
....
}
3.TRUE
Explanation:
syntax to create multiple interface for a class
public class class_Name implements (or): interface1,interface2
4.TRUE
Explanation: An abstract method is a method that is declared without an implementation without braces, and followed by a semicolon
Example: abstract void swap(double x, double y);
5.TRUE
Explanation: abstract class is defines an interface, but does not necessarily provide implementations for all its member functions. An abstract class is meant to be used as the base class from which other classes are derived. The derived class is provide implementations for the member functions that are not implemented in the base class. A derived class that implements all the missing functionality is called a concrete class .
6.TRUE
yes, we can derived abstractclass from another, If you extend a class with an abstract class and not define or provide the implementation for the base class abstract methods then the child class extending it would automatically become abstract
7.FALSE
Explanation: Attempting to instantiate an object of an abstract class leades compilation error
8.FALSE
Explanation:An abstract class can have instance data and non-abstract methods.
9.TRUE
10.FALSE
Explanation:
public interface SampleInterface {
// Property declaration: string Name
{
get;
set;
}
}
The accessor of an interface property does not have a body.
11.FALSE
Explanation: A class that implements an interface may be inherited by derived classes.
12.TRUE
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.