Q17
Q17
A. Object only
B. Object and struct
C. Object, struct and enum
D. Value of any type
Q06. A class designed to take parameters that can be cast to different types is a
_____________.
A. generalized class
B. generic class
C. abstract class
D. template class
Q09. Which one makes easier to create generalized classes and methods?
A. Generic
B. Object base class
C. Abstract class
D. Interface
Q10. Which one makes a generic class different from a normal class?
A. A generic class is a value type
B. A generic class does not support inheritance
C. A generic class accepts type parameters, which specify the types of data on
which they operate
D. A generic class cannot be a base class
Q15. How can you limit the type parameters of a generic class to those that
implement a particular set of interfaces?
A. By using a constraint
B. By implementing interfaces
C. By using inheritance
D. All of the above
Q16. If you are defining a PrintableCollection class, you might want to ensure that
all objects stored in the class must implement IPrintable interface. How can you do
that?
A. class PrintableCollection<T: IPrintable >
B. class PrintableCollection<T where T : IPrintable>
C. class PrintableCollection<IPrintable T>
D. class PrintableCollection<T> where T : IPrintable
Q18. When the CompareTo method of an IComparable object returns a value greater
than 0, what does it indicate?
A. The current instance is less than the value of the parameter
B. The current instance is equal to the value of the parameter
C. The current instance is greater than the value of the parameter
D. The CompareTo method does not return an integer value
Q19. When the CompareTo method of an IComparable object returns 0, what does it
indicate?
A. The current instance is less than the value of the parameter
B. The current instance is equal to the value of the parameter
C. The current instance is greater than the value of the parameter
D. The CompareTo method does not return an integer value
Q20. Which keyword do you use before the type parameter to create a generic
covariant interface?
A. in
B. out
C. ref
D. as
Q21. Which keyword do you use before the type parameter to create a generic
contravariant interface?
A. in
B. out
C. ref
D. as