Finals Flashcards
Unlike reference types, nullable types are tested for null using the IComparable method.
F
If variable x is null and variable y is false, then x|y is false
F
The Dictionary type is used to define a collection of key-value paris.
T
What is a generic class?
It is built using whatever type or types are passed into it when it is instantiated.
Give a statement declaring the variable X to be a nullable integer type.
int?x;
What is the purpose of the null coalescing operator?
Supplies alternative values if expression is null.
What is the null coalescing operator?
”??”
Give a statement declaring the varialbe students to be a generic collection that holds a collection of objects of type Student.
List students;
C# is a typesafe language
T
Operators can be roughly classified into three categories: numary, binary, and turnary.
F
A delegate is a type that enables a program to store references to functions.
T
InC#, all classes derive from the base class Parent at the root of all classes.
F
When an object is assigned to a variable, the variable actually receives a pointer to the object.
T
Protected class members are accessible only from code that is part of the class or from a class derived from it.
T
Fields, methods, and properties can also be declared using the keyword ‘global’ which means the are static members owned by the class.
F
Automatic properties must include both a Get and Set accessor.
T
Class definitikons can be split across multiple code fiels using the ‘partial’ keyword.
T
A class that implements an interface must implement all of the members defined by the interface as public.
T
Arrays in C# are implemented as instances of the ‘System.Array class and are just one type of what are known as colleciton classes.
T
Custom collection classes can be strongly typed.
T
The ‘GetIEnumerator’ mehtod allows iterating over a class.
F
An iterator is a block of code that supplies all the values used in a foreach block.
T
The ‘is’ operator can be used in a program to check whether an object either is or can be converted into a given type.
T
What is the term for the .net method of freeing up unused memory?
Garbage colleciton.
What are the loop statements in C#.
do while, do, for
What is the difference between implicit and explicit conversions?
Implicit conversions are done by the compiler automatically. Explicit conversions are done by the programmer.
What is a struct?
A struct is a data structure that is compiled of data members, which can be of different types.
By definitions, const members have what accessibility level?
Static
Why are properties the preferred way to access the state of an object?
To protect external code from implementation details.
What is the keyword ‘this’ used for in C#?
it refers to the current instance of an object.
Why would a programmer use the ‘new’ keyword in defining interface members.
To hide the parent interface members.
What are indexers?
Special properties that provide array-like access.
The ‘IEnumerable’ interface enables a program to use what kind of loop?
If
What are two types of comparisons between objects?
Value and Type
What is boxing?
Changing the type an object is into a System.Object type, or an Interface type.
What does operator overloading enable a progrmmer to do?
Manipulate the way an operator behave.