CIS 199 S19
A____is a special type of class member, similar to a method, that allows an object to store and retrieve a piece of data.
Property
The do-while repetition statement tests the condition__ the body of the loop executes
after
'T' is an example of a(n)_____literal
char
Which one of the following is a class header indicating that we are defining a class named Amphibian, and it is dervied from the Animal base class.
class Amphibian : Animal
Using the code fragment below, when does Excellent get displayed? if (score > 89) grade = 'A'; WriteLine ("Excellent");
everytime the program is run
Sentinel-controlled repetition is an example of :
indefinite repetition
In object-oriented programming, ____is used to create an "is a" relationship among classes.
inheritance
What data types is the numeric literal 25 stored as?
int
How many iterations will the following loop complete? for(int i = 10; i <= 1; --1) WriteLine ("i = " + i);
0
How many iterations will the following loop complete? for (int i = 10; i >= 1; ++) WriteLine("i = " +i);
11
What will the value of the variable test be after the following sequence of statements complete execution? int x = 41; int test; test = ++x;
42
What does the following C# expression evaluate to? 7 - 2 * 3 + 4
5
How many iteration will the following loop complete? for (int i = 1; i < 10; ++i) WriteLine("i = " + i );
9
The equality operator in C# is ____.
==
Which of the following statements declared a variable named fox that references an instance of the Animal class? Animal = new Animal(); new Animal(fox); Animal fox(new); new Animal fox();
Animal fox = new Animal();
A member that is declared with private visibility in a base class can also be seen in the derived class
False
In C# arrats, the first element is found at index position one (i.e a[1])
False
The name of a class's constructor is the same as the name of the class with the addition of a leading underscore character, as in _ClassName
False
The names of the variable in the header of a method's definition (not its call) are known as arguments
False
Variables declared in the body of a particular method are know as instance variables or fields and can be used in all methods of the class.
False
When an array is passed to a method through a parameter, it is always passed by reference. this means that a method may always cause the argument to point a different array that was sent to the method.
False
by default, all parameters are passed by reference
False
__ errors are not violations of the programming language rules. Instead, the code will execute but produces incorrect results.
Logical (or semantic)
Which property of a Window's form controls the message displayed in the form's title bar?
Text
A member that is declared with protected visibility in a base class can also bee seen in the derived class
True
A radio button is typically used with other radio buttons to provide a set of mutually exclusive options from which, at most, one may be chosen at a time
True
A string literal that begins with a $ indicates that string interpolation is being used
True
C# respects the case of identifiers, so variable name test123 is different from Test123 and TEST123.
True
Equality comparisons with floating-point types can sometimes produce unpredictable results because of the way these types are represented in memory, especially after numeric calculations have been performed
True
If you don't write any constructor for a class, C# will provide one by default
True
Once an array object's size has been allocated, that array object's size may not be changed.
True
Preconditions and postconditions for a method should describe what the method does without telling how the method works.
True
When arrays of primitive numeric types (such as int and double) are allocated, C# automatically Memement to zero.
True
When if-else statements are nested, each else always is paired with the most unpaired if (unless curly braces force another pairing)
True
When you choose to use an auto-implemented property class, the compiler is responsible for creating the associated backing field, so the programmer doesn't have to
True
You can end a void method with the following statement that indicates nothing is returned: return;
True
You may not modify array elements traversed using a foreach loop
True
The private instance variable, which is know as the property's____, typically holds any data that is assigned using the property.
backing field
When you want to make sure a specific constructor from the base class is used, the derived class constructor must explicitly call the base class constructor using the ___ in a constructor clause
base keyword
A(n)____ is a special type of a class member, similar to a method, that is automatically executed when an object is created.
constructor
Which of the statements below are functional equivalent to the given statement --count; a. count -= 1 ; b. count -= 1; c. count = count - 1; d. count --;
count -= 1; count = count -1; count --;
In a switch statement, a case can be labeled as __to execute in the event that none of the other provided cases match the test expression
default:
Counter-controlled repetition is an example of :
definite repitition
A class that inherits from a base class is a ____
derived class
A(n) ____ involves placing the desired result type in parentheses followed by the variable or constant to be cast
explicit cast
An abstract class can be instantiated like any other class, directly objects of that type
false
When naming classes in C# the tradition is to use camel case, just like variables are named
false
With a ___ loop, you can indicate the starting value for the loop control variable, the test condition that controls loop entry, and the expression that alters the loop control variable, all in one convenient place.
for
A read-only property will only include a public ___.
get accessor
Memory for an array is typically allocated by using keyword____.
new
Every class you create C# ultimately derives from a single class named___
object
When you create an instance of a class, you create a(n)___.
object
A(n)___ works like a reference (ref) parmeter, but the argument does not have to be set to a value before it is passed into the parameter.
output (out) parameter
When you create an additional method definition with the same method name as the original but with a different parameter list, it is know as method____.
overloading
When you replace a base class method definition with one in the derived class using the same method name and parameter list as the original but new method body, it is known as a
overriding
A constructor that requires no arguments in order to be called is known as a(n) ___ constructor
parameterless
With inheritance, the original class that is used to derive a new one is called the ___. parent class base class superclass subclass super class dervied class
parent class base class super class
When you want a method to be able to change the value of a variable that is passed to its as an argument, the variable must be ___
passed by reference
A while loop is a(n) __ loop
pretest
Instance variables(field) and methods declared with the __ modifier are only accessible within that class definition
private
Any time a value is assigned to a property, the property's ____is executed, and the value being assigned is passed into the value parameter
set accessor
Programmers commonly use a technique known as ___ to break down a complex task into subtasks that are often implemented as methods
top-down design
Look a the following code sample: int[,] values = {{1, 2, 3, 4 }, {5, 6, 7, 8 }}; What is the value stored in value [2, 2]
unknown because it produces an error
in property's set accessor, the implicit parameter automatically created by the complier is named___.
value