[go: up one dir, main page]

0% found this document useful (0 votes)
64 views2 pages

Quiz

The document discusses various topics related to C# programming concepts like data types, inheritance, interfaces, generics, delegates and events. Some key points covered are: - Value types include bool and struct while reference types include string and all types implicitly derive from System.Object. - C# supports single inheritance of classes but allows a class to implement multiple interfaces. Method overloading is different from overriding. - Access modifiers like internal limit access within the current project assembly. Generics can be used in interfaces, structs, instance methods but not static methods. - Interfaces cannot provide method implementations or include fields. The yield operator can be used to support enumeration in a class. - Common namespaces and interfaces related to
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
64 views2 pages

Quiz

The document discusses various topics related to C# programming concepts like data types, inheritance, interfaces, generics, delegates and events. Some key points covered are: - Value types include bool and struct while reference types include string and all types implicitly derive from System.Object. - C# supports single inheritance of classes but allows a class to implement multiple interfaces. Method overloading is different from overriding. - Access modifiers like internal limit access within the current project assembly. Generics can be used in interfaces, structs, instance methods but not static methods. - Interfaces cannot provide method implementations or include fields. The yield operator can be used to support enumeration in a class. - Common namespaces and interfaces related to
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

1.

A bool is a value type


2. A struct is a value type
3. A string is a reference type
4. All types in C# implicitly derive from System.Object class
5. Does C# support multiple inheritance? No
6. Interfaces provide implementations of methods false
7. You can inherit multiple interfaces in C# true
8. Method overloading and overriding are the same thing false
9. A class in C# can be derived from: A single non-sealed class
10. Define the keyword internal and give a usage of it. Internal is one of the access modifiers that
limits the access to types defined within the current project assembly.
11. True or false, generics can be used in interfaces. true
12. True or false, generics can be used in instance methods in a non- true
13. True or false, generics can be used in structs. true
14. True or false, generics can be used in static methods in a class. False
15. Interfaces can provide implementation of methods. False
16. Interfaces can include fields. False
17. Assume you are given the class below and need to extend it to support enumeration, such that it
can be used in a foreach statement to obtain each grade. Modify the class to support this using the
yield operator: public class StudentGrades {
private char[] grades; }
Which keyword is used to define a loop statement that iterates Foreach
18. ReadOnlyCollection<T> is in which namespace? System.collections.generic
19. The generic interface IEnumerable<T> contains only one method, GetEnumerator
20. The generic interface IEnumerator<T> contains only one property, what is it? Current

21. The statement below will: "World".CompareTo("Hello"); Return an integer equal to one
22. If we change a member variable of a class instance, the retum the same value as before the
change
23. The IComparable<T> interface contains one method named CompareTo
24. What does referential equality mean?
25. The generic Collection<T> class implements which of the following ILISt<T> and
ICollection<T>
26. The statement below will: 32.CompareTo(8*4); return 0

27. Delegates are: reference type

28. The keyword partial signifies: A class or method that indicates the definition of the class or
method is split.

29. True or false, a publicly exposed event allows the client of the class to fire the event. False

30. A delegate is: A type definition

31. Delegates can be used with Generic types: true

32. Assume that myDelegate is a variable of type:


delegate void WriteMsg(string message);
...
The following line will: myDelegate("Save the Cheerleader"); Call a list of functions with a string or
throw an exception.
33. Given the delegate: delegate float MyFunc( object sender, MyEventArgs e)
Can we assign the method below to a variable of type MyFunc? float Scream(object sender,
EventArgs e) Yes, but only if MyEventArgs derives from EventArgs
34. The event keyword indicates
1) An instance of a delegate
2) A protection againt using the = operator
3) A protection against calling the functions to by the event.
4) All of the above

You might also like