1. Listing cases consecutively with no statements between them enables the cases to perform the same set of statements.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
2. An expression containing operator || is true if either or both of its operands are true.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
3. The default label is required in the switch selection statement.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
4. Assume the integer variables sum and count have been declared. This code sums the odd integers between 1 and 99, inclusive, using a for statement.
sum = 0;
for ( count = 1; count <= 99; count += 2 )
sum += count;
A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
5. The integer after the comma (,) in a format item ( e.g., {0,4} ) indicates the field width of the displayed string.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
6. The expression ( x > y && a < b ) is true if either the expression x > y is true or the expression a < b is true.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
7. To test for a range of values in a switch statement, use a hyphen ( - ) between the start and end values of the range in a case label.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
8. The break statement is required in every case of a switch selection statement to exit the switch properly.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
9. Assume that the variable n has been declared, but not initialized. Which of these match the output of these C# statements?
n = 1;
while ( n < 10 )
Console.Write( n++ );
A) 0123456789
B) 012345678910
C) 123456789
D) 12345678910
E) None of these.
Points Earned: 1.0/1.0
Correct Answer(s): C
10. Match each of these code segments to the appropriate comment.
A. The code segment has valid syntax, but it has some other error.
B. The code segment has valid syntax and no logic errors.
C. Infinite loop.
D. Floating-point number is not allowed here.
E. The code segment has invalid syntax.
F. Missing break statement.
ABCDEF
float y;
for ( y = .1; y != 1.0; y += .1 )
Console.WriteLine( y );
ABCDEF
x = 1;
while (x <= 10);
{
x++;
}
ABCDEF
n = 1;
while ( n < 10 )
Console.WriteLine( n++ );
ABCDEF
int n;
n = 1;
switch ( n )
{
case 1:
Console.WriteLine( "The number is 1." );
case 2:
Console.WriteLine( "The number is 2." );
break;
default:
Console.WriteLine( "The number is not 1 or 2." );
break;
}
Points Earned: 4.0/4.0
Correct Answer(s): Infinite loop. :
x = 1;
while (x <= 10);
{
x++;
}, Floating-point number is not allowed here. :
float y;
for ( y = .1; y != 1.0; y += .1 )
Console.WriteLine( y );, Missing break statement. :
int n;
n = 1;
switch ( n )
{
case 1:
Console.WriteLine( "The number is 1." );
case 2:
Console.WriteLine( "The number is 2." );
break;
default:
Console.WriteLine( "The number is not 1 or 2." );
break;
}, The code segment has valid syntax and no logic errors. :
n = 1;
while ( n < 10 )
Console.WriteLine( n++ );
11. Assume that the variable x has been declared, but not initialized. Select the phrase that describes the effect of each these proposed C# statements or groups of statements.
A. This code prints a newline character if x is evenly divisible by 5. If it is not, a tab character is printed.
B. A statement that prints an integer and advances to a new line.
C. The control statement of a for loop that loops 20 times. The counter variable is x.
D. A statement that prints an integer but does not advance to the next line.
E. The code has invalid syntax.
F. The number 2.5 is raised to the power of 3.
G. The statement has valid syntax, but does none of the above.
H. The control statement of a while loop that loops 20 times. The counter variable is x.
I. The number 3 is raised to the power of 2.5.
ABCDEFGHIConsole.Write( x );
ABCDEFGHI
if ( x % 5 == 0 )
Console.WriteLine();
else
Console.Write('\t');
ABCDEFGHIfor ( x = 1; x <= 20; x++ )
ABCDEFGHIdouble result = math.Pow( 2.5, 3 );
ABCDEFGHIwhile ( x <= 20 )
Points Earned: 4.0/4.0
Correct Answer(s): The control statement of a while loop that loops 20 times. The counter variable is x. : while ( x <= 20 ), The control statement of a for loop that loops 20 times. The counter variable is x. : for ( x = 1; x <= 20; x++ ), The number 2.5 is raised to the power of 3. : double result = math.Pow( 2.5, 3 );, A statement that prints an integer but does not advance to the next line. : Console.Write( x );, This code prints a newline character if x is evenly divisible by 5. If it is not, a tab character is printed. :
if ( x % 5 == 0 )
Console.WriteLine();
else
Console.Write('\t');
12. Select the best word or operator to fill the blank.
A. before
B. dynamic
C. true
D. switch
E. while
F. if
G. for
H. continue
I. break
J. static
K. &&
L. false
M. after
N. ||
ABCDEFGHIJKLMNTypically, ____ statements are used for sentinel-controlled repetition.
ABCDEFGHIJKLMNThe ___ statement, when executed in a repetition statement, skips the remaining statements in the loop body and proceeds with the next iteration of the loop.
ABCDEFGHIJKLMNTypically, ____ statements are used for counter-controlled repetition.
ABCDEFGHIJKLMNIf the loop-continuation condition in a for header is initially ____, the for statement's body does not execute.
ABCDEFGHIJKLMNMethods that perform common tasks and do not need to be called on objects are called ____ methods.
ABCDEFGHIJKLMNThe ____ operator can be used to ensure that two conditions are both true before choosing a certain path of execution.
ABCDEFGHIJKLMNThe ____ statement selects among multiple actions based on the possible values of an integer variable or expression.
ABCDEFGHIJKLMNThe do...while statement tests the loop-continuation condition ____ executing the loop's body.
Points Earned: 7.0/7.0
Correct Answer(s): for : Typically, ____ statements are used for counter-controlled repetition., while : Typically, ____ statements are used for sentinel-controlled repetition., after : The do...while statement tests the loop-continuation condition ____ executing the loop's body., switch : The ____ statement selects among multiple actions based on the possible values of an integer variable or expression., continue : The ___ statement, when executed in a repetition statement, skips the remaining statements in the loop body and proceeds with the next iteration of the loop., && : The ____ operator can be used to ensure that two conditions are both true before choosing a certain path of execution., false : If the loop-continuation condition in a for header is initially ____, the for statement's body does not execute., static : Methods that perform common tasks and do not need to be called on objects are called ____ methods.
Wednesday, June 3, 2009
phrase of C++
1. Select the phrase that describes the effect of each these proposed C++ statements.
A. Declare variable sum to be of type int.
B. The proposed statement has invalid syntax.
C. The statement has valid syntax, but does none of the above.
D. Print "The sum is: " followed by the value of variable sum.
E. Set variable x to 1.
F. Declare variable x to be of type int.
G. Set variable sum to 0.
H. Add variable x to variable sum and assign the result to variable sum.
ABCDEFGHint x;
ABCDEFGHx = 1;
ABCDEFGH1 = x;
ABCDEFGHint sum;
ABCDEFGH0 = sum;
ABCDEFGHsum int;
ABCDEFGHsum = 0;
ABCDEFGHsum += x;
ABCDEFGHx += x;
ABCDEFGHConsole.WriteLine( "The sum is: {0}", sum );
ABCDEFGHConsole.WriteLine( "The sum is:{0}", sum );
ABCDEFGHx int;
Points Earned: 10.0/12.0
Correct Answer(s): Declare variable sum to be of type int. : int sum;, Declare variable x to be of type int. : int x;, Set variable x to 1. : x = 1;, Set variable sum to 0. : sum = 0;, The statement has valid syntax, but does none of the above. : x += x;, The proposed statement has invalid syntax. : 0 = sum;, Add variable x to variable sum and assign the result to variable sum. : sum += x;, Print "The sum is: " followed by the value of variable sum. : Console.WriteLine( "The sum is: {0}", sum );, The proposed statement has invalid syntax. : sum int;, The proposed statement has invalid syntax. : x int;, The proposed statement has invalid syntax. : 1 = x;, The statement has valid syntax, but does none of the above. : Console.WriteLine( "The sum is:{0}", sum );
2. Select the matching word or phrase.
A. for-next
B. definite
C. loop
D. if-else
E. if-true
F. flag
G. process
H. repetition
I. sequence
J. selection
K. loop-while
L. statement
M. loop-when
N. for-loop
O. if-then
ABCDEFGHIJKLMNOThe ____ selection statement is used to execute one action when a condition is true or a different action when the condition is false.
ABCDEFGHIJKLMNOWhen it is not known in advance how many times a set of statements will be repeated, a(n) ____ value can be used to terminate the repetition.
ABCDEFGHIJKLMNORepeating a set of instructions a specific number of times is called ____ repetition.
ABCDEFGHIJKLMNOAll programs can be written in terms of three types of control structures: loop, decision and ____.
Points Earned: 4.0/4.0
Correct Answer(s): sequence : All programs can be written in terms of three types of control structures: loop, decision and ____., definite : Repeating a set of instructions a specific number of times is called ____ repetition., flag : When it is not known in advance how many times a set of statements will be repeated, a(n) ____ value can be used to terminate the repetition., if-else : The ____ selection statement is used to execute one action when a condition is true or a different action when the condition is false.
3. Select the phrase that describes the effect of each these proposed C++ statements.
A. If count is greater than 10, print "Count is greater than 10."
B. Calculate the remainder after q is divided by divisor and assign the result to q.
C. Assign the sum of x and y to z and then add 1 to x.
D. The statement has valid syntax, but does none of the above.
E. Add 1 to x and then assign the sum of x and y to z.
F. Predecrement the variable x and then subtract it from total.
G. The proposed statement has invalid syntax.
ABCDEFGq = q % divisor;
ABCDEFGx++ + y = z;
ABCDEFGz = x++ + y;
ABCDEFGif ( count > 10 ) Console.WriteLine( "Count is greater than 10." );
ABCDEFGtotal = --x;
ABCDEFGtotal -= --x;
ABCDEFGtotal = total - x;
ABCDEFGz = ++x + y;
ABCDEFGq %= divisor;
Points Earned: 9.0/9.0
Correct Answer(s): Assign the sum of x and y to z and then add 1 to x. : z = x++ + y;, The proposed statement has invalid syntax. : x++ + y = z;, Add 1 to x and then assign the sum of x and y to z. : z = ++x + y;, If count is greater than 10, print "Count is greater than 10." : if ( count > 10 ) Console.WriteLine( "Count is greater than 10." );, Predecrement the variable x and then subtract it from total. : total -= --x;, The statement has valid syntax, but does none of the above. : total = total - x;, The statement has valid syntax, but does none of the above. : total = --x;, Calculate the remainder after q is divided by divisor and assign the result to q. : q %= divisor;, Calculate the remainder after q is divided by divisor and assign the result to q. : q = q % divisor;
4. Consider each statement separately and independently. For each, assume that a has a value of 120 and x has a value of 5 before the statement is executed. What will the variables' values be after they execute?
A. a = 20, x = 6
B. a = 480, x = 4
C. a = 480, x = 5
D. a = 24, x = 4
E. a = 720, x = 6
F. The statement has invalid syntax.
G. a = 24, x = 5
H. a = 20, x = 4
I. a = 24, x = 6
J. a = 600, x = 5
K. a = 480, x = 6
L. a = 30, x = 6
M. a = 720, x = 4
N. a = 720, x = 5
O. a = 30, x = 4
P. The statement has valid syntax, but none of the above is correct. The statement has valid syntax, but none of the above is correct.
Q. a = 20, x = 5
R. a = 30, x = 5
S. a = 600, x = 4
T. a = 600, x = 6
ABCDEFGHIJKLMNOPQRSTa /= --x;
ABCDEFGHIJKLMNOPQRSTa /= x--;
ABCDEFGHIJKLMNOPQRSTa *= ++x;
ABCDEFGHIJKLMNOPQRSTa *= x;
ABCDEFGHIJKLMNOPQRSTa /= x;
ABCDEFGHIJKLMNOPQRSTa *= x++;
Points Earned: 6.0/6.0
Correct Answer(s): a = 600, x = 6 : a *= x++;, a = 24, x = 4 : a /= x--;, a = 720, x = 6 : a *= ++x;, a = 30, x = 4 : a /= --x;, a = 600, x = 5 : a *= x;, a = 24, x = 5 : a /= x;
5. Select the phrase that describes the effect of each these proposed C++ statements.
A. The statement has valid syntax, but does none of the above.
B. Multiply a and b, putting the result in c.
C. Multiply c by 5, putting the result in c.
D. Add a and b, putting the result in c.
E. Add 1 to c, putting the result in c.
F. Multiply b by a, putting the result in b.
G. The proposed statement has invalid syntax.
H. Add a to b, putting the result in b.
ABCDEFGH++c;
ABCDEFGHc = c * 5;
ABCDEFGHc += 1;
ABCDEFGHc = a * b;
ABCDEFGHc *= 5;
ABCDEFGHc = a + b
ABCDEFGH**c;
ABCDEFGHc = b + a;
ABCDEFGHb *= a;
ABCDEFGHc = c + 1;
ABCDEFGHc**;
ABCDEFGHc = b * a
ABCDEFGHc++;
ABCDEFGHb += a;
Points Earned: 13.0/14.0
Correct Answer(s): Add 1 to c, putting the result in c. : c += 1;, Add 1 to c, putting the result in c. : ++c;, Add 1 to c, putting the result in c. : c++;, Multiply c by 5, putting the result in c. : c = c * 5;, Multiply a and b, putting the result in c. : c = a * b;, The proposed statement has invalid syntax. : c = b * a, Multiply b by a, putting the result in b. : b *= a;, Multiply c by 5, putting the result in c. : c *= 5;, The proposed statement has invalid syntax. : **c;, The proposed statement has invalid syntax. : c**;, Add 1 to c, putting the result in c. : c = c + 1;, The proposed statement has invalid syntax. : c = a + b, Add a and b, putting the result in c. : c = b + a;, Add a to b, putting the result in b. : b += a;
A. Declare variable sum to be of type int.
B. The proposed statement has invalid syntax.
C. The statement has valid syntax, but does none of the above.
D. Print "The sum is: " followed by the value of variable sum.
E. Set variable x to 1.
F. Declare variable x to be of type int.
G. Set variable sum to 0.
H. Add variable x to variable sum and assign the result to variable sum.
ABCDEFGHint x;
ABCDEFGHx = 1;
ABCDEFGH1 = x;
ABCDEFGHint sum;
ABCDEFGH0 = sum;
ABCDEFGHsum int;
ABCDEFGHsum = 0;
ABCDEFGHsum += x;
ABCDEFGHx += x;
ABCDEFGHConsole.WriteLine( "The sum is: {0}", sum );
ABCDEFGHConsole.WriteLine( "The sum is:{0}", sum );
ABCDEFGHx int;
Points Earned: 10.0/12.0
Correct Answer(s): Declare variable sum to be of type int. : int sum;, Declare variable x to be of type int. : int x;, Set variable x to 1. : x = 1;, Set variable sum to 0. : sum = 0;, The statement has valid syntax, but does none of the above. : x += x;, The proposed statement has invalid syntax. : 0 = sum;, Add variable x to variable sum and assign the result to variable sum. : sum += x;, Print "The sum is: " followed by the value of variable sum. : Console.WriteLine( "The sum is: {0}", sum );, The proposed statement has invalid syntax. : sum int;, The proposed statement has invalid syntax. : x int;, The proposed statement has invalid syntax. : 1 = x;, The statement has valid syntax, but does none of the above. : Console.WriteLine( "The sum is:{0}", sum );
2. Select the matching word or phrase.
A. for-next
B. definite
C. loop
D. if-else
E. if-true
F. flag
G. process
H. repetition
I. sequence
J. selection
K. loop-while
L. statement
M. loop-when
N. for-loop
O. if-then
ABCDEFGHIJKLMNOThe ____ selection statement is used to execute one action when a condition is true or a different action when the condition is false.
ABCDEFGHIJKLMNOWhen it is not known in advance how many times a set of statements will be repeated, a(n) ____ value can be used to terminate the repetition.
ABCDEFGHIJKLMNORepeating a set of instructions a specific number of times is called ____ repetition.
ABCDEFGHIJKLMNOAll programs can be written in terms of three types of control structures: loop, decision and ____.
Points Earned: 4.0/4.0
Correct Answer(s): sequence : All programs can be written in terms of three types of control structures: loop, decision and ____., definite : Repeating a set of instructions a specific number of times is called ____ repetition., flag : When it is not known in advance how many times a set of statements will be repeated, a(n) ____ value can be used to terminate the repetition., if-else : The ____ selection statement is used to execute one action when a condition is true or a different action when the condition is false.
3. Select the phrase that describes the effect of each these proposed C++ statements.
A. If count is greater than 10, print "Count is greater than 10."
B. Calculate the remainder after q is divided by divisor and assign the result to q.
C. Assign the sum of x and y to z and then add 1 to x.
D. The statement has valid syntax, but does none of the above.
E. Add 1 to x and then assign the sum of x and y to z.
F. Predecrement the variable x and then subtract it from total.
G. The proposed statement has invalid syntax.
ABCDEFGq = q % divisor;
ABCDEFGx++ + y = z;
ABCDEFGz = x++ + y;
ABCDEFGif ( count > 10 ) Console.WriteLine( "Count is greater than 10." );
ABCDEFGtotal = --x;
ABCDEFGtotal -= --x;
ABCDEFGtotal = total - x;
ABCDEFGz = ++x + y;
ABCDEFGq %= divisor;
Points Earned: 9.0/9.0
Correct Answer(s): Assign the sum of x and y to z and then add 1 to x. : z = x++ + y;, The proposed statement has invalid syntax. : x++ + y = z;, Add 1 to x and then assign the sum of x and y to z. : z = ++x + y;, If count is greater than 10, print "Count is greater than 10." : if ( count > 10 ) Console.WriteLine( "Count is greater than 10." );, Predecrement the variable x and then subtract it from total. : total -= --x;, The statement has valid syntax, but does none of the above. : total = total - x;, The statement has valid syntax, but does none of the above. : total = --x;, Calculate the remainder after q is divided by divisor and assign the result to q. : q %= divisor;, Calculate the remainder after q is divided by divisor and assign the result to q. : q = q % divisor;
4. Consider each statement separately and independently. For each, assume that a has a value of 120 and x has a value of 5 before the statement is executed. What will the variables' values be after they execute?
A. a = 20, x = 6
B. a = 480, x = 4
C. a = 480, x = 5
D. a = 24, x = 4
E. a = 720, x = 6
F. The statement has invalid syntax.
G. a = 24, x = 5
H. a = 20, x = 4
I. a = 24, x = 6
J. a = 600, x = 5
K. a = 480, x = 6
L. a = 30, x = 6
M. a = 720, x = 4
N. a = 720, x = 5
O. a = 30, x = 4
P. The statement has valid syntax, but none of the above is correct. The statement has valid syntax, but none of the above is correct.
Q. a = 20, x = 5
R. a = 30, x = 5
S. a = 600, x = 4
T. a = 600, x = 6
ABCDEFGHIJKLMNOPQRSTa /= --x;
ABCDEFGHIJKLMNOPQRSTa /= x--;
ABCDEFGHIJKLMNOPQRSTa *= ++x;
ABCDEFGHIJKLMNOPQRSTa *= x;
ABCDEFGHIJKLMNOPQRSTa /= x;
ABCDEFGHIJKLMNOPQRSTa *= x++;
Points Earned: 6.0/6.0
Correct Answer(s): a = 600, x = 6 : a *= x++;, a = 24, x = 4 : a /= x--;, a = 720, x = 6 : a *= ++x;, a = 30, x = 4 : a /= --x;, a = 600, x = 5 : a *= x;, a = 24, x = 5 : a /= x;
5. Select the phrase that describes the effect of each these proposed C++ statements.
A. The statement has valid syntax, but does none of the above.
B. Multiply a and b, putting the result in c.
C. Multiply c by 5, putting the result in c.
D. Add a and b, putting the result in c.
E. Add 1 to c, putting the result in c.
F. Multiply b by a, putting the result in b.
G. The proposed statement has invalid syntax.
H. Add a to b, putting the result in b.
ABCDEFGH++c;
ABCDEFGHc = c * 5;
ABCDEFGHc += 1;
ABCDEFGHc = a * b;
ABCDEFGHc *= 5;
ABCDEFGHc = a + b
ABCDEFGH**c;
ABCDEFGHc = b + a;
ABCDEFGHb *= a;
ABCDEFGHc = c + 1;
ABCDEFGHc**;
ABCDEFGHc = b * a
ABCDEFGHc++;
ABCDEFGHb += a;
Points Earned: 13.0/14.0
Correct Answer(s): Add 1 to c, putting the result in c. : c += 1;, Add 1 to c, putting the result in c. : ++c;, Add 1 to c, putting the result in c. : c++;, Multiply c by 5, putting the result in c. : c = c * 5;, Multiply a and b, putting the result in c. : c = a * b;, The proposed statement has invalid syntax. : c = b * a, Multiply b by a, putting the result in b. : b *= a;, Multiply c by 5, putting the result in c. : c *= 5;, The proposed statement has invalid syntax. : **c;, The proposed statement has invalid syntax. : c**;, Add 1 to c, putting the result in c. : c = c + 1;, The proposed statement has invalid syntax. : c = a + b, Add a and b, putting the result in c. : c = b + a;, Add a to b, putting the result in b. : b += a;
More Methods
1. Select the best matching word or term.
A. class
B. single-precision
C. property
D. int
E. global
F. new
G. type
H. ToInt32
I. instance
J. ToDecimal
K. method
L. float
M. double-precision
ABCDEFGHIJKLMVariables of type double represent ____ floating-point numbers.
ABCDEFGHIJKLMOperator ____ creates an object of the class specified to the right of the keyword.
ABCDEFGHIJKLMC# provides three simple types for storing real numbers -- double, decimal and ____.
ABCDEFGHIJKLMBy default, classes that are not explicitly declared in a namespace are implicitly placed in the ____ namespace.
ABCDEFGHIJKLMConvert method ____ returns a decimal value.
ABCDEFGHIJKLMEach parameter must specify both a name and a(n) ____.
ABCDEFGHIJKLMEvery class declaration contains keyword ____ followed immediately by the class's name.
ABCDEFGHIJKLMWhen each object of a class maintains its own copy of an attribute, the field that represents the attribute is also known as a(n) ____ variable.
ABCDEFGHIJKLMA house is to a blueprint as a(n) ____ is to a class.
Points Earned: 9.0/9.0
Correct Answer(s): ToDecimal : Convert method ____ returns a decimal value., double-precision : Variables of type double represent ____ floating-point numbers., float : C# provides three simple types for storing real numbers -- double, decimal and ____., instance : When each object of a class maintains its own copy of an attribute, the field that represents the attribute is also known as a(n) ____ variable., global : By default, classes that are not explicitly declared in a namespace are implicitly placed in the ____ namespace., type : Each parameter must specify both a name and a(n) ____., new : Operator ____ creates an object of the class specified to the right of the keyword., class : Every class declaration contains keyword ____ followed immediately by the class's name., instance : A house is to a blueprint as a(n) ____ is to a class.
2. Select the best matching word or term.
A. single-precision
B. reference
C. access modifier
D. utility specifier
E. double-precision
F. primitive
G. $
H. auto-generated accessors
I. void
J. ReadInput
K. real
L. C
M. ReadLine
N. using statement
O. auto-implemented property
P. using directive
Q. value
ABCDEFGHIJKLMNOPQVariables of type float represent ____ floating-point numbers.
ABCDEFGHIJKLMNOPQFor a(n) ____, the compiler automatically generates a private instance variable and set and get accessors.
ABCDEFGHIJKLMNOPQKeyword public is a(n) ____.
ABCDEFGHIJKLMNOPQTypes are value types or ____ types.
ABCDEFGHIJKLMNOPQA(n) ____ is not required if you always refer to a class with its fully qualified class name.
ABCDEFGHIJKLMNOPQThe format specifier ____ is used to display values in a monetary format.
ABCDEFGHIJKLMNOPQReturn type ____ indicates that a method will not return any information when it completes its task.
ABCDEFGHIJKLMNOPQConsole method ____ reads characters until a newline character is encountered.
Points Earned: 7.0/8.0
Correct Answer(s): auto-implemented property : For a(n) ____, the compiler automatically generates a private instance variable and set and get accessors., reference : Types are value types or ____ types., C : The format specifier ____ is used to display values in a monetary format., single-precision : Variables of type float represent ____ floating-point numbers., using directive : A(n) ____ is not required if you always refer to a class with its fully qualified class name., ReadLine : Console method ____ reads characters until a newline character is encountered., void : Return type ____ indicates that a method will not return any information when it completes its task., access modifier : Keyword public is a(n) ____.
3. The body of any method or property is delimited by left and right braces.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
4. An instance variable is declared in a class, but not in the body of any of the class's methods.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
5. Local variables are initialized by default.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
6. An argument is the actual value that is passed to a method parameter when a method is called.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
7. By convention, method names begin with a lowercase first letter and all subsequent words in the name begin with a capital first letter.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
8. A property's get accessor enables a client to modify the value of the instance variable associated with the property.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
9. Each parameter required by a method is specified in the method's declaration.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
10. Variables declared in the body of a particular method are known as instance variables and can be used in all methods of the class.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
11. Variables or methods declared with access modifier private are accessible only to methods and properties of the class in which they are declared.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
12. The number of arguments in the method call must match the number of parameters in the method declaration's parameter list.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
13. Any class that contains public static void Main( string[] args ) can be used to execute an application.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
14. Empty parentheses following a method name in a method declaration indicate that the method does not require any parameters to perform its task.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
15. In general, instance variables are accessible to all methods of the class.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
16. Every instance of a class has a separate copy of the class's instance variables.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
17. Reference-type instance variables are initialized by default to the value null.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
18. A property declaration must contain both a get accessor and a set accessor.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
19. After defining a property, you can use it the same way you use a method, but with empty parentheses, because no arguments are passed to a property.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
20. Real number values that appear in source code are known as floating-point literals and are of type float by default.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
21. A using directive is not required when one class in a namespace uses another in the same namespace.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
A. class
B. single-precision
C. property
D. int
E. global
F. new
G. type
H. ToInt32
I. instance
J. ToDecimal
K. method
L. float
M. double-precision
ABCDEFGHIJKLMVariables of type double represent ____ floating-point numbers.
ABCDEFGHIJKLMOperator ____ creates an object of the class specified to the right of the keyword.
ABCDEFGHIJKLMC# provides three simple types for storing real numbers -- double, decimal and ____.
ABCDEFGHIJKLMBy default, classes that are not explicitly declared in a namespace are implicitly placed in the ____ namespace.
ABCDEFGHIJKLMConvert method ____ returns a decimal value.
ABCDEFGHIJKLMEach parameter must specify both a name and a(n) ____.
ABCDEFGHIJKLMEvery class declaration contains keyword ____ followed immediately by the class's name.
ABCDEFGHIJKLMWhen each object of a class maintains its own copy of an attribute, the field that represents the attribute is also known as a(n) ____ variable.
ABCDEFGHIJKLMA house is to a blueprint as a(n) ____ is to a class.
Points Earned: 9.0/9.0
Correct Answer(s): ToDecimal : Convert method ____ returns a decimal value., double-precision : Variables of type double represent ____ floating-point numbers., float : C# provides three simple types for storing real numbers -- double, decimal and ____., instance : When each object of a class maintains its own copy of an attribute, the field that represents the attribute is also known as a(n) ____ variable., global : By default, classes that are not explicitly declared in a namespace are implicitly placed in the ____ namespace., type : Each parameter must specify both a name and a(n) ____., new : Operator ____ creates an object of the class specified to the right of the keyword., class : Every class declaration contains keyword ____ followed immediately by the class's name., instance : A house is to a blueprint as a(n) ____ is to a class.
2. Select the best matching word or term.
A. single-precision
B. reference
C. access modifier
D. utility specifier
E. double-precision
F. primitive
G. $
H. auto-generated accessors
I. void
J. ReadInput
K. real
L. C
M. ReadLine
N. using statement
O. auto-implemented property
P. using directive
Q. value
ABCDEFGHIJKLMNOPQVariables of type float represent ____ floating-point numbers.
ABCDEFGHIJKLMNOPQFor a(n) ____, the compiler automatically generates a private instance variable and set and get accessors.
ABCDEFGHIJKLMNOPQKeyword public is a(n) ____.
ABCDEFGHIJKLMNOPQTypes are value types or ____ types.
ABCDEFGHIJKLMNOPQA(n) ____ is not required if you always refer to a class with its fully qualified class name.
ABCDEFGHIJKLMNOPQThe format specifier ____ is used to display values in a monetary format.
ABCDEFGHIJKLMNOPQReturn type ____ indicates that a method will not return any information when it completes its task.
ABCDEFGHIJKLMNOPQConsole method ____ reads characters until a newline character is encountered.
Points Earned: 7.0/8.0
Correct Answer(s): auto-implemented property : For a(n) ____, the compiler automatically generates a private instance variable and set and get accessors., reference : Types are value types or ____ types., C : The format specifier ____ is used to display values in a monetary format., single-precision : Variables of type float represent ____ floating-point numbers., using directive : A(n) ____ is not required if you always refer to a class with its fully qualified class name., ReadLine : Console method ____ reads characters until a newline character is encountered., void : Return type ____ indicates that a method will not return any information when it completes its task., access modifier : Keyword public is a(n) ____.
3. The body of any method or property is delimited by left and right braces.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
4. An instance variable is declared in a class, but not in the body of any of the class's methods.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
5. Local variables are initialized by default.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
6. An argument is the actual value that is passed to a method parameter when a method is called.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
7. By convention, method names begin with a lowercase first letter and all subsequent words in the name begin with a capital first letter.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
8. A property's get accessor enables a client to modify the value of the instance variable associated with the property.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
9. Each parameter required by a method is specified in the method's declaration.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
10. Variables declared in the body of a particular method are known as instance variables and can be used in all methods of the class.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
11. Variables or methods declared with access modifier private are accessible only to methods and properties of the class in which they are declared.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
12. The number of arguments in the method call must match the number of parameters in the method declaration's parameter list.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
13. Any class that contains public static void Main( string[] args ) can be used to execute an application.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
14. Empty parentheses following a method name in a method declaration indicate that the method does not require any parameters to perform its task.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
15. In general, instance variables are accessible to all methods of the class.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
16. Every instance of a class has a separate copy of the class's instance variables.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
17. Reference-type instance variables are initialized by default to the value null.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
18. A property declaration must contain both a get accessor and a set accessor.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
19. After defining a property, you can use it the same way you use a method, but with empty parentheses, because no arguments are passed to a property.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
20. Real number values that appear in source code are known as floating-point literals and are of type float by default.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
21. A using directive is not required when one class in a namespace uses another in the same namespace.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
C# applications
1. Select the matching word, phrase or acronym for each question.
A. colon
B. Main
C. blank lines
D. if
E. newline
F. Console.Write
G. keywords
H. brace
I. EOF
J. //
K. start
L. comma
M. STX
N. semicolon
ABCDEFGHIJKLMNMost C# statements end with a(n) ____.
ABCDEFGHIJKLMN____ are reserved for use by C#.
ABCDEFGHIJKLMNA left ____ begins the body of every method and a right ____ ends the body of every method.
ABCDEFGHIJKLMNNewline, space and tab characters and ____ are called whitespace characters.
ABCDEFGHIJKLMNMethods WriteLine and ____ display information in the console window.
ABCDEFGHIJKLMNThe escape sequence \n represents the ____ character, which causes the cursor to position to the beginning of the next line on the screen.
ABCDEFGHIJKLMN____ begins a single-line comment.
ABCDEFGHIJKLMNThe ____ statement is used to make decisions.
ABCDEFGHIJKLMNC# applications begin execution at method ____.
Points Earned: 8.0/8.0
Correct Answer(s): brace : A left ____ begins the body of every method and a right ____ ends the body of every method., semicolon : Most C# statements end with a(n) ____., newline : The escape sequence \n represents the ____ character, which causes the cursor to position to the beginning of the next line on the screen., if : The ____ statement is used to make decisions., // : ____ begins a single-line comment., blank lines : Newline, space and tab characters and ____ are called whitespace characters., keywords : ____ are reserved for use by C#., Main : C# applications begin execution at method ____., Console.Write : Methods WriteLine and ____ display information in the console window.
2. Match the correct C# statements to each programming task.
A. Console.Write( "Enter an integer: " );
B. Console.WriteLine( "{0}\n{1}", "This is a Visual C++", "program" );
C. int c, thisIsAVariable, q76354, number;
D. if ( number != 7 ) Console.WriteLine( "The variable number is not equal to 7" );
E. age = Convert.ToInt32(Console.ReadLine() );
F. Console.WriteLine( "This\tis\ta\tVisual\tC++\tprogram\n" );
G. Console.WriteLine( "This is a Visual C++ program\n" );
H. Console.WriteLine( "This\nis\na\nVisual\nC++\nprogram\n" );
I. Console.WriteLine( "This is a Visual C++\nprogram\n" );
ABCDEFGHIInput an integer from the user at the keyboard and store it in integer variable age.
ABCDEFGHIPrompt the user to enter an integer.
ABCDEFGHIDeclare the variables c, thisIsAVariable, q76354 and number to be of type int.
ABCDEFGHIPrint the message "This is a Visual C++ program". Separate each word from the next by a tab.
ABCDEFGHIPrint the message "This is a Visual C++ program" on two lines using a single statement and a single string. End the first line with C++.
ABCDEFGHIPrint the message "This is a Visual C++ program" with each word on a separate line.
ABCDEFGHIPrint the message "This is a Visual C++ program" on one line.
ABCDEFGHIIf the variable number is not equal to 7, print "The variable number is not equal to 7".
ABCDEFGHIPrint the message "This is a Visual C++ program" on two lines using a single statement and two format items. End the first line with C++.
Points Earned: 8.0/8.0
Correct Answer(s): int c, thisIsAVariable, q76354, number; : Declare the variables c, thisIsAVariable, q76354 and number to be of type int., Console.Write( "Enter an integer: " ); : Prompt the user to enter an integer., age = Convert.ToInt32(Console.ReadLine() ); : Input an integer from the user at the keyboard and store it in integer variable age., if ( number != 7 ) Console.WriteLine( "The variable number is not equal to 7" ); : If the variable number is not equal to 7, print "The variable number is not equal to 7"., Console.WriteLine( "This is a Visual C++\nprogram\n" ); : Print the message "This is a Visual C++ program" on two lines using a single statement and a single string. End the first line with C++., Console.WriteLine( "{0}\n{1}", "This is a Visual C++", "program" ); : Print the message "This is a Visual C++ program" on two lines using a single statement and two format items. End the first line with C++., Console.WriteLine( "This\tis\ta\tVisual\tC++\tprogram\n" ); : Print the message "This is a Visual C++ program". Separate each word from the next by a tab., Console.WriteLine( "This is a Visual C++ program\n" ); : Print the message "This is a Visual C++ program" on one line., Console.WriteLine( "This\nis\na\nVisual\nC++\nprogram\n" ); : Print the message "This is a Visual C++ program" with each word on a separate line.
3. Assume the using std::cout; statement appears at the beginning of your program. Which of these statements are true and which are false?
A. True
B. False
C. Not able to say
ABCComments cause the computer to print the text after the // on the screen when the application is executed.
ABCC# considers the variables Number and NuMbEr to be identical.
ABCThe remainder operator (%) can be used only with integer operands.
ABCThe escape sequence \n, when output with cout and the stream insertion operator, causes the cursor to position to the beginning of the next line on the screen.
ABCAll variables must be declared before they are used.
ABCAll variables must be given a type when they are declared.
ABCThe arithmetic operators *, /, %, + and - all have the same level of precedence.
Points Earned: 6.0/6.0
Correct Answer(s): False : Comments cause the computer to print the text after the // on the screen when the application is executed., False : C# considers the variables Number and NuMbEr to be identical., False : The remainder operator (%) can be used only with integer operands., True : The escape sequence \n, when output with cout and the stream insertion operator, causes the cursor to position to the beginning of the next line on the screen., True : All variables must be declared before they are used., True : All variables must be given a type when they are declared., False : The arithmetic operators *, /, %, + and - all have the same level of precedence.
4. Match the correct C# statement (or comment) to each programming task.
A. int x; int y; int z; int result;
B. Console.OutLine( "Enter the first integer: " );
C. z = Convert.ToInt32(Console.ReadLine() );
D. y = Console.ReadLine();
E. // Calculate the product of three integers.
F. Console.WriteLine( "Enter the first integer: " );
G. Console.WriteLine( "Enter the second integer: " );
H. Console.WriteLine( "The product is {0}", result );
I. Console.OutLine( "Enter the third integer: " );
J. result = x # y # z;
K. y = Convert.ToInt32(Console.ReadLine() );
L. z = Console.ReadLine();
M. Console.WriteLine( "cin >> x >> y >> z" );
N. result = x * y * z;
O. x = Console.ReadLine();
P. Console.WriteLine( "Enter the third integer: " );
Q. int x, int y, int z, int result;
R. x = Convert.ToInt32(Console.ReadLine() );
S. Console.OutLine( "Enter the second integer: " );
T. Console.WriteLine( "The product is result" );
U. *** Calculate the product of three integers. ***
ABCDEFGHIJKLMNOPQRSTUPrompt the user to enter the third integer. Leave the cursor at the end of the line.
ABCDEFGHIJKLMNOPQRSTURead an integer from the keyboard and store it in the variable z.
ABCDEFGHIJKLMNOPQRSTURead an integer from the keyboard and store it in the variable y.
ABCDEFGHIJKLMNOPQRSTUPrint "The product is " followed by the value of the variable result.
ABCDEFGHIJKLMNOPQRSTUPrompt the user to enter the second integer. Leave the cursor at the end of the line.
ABCDEFGHIJKLMNOPQRSTUState that a program calculates the product of three integers.
ABCDEFGHIJKLMNOPQRSTUDeclare the variables x, y, z and result to be of type int (in separate statements).
ABCDEFGHIJKLMNOPQRSTUCompute the product of the three integers contained in variables x, y and z, and assign the result to the variable result.
ABCDEFGHIJKLMNOPQRSTURead an integer from the keyboard and store it in the variable x.
ABCDEFGHIJKLMNOPQRSTUPrompt the user to enter the first integer. Leave the cursor at the end of the line.
Points Earned: 9.0/10.0
Correct Answer(s): // Calculate the product of three integers. : State that a program calculates the product of three integers., int x; int y; int z; int result; : Declare the variables x, y, z and result to be of type int (in separate statements)., Console.WriteLine( "Enter the first integer: " ); : Prompt the user to enter the first integer. Leave the cursor at the end of the line., x = Convert.ToInt32(Console.ReadLine() ); : Read an integer from the keyboard and store it in the variable x., Console.WriteLine( "Enter the second integer: " ); : Prompt the user to enter the second integer. Leave the cursor at the end of the line., y = Convert.ToInt32(Console.ReadLine() ); : Read an integer from the keyboard and store it in the variable y., Console.WriteLine( "Enter the third integer: " ); : Prompt the user to enter the third integer. Leave the cursor at the end of the line., z = Convert.ToInt32(Console.ReadLine() ); : Read an integer from the keyboard and store it in the variable z., result = x * y * z; : Compute the product of the three integers contained in variables x, y and z, and assign the result to the variable result., Console.WriteLine( "The product is {0}", result ); : Print "The product is " followed by the value of the variable result.
A. colon
B. Main
C. blank lines
D. if
E. newline
F. Console.Write
G. keywords
H. brace
I. EOF
J. //
K. start
L. comma
M. STX
N. semicolon
ABCDEFGHIJKLMNMost C# statements end with a(n) ____.
ABCDEFGHIJKLMN____ are reserved for use by C#.
ABCDEFGHIJKLMNA left ____ begins the body of every method and a right ____ ends the body of every method.
ABCDEFGHIJKLMNNewline, space and tab characters and ____ are called whitespace characters.
ABCDEFGHIJKLMNMethods WriteLine and ____ display information in the console window.
ABCDEFGHIJKLMNThe escape sequence \n represents the ____ character, which causes the cursor to position to the beginning of the next line on the screen.
ABCDEFGHIJKLMN____ begins a single-line comment.
ABCDEFGHIJKLMNThe ____ statement is used to make decisions.
ABCDEFGHIJKLMNC# applications begin execution at method ____.
Points Earned: 8.0/8.0
Correct Answer(s): brace : A left ____ begins the body of every method and a right ____ ends the body of every method., semicolon : Most C# statements end with a(n) ____., newline : The escape sequence \n represents the ____ character, which causes the cursor to position to the beginning of the next line on the screen., if : The ____ statement is used to make decisions., // : ____ begins a single-line comment., blank lines : Newline, space and tab characters and ____ are called whitespace characters., keywords : ____ are reserved for use by C#., Main : C# applications begin execution at method ____., Console.Write : Methods WriteLine and ____ display information in the console window.
2. Match the correct C# statements to each programming task.
A. Console.Write( "Enter an integer: " );
B. Console.WriteLine( "{0}\n{1}", "This is a Visual C++", "program" );
C. int c, thisIsAVariable, q76354, number;
D. if ( number != 7 ) Console.WriteLine( "The variable number is not equal to 7" );
E. age = Convert.ToInt32(Console.ReadLine() );
F. Console.WriteLine( "This\tis\ta\tVisual\tC++\tprogram\n" );
G. Console.WriteLine( "This is a Visual C++ program\n" );
H. Console.WriteLine( "This\nis\na\nVisual\nC++\nprogram\n" );
I. Console.WriteLine( "This is a Visual C++\nprogram\n" );
ABCDEFGHIInput an integer from the user at the keyboard and store it in integer variable age.
ABCDEFGHIPrompt the user to enter an integer.
ABCDEFGHIDeclare the variables c, thisIsAVariable, q76354 and number to be of type int.
ABCDEFGHIPrint the message "This is a Visual C++ program". Separate each word from the next by a tab.
ABCDEFGHIPrint the message "This is a Visual C++ program" on two lines using a single statement and a single string. End the first line with C++.
ABCDEFGHIPrint the message "This is a Visual C++ program" with each word on a separate line.
ABCDEFGHIPrint the message "This is a Visual C++ program" on one line.
ABCDEFGHIIf the variable number is not equal to 7, print "The variable number is not equal to 7".
ABCDEFGHIPrint the message "This is a Visual C++ program" on two lines using a single statement and two format items. End the first line with C++.
Points Earned: 8.0/8.0
Correct Answer(s): int c, thisIsAVariable, q76354, number; : Declare the variables c, thisIsAVariable, q76354 and number to be of type int., Console.Write( "Enter an integer: " ); : Prompt the user to enter an integer., age = Convert.ToInt32(Console.ReadLine() ); : Input an integer from the user at the keyboard and store it in integer variable age., if ( number != 7 ) Console.WriteLine( "The variable number is not equal to 7" ); : If the variable number is not equal to 7, print "The variable number is not equal to 7"., Console.WriteLine( "This is a Visual C++\nprogram\n" ); : Print the message "This is a Visual C++ program" on two lines using a single statement and a single string. End the first line with C++., Console.WriteLine( "{0}\n{1}", "This is a Visual C++", "program" ); : Print the message "This is a Visual C++ program" on two lines using a single statement and two format items. End the first line with C++., Console.WriteLine( "This\tis\ta\tVisual\tC++\tprogram\n" ); : Print the message "This is a Visual C++ program". Separate each word from the next by a tab., Console.WriteLine( "This is a Visual C++ program\n" ); : Print the message "This is a Visual C++ program" on one line., Console.WriteLine( "This\nis\na\nVisual\nC++\nprogram\n" ); : Print the message "This is a Visual C++ program" with each word on a separate line.
3. Assume the using std::cout; statement appears at the beginning of your program. Which of these statements are true and which are false?
A. True
B. False
C. Not able to say
ABCComments cause the computer to print the text after the // on the screen when the application is executed.
ABCC# considers the variables Number and NuMbEr to be identical.
ABCThe remainder operator (%) can be used only with integer operands.
ABCThe escape sequence \n, when output with cout and the stream insertion operator, causes the cursor to position to the beginning of the next line on the screen.
ABCAll variables must be declared before they are used.
ABCAll variables must be given a type when they are declared.
ABCThe arithmetic operators *, /, %, + and - all have the same level of precedence.
Points Earned: 6.0/6.0
Correct Answer(s): False : Comments cause the computer to print the text after the // on the screen when the application is executed., False : C# considers the variables Number and NuMbEr to be identical., False : The remainder operator (%) can be used only with integer operands., True : The escape sequence \n, when output with cout and the stream insertion operator, causes the cursor to position to the beginning of the next line on the screen., True : All variables must be declared before they are used., True : All variables must be given a type when they are declared., False : The arithmetic operators *, /, %, + and - all have the same level of precedence.
4. Match the correct C# statement (or comment) to each programming task.
A. int x; int y; int z; int result;
B. Console.OutLine( "Enter the first integer: " );
C. z = Convert.ToInt32(Console.ReadLine() );
D. y = Console.ReadLine();
E. // Calculate the product of three integers.
F. Console.WriteLine( "Enter the first integer: " );
G. Console.WriteLine( "Enter the second integer: " );
H. Console.WriteLine( "The product is {0}", result );
I. Console.OutLine( "Enter the third integer: " );
J. result = x # y # z;
K. y = Convert.ToInt32(Console.ReadLine() );
L. z = Console.ReadLine();
M. Console.WriteLine( "cin >> x >> y >> z" );
N. result = x * y * z;
O. x = Console.ReadLine();
P. Console.WriteLine( "Enter the third integer: " );
Q. int x, int y, int z, int result;
R. x = Convert.ToInt32(Console.ReadLine() );
S. Console.OutLine( "Enter the second integer: " );
T. Console.WriteLine( "The product is result" );
U. *** Calculate the product of three integers. ***
ABCDEFGHIJKLMNOPQRSTUPrompt the user to enter the third integer. Leave the cursor at the end of the line.
ABCDEFGHIJKLMNOPQRSTURead an integer from the keyboard and store it in the variable z.
ABCDEFGHIJKLMNOPQRSTURead an integer from the keyboard and store it in the variable y.
ABCDEFGHIJKLMNOPQRSTUPrint "The product is " followed by the value of the variable result.
ABCDEFGHIJKLMNOPQRSTUPrompt the user to enter the second integer. Leave the cursor at the end of the line.
ABCDEFGHIJKLMNOPQRSTUState that a program calculates the product of three integers.
ABCDEFGHIJKLMNOPQRSTUDeclare the variables x, y, z and result to be of type int (in separate statements).
ABCDEFGHIJKLMNOPQRSTUCompute the product of the three integers contained in variables x, y and z, and assign the result to the variable result.
ABCDEFGHIJKLMNOPQRSTURead an integer from the keyboard and store it in the variable x.
ABCDEFGHIJKLMNOPQRSTUPrompt the user to enter the first integer. Leave the cursor at the end of the line.
Points Earned: 9.0/10.0
Correct Answer(s): // Calculate the product of three integers. : State that a program calculates the product of three integers., int x; int y; int z; int result; : Declare the variables x, y, z and result to be of type int (in separate statements)., Console.WriteLine( "Enter the first integer: " ); : Prompt the user to enter the first integer. Leave the cursor at the end of the line., x = Convert.ToInt32(Console.ReadLine() ); : Read an integer from the keyboard and store it in the variable x., Console.WriteLine( "Enter the second integer: " ); : Prompt the user to enter the second integer. Leave the cursor at the end of the line., y = Convert.ToInt32(Console.ReadLine() ); : Read an integer from the keyboard and store it in the variable y., Console.WriteLine( "Enter the third integer: " ); : Prompt the user to enter the third integer. Leave the cursor at the end of the line., z = Convert.ToInt32(Console.ReadLine() ); : Read an integer from the keyboard and store it in the variable z., result = x * y * z; : Compute the product of the three integers contained in variables x, y and z, and assign the result to the variable result., Console.WriteLine( "The product is {0}", result ); : Print "The product is " followed by the value of the variable result.
C# Express
1. Select the correct matching term or phrase.
A. visual programming
B. auto-hide
C. expand
D. Project Explorer
E. numerically
F. Solution Explorer
G. project
H. mini toolbar
I. categorically
J. solution
K. tool tip
L. add
M. graphical programming
ABCDEFGHIJKLMA(n) ____ is a group of one or more projects that collectively form a Visual C# program.
ABCDEFGHIJKLMA(n) ____ appears when the mouse pointer hovers over an icon.
ABCDEFGHIJKLMA plus box indicates that the tree in the Solution Explorer can ____.
ABCDEFGHIJKLMThe ___ feature hides a window when the mouse pointer is moved outside the window's area.
ABCDEFGHIJKLMThe ___ window allows you to browse solution files.
ABCDEFGHIJKLMThe technique of ____ allows you to create GUIs without writing any code.
ABCDEFGHIJKLMThe properties in the Properties window can be sorted alphabetically or ____.
Points Earned: 7.0/7.0
Correct Answer(s): visual programming : The technique of ____ allows you to create GUIs without writing any code., solution : A(n) ____ is a group of one or more projects that collectively form a Visual C# program., auto-hide : The ___ feature hides a window when the mouse pointer is moved outside the window's area. , tool tip : A(n) ____ appears when the mouse pointer hovers over an icon., Solution Explorer : The ___ window allows you to browse solution files., expand : A plus box indicates that the tree in the Solution Explorer can ____., categorically : The properties in the Properties window can be sorted alphabetically or ____.
2. PictureBoxes typically display images.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
3. Both Forms and Labels have a title bar.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
4. Control properties can be modified only by writing code.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
5. The "X" box toggles auto-hide.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
6. The toolbar icons represent various menu commands.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
7. The toolbar contains icons that represent controls.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
8. A Form's background color is set using the BackColor property.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
9. The IDE's title bar displays the IDE's mode.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
10. Visual C# files use the file extension .csharp.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
11. Select the word or phrase to complete each item.
A. graphical user interface
B. Insert icon
C. File > Save All
D. instant assistance
E. Toolbox
F. Dynamic Help
G. graphical universal interface
H. TextAlign
I. context-sensitive help
J. Text
K. Title
L. Alignment
M. File > Save Solution
ABCDEFGHIJKLMA Form's ____ property specifies the text displayed in the Form's title bar.
ABCDEFGHIJKLMTo save every file in a solution, select ____.
ABCDEFGHIJKLMGUI is an acronym for ____.
ABCDEFGHIJKLMUsing ____ immediately displays a relevant help article.
ABCDEFGHIJKLMUsing ____ displays a list of relevant help articles, based on the current context.
ABCDEFGHIJKLMThe ____ property specifies how text is aligned within a Label's boundaries.
ABCDEFGHIJKLM____ can be accessed using the F1 key.
ABCDEFGHIJKLMThe ____ allows you to add controls to the Form in a visual manner.
Points Earned: 7.0/7.0
Correct Answer(s): Text : A Form's ____ property specifies the text displayed in the Form's title bar., Toolbox : The ____ allows you to add controls to the Form in a visual manner., Dynamic Help : Using ____ displays a list of relevant help articles, based on the current context., TextAlign : The ____ property specifies how text is aligned within a Label's boundaries., File > Save All : To save every file in a solution, select ____., context-sensitive help : Using ____ immediately displays a relevant help article., context-sensitive help : ____ can be accessed using the F1 key., graphical user interface : GUI is an acronym for ____.
A. visual programming
B. auto-hide
C. expand
D. Project Explorer
E. numerically
F. Solution Explorer
G. project
H. mini toolbar
I. categorically
J. solution
K. tool tip
L. add
M. graphical programming
ABCDEFGHIJKLMA(n) ____ is a group of one or more projects that collectively form a Visual C# program.
ABCDEFGHIJKLMA(n) ____ appears when the mouse pointer hovers over an icon.
ABCDEFGHIJKLMA plus box indicates that the tree in the Solution Explorer can ____.
ABCDEFGHIJKLMThe ___ feature hides a window when the mouse pointer is moved outside the window's area.
ABCDEFGHIJKLMThe ___ window allows you to browse solution files.
ABCDEFGHIJKLMThe technique of ____ allows you to create GUIs without writing any code.
ABCDEFGHIJKLMThe properties in the Properties window can be sorted alphabetically or ____.
Points Earned: 7.0/7.0
Correct Answer(s): visual programming : The technique of ____ allows you to create GUIs without writing any code., solution : A(n) ____ is a group of one or more projects that collectively form a Visual C# program., auto-hide : The ___ feature hides a window when the mouse pointer is moved outside the window's area. , tool tip : A(n) ____ appears when the mouse pointer hovers over an icon., Solution Explorer : The ___ window allows you to browse solution files., expand : A plus box indicates that the tree in the Solution Explorer can ____., categorically : The properties in the Properties window can be sorted alphabetically or ____.
2. PictureBoxes typically display images.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
3. Both Forms and Labels have a title bar.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
4. Control properties can be modified only by writing code.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
5. The "X" box toggles auto-hide.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
6. The toolbar icons represent various menu commands.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
7. The toolbar contains icons that represent controls.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
8. A Form's background color is set using the BackColor property.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
9. The IDE's title bar displays the IDE's mode.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
10. Visual C# files use the file extension .csharp.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
11. Select the word or phrase to complete each item.
A. graphical user interface
B. Insert icon
C. File > Save All
D. instant assistance
E. Toolbox
F. Dynamic Help
G. graphical universal interface
H. TextAlign
I. context-sensitive help
J. Text
K. Title
L. Alignment
M. File > Save Solution
ABCDEFGHIJKLMA Form's ____ property specifies the text displayed in the Form's title bar.
ABCDEFGHIJKLMTo save every file in a solution, select ____.
ABCDEFGHIJKLMGUI is an acronym for ____.
ABCDEFGHIJKLMUsing ____ immediately displays a relevant help article.
ABCDEFGHIJKLMUsing ____ displays a list of relevant help articles, based on the current context.
ABCDEFGHIJKLMThe ____ property specifies how text is aligned within a Label's boundaries.
ABCDEFGHIJKLM____ can be accessed using the F1 key.
ABCDEFGHIJKLMThe ____ allows you to add controls to the Form in a visual manner.
Points Earned: 7.0/7.0
Correct Answer(s): Text : A Form's ____ property specifies the text displayed in the Form's title bar., Toolbox : The ____ allows you to add controls to the Form in a visual manner., Dynamic Help : Using ____ displays a list of relevant help articles, based on the current context., TextAlign : The ____ property specifies how text is aligned within a Label's boundaries., File > Save All : To save every file in a solution, select ____., context-sensitive help : Using ____ immediately displays a relevant help article., context-sensitive help : ____ can be accessed using the F1 key., graphical user interface : GUI is an acronym for ____.
Introduction to C #
1. Select the matching word or acronym.
A. XML
B. UNIX
C. assembly
D. programs
E. compilers
F. machine
G. SOAP
H. IDE
ABCDEFGHThe three types of computer languages discussed in the textbook are high-level languages, machine languages and ____ languages.
ABCDEFGHComputers can directly understand only their native ___ language, which is composed only of 1s and 0s.
ABCDEFGHC is widely known as the development language of the ____ operating system.
ABCDEFGHWeb service use ____ to markup information for transmission over the Internet.
ABCDEFGHPrograms that translate high-level-language programs into machine language are called _____.
ABCDEFGHWeb services use ____ to send information over the Internet.
ABCDEFGHVisual Studio is a(n) ______ in which C# programs are developed.
ABCDEFGHComputers process data under the control of sets of instructions called computer _______.
Points Earned: 7.0/7.0
Correct Answer(s): machine : Computers can directly understand only their native ___ language, which is composed only of 1s and 0s. , programs : Computers process data under the control of sets of instructions called computer _______., assembly : The three types of computer languages discussed in the textbook are high-level languages, machine languages and ____ languages., compilers : Programs that translate high-level-language programs into machine language are called _____. , IDE : Visual Studio is a(n) ______ in which C# programs are developed. , UNIX : C is widely known as the development language of the ____ operating system. , XML : Web service use ____ to markup information for transmission over the Internet. , SOAP : Web services use ____ to send information over the Internet.
2. Procedural programming models the world more naturally than object-oriented programming.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
3. MSIL is the common intermediate format to which all .NET programs compile, regardless of their original .NET language.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
4. C# is an object-oriented languageA) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
5. C# is the only language available for programming .NET applications.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
6. The UML is used primarily to implement object-oriented systems.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
7. The .NET Framework is portable to non-Windows platforms.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
8. Computers can directly understand high-level languages.
A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
9. Identify each item as hardware or software.
A. hardware
B. software
C. combination
ABCInput Unit
ABCWord processing program
ABCCPU
ABCKeyboard
ABCA C# program
ABCcompiler
Points Earned: 5.0/5.0
Correct Answer(s): hardware : CPU, software : compiler, hardware : Keyboard, hardware : Input Unit, software : Word processing program, software : A C# program
10. A compiler translates high-level language programs into target-language programs.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
11. High-level languages are generally machine dependent.
A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
12. A machine-language program requires translation before it can be run on a computer.
A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
13. An assembler translates source-language programs into machine-language programs.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
14. The Visual C# compiler translates high-level-language programs into SMIL.
A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
15. A compiler convets source-language programs into target-language programs.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
16. Select the word that correctly expands each acronyms.
A. Consortium
B. Programming
C. Protocol
D. Intermediate
E. Markup
F. Infrastructure
G. Integrated
H. Common
I. Modeling
J. Management
ABCDEFGHIJOMG: Object ____ Group
ABCDEFGHIJCLI: Common Language _____
ABCDEFGHIJIDE: ____ Development Environment
ABCDEFGHIJSOAP: Simple Object Access _____
ABCDEFGHIJXML: Extensible _____ Language
ABCDEFGHIJCLR: ____ Language Runtime
ABCDEFGHIJW3C; World Wide Web ____
ABCDEFGHIJMSIL: Microsoft ____ Language
ABCDEFGHIJUML: Unified ____ Language
ABCDEFGHIJOOP: Object Oriented _____
Points Earned: 9.0/9.0
Correct Answer(s): Consortium : W3C; World Wide Web ____, Markup : XML: Extensible _____ Language, Protocol : SOAP: Simple Object Access _____, Programming : OOP: Object Oriented _____, Common : CLR: ____ Language Runtime, Infrastructure : CLI: Common Language _____, Intermediate : MSIL: Microsoft ____ Language, Modeling : UML: Unified ____ Language, Management : OMG: Object ____ Group, Integrated : IDE: ____ Development Environment
A. XML
B. UNIX
C. assembly
D. programs
E. compilers
F. machine
G. SOAP
H. IDE
ABCDEFGHThe three types of computer languages discussed in the textbook are high-level languages, machine languages and ____ languages.
ABCDEFGHComputers can directly understand only their native ___ language, which is composed only of 1s and 0s.
ABCDEFGHC is widely known as the development language of the ____ operating system.
ABCDEFGHWeb service use ____ to markup information for transmission over the Internet.
ABCDEFGHPrograms that translate high-level-language programs into machine language are called _____.
ABCDEFGHWeb services use ____ to send information over the Internet.
ABCDEFGHVisual Studio is a(n) ______ in which C# programs are developed.
ABCDEFGHComputers process data under the control of sets of instructions called computer _______.
Points Earned: 7.0/7.0
Correct Answer(s): machine : Computers can directly understand only their native ___ language, which is composed only of 1s and 0s. , programs : Computers process data under the control of sets of instructions called computer _______., assembly : The three types of computer languages discussed in the textbook are high-level languages, machine languages and ____ languages., compilers : Programs that translate high-level-language programs into machine language are called _____. , IDE : Visual Studio is a(n) ______ in which C# programs are developed. , UNIX : C is widely known as the development language of the ____ operating system. , XML : Web service use ____ to markup information for transmission over the Internet. , SOAP : Web services use ____ to send information over the Internet.
2. Procedural programming models the world more naturally than object-oriented programming.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
3. MSIL is the common intermediate format to which all .NET programs compile, regardless of their original .NET language.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
4. C# is an object-oriented languageA) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
5. C# is the only language available for programming .NET applications.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
6. The UML is used primarily to implement object-oriented systems.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
7. The .NET Framework is portable to non-Windows platforms.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
8. Computers can directly understand high-level languages.
A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
9. Identify each item as hardware or software.
A. hardware
B. software
C. combination
ABCInput Unit
ABCWord processing program
ABCCPU
ABCKeyboard
ABCA C# program
ABCcompiler
Points Earned: 5.0/5.0
Correct Answer(s): hardware : CPU, software : compiler, hardware : Keyboard, hardware : Input Unit, software : Word processing program, software : A C# program
10. A compiler translates high-level language programs into target-language programs.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
11. High-level languages are generally machine dependent.
A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
12. A machine-language program requires translation before it can be run on a computer.
A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
13. An assembler translates source-language programs into machine-language programs.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
14. The Visual C# compiler translates high-level-language programs into SMIL.
A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
15. A compiler convets source-language programs into target-language programs.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
16. Select the word that correctly expands each acronyms.
A. Consortium
B. Programming
C. Protocol
D. Intermediate
E. Markup
F. Infrastructure
G. Integrated
H. Common
I. Modeling
J. Management
ABCDEFGHIJOMG: Object ____ Group
ABCDEFGHIJCLI: Common Language _____
ABCDEFGHIJIDE: ____ Development Environment
ABCDEFGHIJSOAP: Simple Object Access _____
ABCDEFGHIJXML: Extensible _____ Language
ABCDEFGHIJCLR: ____ Language Runtime
ABCDEFGHIJW3C; World Wide Web ____
ABCDEFGHIJMSIL: Microsoft ____ Language
ABCDEFGHIJUML: Unified ____ Language
ABCDEFGHIJOOP: Object Oriented _____
Points Earned: 9.0/9.0
Correct Answer(s): Consortium : W3C; World Wide Web ____, Markup : XML: Extensible _____ Language, Protocol : SOAP: Simple Object Access _____, Programming : OOP: Object Oriented _____, Common : CLR: ____ Language Runtime, Infrastructure : CLI: Common Language _____, Intermediate : MSIL: Microsoft ____ Language, Modeling : UML: Unified ____ Language, Management : OMG: Object ____ Group, Integrated : IDE: ____ Development Environment
Methods
1. _________ methods can be called without the need for an object of the class to exist.
A) dependent
B) independent
C) special
D) static
Points Earned: 1.0/1.0
Correct Answer(s): D
2. Methods that call themselves are known as ________.
A) reiterative
B) repeat-calling
C) recursive
D) self-calling
Points Earned: 1.0/1.0
Correct Answer(s): C
3. Information may be ____ methods.
A) passed to
B) returned from
C) manipulated in
D) All of the above.
Points Earned: 1.0/1.0
Correct Answer(s): D
4. A method is invoked by a ____.
A) return statement
B) method header
C) method call
D) None of the above.
Points Earned: 1.0/1.0
Correct Answer(s): C
5. A return type of ____ is specified for a method that does not return a value.
A) nothing
B) null
C) void
D) None of the above.
Points Earned: 1.0/1.0
Correct Answer(s): C
6. Methods are called by writing the name of the method followed by ____ enclosed in parentheses.
A) a condition
B) arguments
C) a counter
D) None of the above.
Points Earned: 1.0/1.0
Correct Answer(s): B
7. Which of the following is not a way of packaging code?
A) namespaces
B) variables
C) methods
D) classes
Points Earned: 1.0/1.0
Correct Answer(s): B
8. Programmers write ____ to define specific tasks that may be used at many points in a program.
A) classes
B) methods
C) modules
D) None of the above.
Points Earned: 1.0/1.0
Correct Answer(s): B
9. Many prepackaged classes and methods are provided in the .NET FCL, an acronym for the .
A) Framework Class Library
B) Framework Class Listing
C) Form Class Library
D) None of the above.
Points Earned: 1.0/1.0
Correct Answer(s): A
10. Which of the following correctly calls the Math class method Sqrt with a value of 36?
A) Sqrt(36);
B) Math.Sqrt(36);
C) Math.Sqrt = 36;
D) None of the above.
Points Earned: 1.0/1.0
Correct Answer(s): B
11. Which of the following describes a static variable?
A) a variable with one copy shared by all class objects
B) a variable whose value may not be changed
C) all of the above
D) None of the above.
Points Earned: 1.0/1.0
Correct Answer(s): A
12. When may an application omit the string[] args parameter from the Main header?
A) when the application does not need to use strings
B) when the application does not take command-line arguments
C) when the application does not output any strings
D) All of the above
Points Earned: 1.0/1.0
Correct Answer(s): B
13. Which of the following can be an argument to a method?
A) constants
B) variables
C) expressions
D) All of the above
Points Earned: 1.0/1.0
Correct Answer(s): D
14. How are various parameters separated in the method header?
A) braces
B) brackets
C) periods
D) commas
Points Earned: 1.0/1.0
Correct Answer(s): D
15. Let there be method called Function which takes 3 parameters of type bool. Which of the following method headers could it represent?
A) Function(bool a, bool b, bool c)
B) Function()
C) Both of the above
D) None of the above
Points Earned: 1.0/1.0
Correct Answer(s): A
16. The parameter list in the method header and the arguments in the method call must agree in:
A) number
B) type
C) order
D) all of the above
Points Earned: 1.0/1.0
Correct Answer(s): D
17. When an object is concatenated with a String:
A) a compilation error occurs
B) the object's class name is used
C) the object's ToString method is implicitly called
D) a runtime error occurs
Points Earned: 1.0/1.0
Correct Answer(s): C
18. To call a static method, use the _________ name followed by a period, and the method with its arguments.
A) class's
B) instance variable's
C) namespace's
D) All of the above
Points Earned: 1.0/1.0
Correct Answer(s): A
19. Which keyword can programmers use to break out of a void method?
A) continue
B) next
C) break
D) return
Points Earned: 1.0/1.0
Correct Answer(s): D
20. A static method can ________.
A) call only other static methods of the same class directly
B) manipulate only static fields in the same class directly
C) be called using the class name and a dot (.)
D) All of the above
Points Earned: 1.0/1.0
Correct Answer(s): D
21. Which statement is false?
A) Forgetting to return a value from a method that should return a value is a compilation error.
B) If a method does not return a value, the return-value-type in the method declaration can be omitted.
C) Placing a semicolon after the right parenthesis enclosing the parameter list of a method declaration is a syntax error.
D) Re-declaring a method parameter as a local variable in the method's body is a compilation error.
Points Earned: 1.0/1.0
Correct Answer(s): B
22. Stacks are _____________ data structures.
A) FIFO
B) Random
C) LIFO
D) None of the above.
Points Earned: 1.0/1.0
Correct Answer(s): C
23. What is pushed onto the program execution stack when a method is call?
A) the whole method
B) the return address of the method being called
C) the object of method being called
D) the class of the method being called
Points Earned: 1.0/1.0
Correct Answer(s): B
24. The local variables used in each invocation of a method during an application's execution are stored ________.
A) the program execution stack
B) the activation record
C) the stack frame
D) All of the above.
Points Earned: 1.0/1.0
Correct Answer(s): D
25. A(n) ____ conversion occurs when a type is converted to a type that can hold more data.
A) implicit
B) widening
C) explicit
D) None of the above.
Points Earned: 1.0/1.0
Correct Answer(s): A
26. An int must be explicitly casted to which of the following?
A) sbyte
B) double
C) bool
D) float
Points Earned: 1.0/1.0
Correct Answer(s): A
27. Let x be a double. How can you typecast a double into a float?
A) implicitly
B) x = float
C) (float)x
D) x(float)
Points Earned: 1.0/1.0
Correct Answer(s): C
28. What does the Framework Class Library hold?
A) namespaces
B) classes
C) methods
D) All of the above.
Points Earned: 1.0/1.0
Correct Answer(s): D
29. Which directive allows programmers to use the Framework Class Library?
A) namespace
B) using
C) load
D) import
Points Earned: 1.0/1.0
Correct Answer(s): B
30. A ____ is provided to a random number generator to ensure the same sequence of numbers is not generated during each execution.
A) date
B) parameter
C) seed
D) None of the above.
Points Earned: 1.0/1.0
Correct Answer(s): C
31. Random-number generator scaling is the process of:
A) causing each number in a range to have equal likelihood of being generated
B) modifying the range from which a number will be generated
C) calculating a sequence of numbers to be generated
D) None of the above.
Points Earned: 1.0/1.0
Correct Answer(s): B
32. A(n) ____ is a value type that contains a set of constant values.
A) enumeration
B) object
C) set
D) None of the above.
Points Earned: 1.0/1.0
Correct Answer(s): A
33. Which of the following cannot be an enum's underlying type?
A) int
B) ulong
C) sbyte
D) double
Points Earned: 1.0/1.0
Correct Answer(s): D
34. Identifiers declared within a class have ____.
A) block scope
B) class scope
C) local scope
D) None of the above.
Points Earned: 1.0/1.0
Correct Answer(s): B
35. If a local variable in a method has the same name as a variable in the main program, what will occur?
A) an error is generated
B) the variable in the main program is "hidden" until the method is finished executing
C) the variable in the main program will override the variable from the method
D) None of the above.
Points Earned: 1.0/1.0
Correct Answer(s): B
36. Which of the following statements describes block scope?
A) It begins at the opening { of the class declaration and terminates at the closing }
B) It is valid for one statement only.
C) It limits label scope to only the method in which it is declared.
D) It begins at the identifier's declaration and ends at the terminating right brace (}).
Points Earned: 1.0/1.0
Correct Answer(s): D
37. Which of these statements best defines scope?
A) Scoping allows the programmer to use a class without using its fully qualified name.
B) Scope is the portion of a program that can refer to an entity by its simple name.
C) Scope refers to the classes that have access to a variable.
D) Scope determines whether a variable's value can be altered.
Points Earned: 1.0/1.0
Correct Answer(s): B
38. Which of the following will violate the rules of overloading methods?
A) Methods with the same signatures but different return types.
B) Methods with different number of arguments.
C) Methods with different signatures but the same return type.
D) Method with different types of arguments.
Points Earned: 1.0/1.0
Correct Answer(s): A
39. Which of the following method header represents Function(true, 0, 2.6)?
A) void Function( bool b, double d, int c )
B) void Function( bool b, double d, double d )
C) void Function( bool b, int c, double d )
D) b and c
Points Earned: 1.0/1.0
Correct Answer(s): D
40. Overloaded methods always have the same _________.
A) return type
B) order of the parameter
C) number of the parameters
D) method name
Points Earned: 1.0/1.0
Correct Answer(s): D
41. The technique of dividing large programs into simple problems is known as divide and conquer.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
42. C# provides features to facilitate the design, implementation, operation and maintenance of large programs.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
43. Methods can return at most one value.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
44. The return type of a method's return value is specified in the method call.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
45. Modularizing a program with methods allows software reusability.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
46. Methods should be large and perform as many tasks as possible.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
47. Repeating high-quality, high-performance code in a program helps ensure higher quality programs.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
48. The statements defining a method are written every time they need to be executed.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
49. Prepackaged methods and classes are available for use in the .NET Framework Class Library.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
50. To provide a better understanding of a program, all methods and classes should be written by the programmer.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
51. Methods defined by the programmer may only consist of predefined .NET method calls.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
52. Any variable declared with keyword const is a constant and cannot be changed after the constant is declared.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
53. A static variable represents class-wide information.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
54. A program contains a copy of a static variable for each object that is instantiated.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
55. The Math class only provides methods.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
56. Main is declared static because it is application's entry point; allows the execution environment to invoke Main without creating an instance of the class.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
57. Methods are called by writing the name of the method followed by a left square bracket followed by the argument (or a comma-separated list of arguments) of the method followed by a right square bracket.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
58. Strings can only be concatenated with the function instance_variable.Concat("example").A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
59. When a method call is within another method call, the calls will execute from the outside in.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
60. Method arguments may not be expressions.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
61. A static method may access static and non-static members.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
62. To access the class's non-static members, a static method must use a reference to an object of the class.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
63. When a return statement executes, control proceeds immediately to the first statement after the method that issues the return.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
64. Stack data structures have 3 functions.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
65. Since memory in a computer is finite, an error may occur known as stack overflow.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
66. Conversions that cause data loss are not allowed in C#.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
67. C# will attempt to perform conversions that do not result in data loss implicitly.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
68. Converting a simple type to another simple type may change the value.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
69. By including using System; at the top of a C# source code, programmers can use the unqualified class name, Console, instead of the fully qualified class name, System.Console.A) True
B) False
Points Earned: 0.0/1.0
Correct Answer(s): True
70. Programmers must already know the namespaces he/she needs in order to use the Framework Class Library.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
71. It is always better to write your own code than to search and use a class from the FCL.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
72. Values returned by the Random class method Next are pseudo-random numbers.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
73. The Next method produces a random number from zero up to and including the number it is provided by the programmer.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
74. A particular seed value always produces the same series of random numbers.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
75. When using Next, the range of possible values can be reduced, but the lowest value must be zero.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
76. The values produced by Random are weighted so that some values will be generated with greater frequency than others.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
77. Values produced by random-number generating methods are truly random. There is no way to predict the next result.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
78. If a change is made to an enumeration, the programmer must change the program in every place that the old value was used.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
79. To compare a simple-type value to the underlying value of an enumeration constant, you must use a cast operator to make the two types match.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
80. Any variables declared in a for structure header have block scope within that structure.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
A) dependent
B) independent
C) special
D) static
Points Earned: 1.0/1.0
Correct Answer(s): D
2. Methods that call themselves are known as ________.
A) reiterative
B) repeat-calling
C) recursive
D) self-calling
Points Earned: 1.0/1.0
Correct Answer(s): C
3. Information may be ____ methods.
A) passed to
B) returned from
C) manipulated in
D) All of the above.
Points Earned: 1.0/1.0
Correct Answer(s): D
4. A method is invoked by a ____.
A) return statement
B) method header
C) method call
D) None of the above.
Points Earned: 1.0/1.0
Correct Answer(s): C
5. A return type of ____ is specified for a method that does not return a value.
A) nothing
B) null
C) void
D) None of the above.
Points Earned: 1.0/1.0
Correct Answer(s): C
6. Methods are called by writing the name of the method followed by ____ enclosed in parentheses.
A) a condition
B) arguments
C) a counter
D) None of the above.
Points Earned: 1.0/1.0
Correct Answer(s): B
7. Which of the following is not a way of packaging code?
A) namespaces
B) variables
C) methods
D) classes
Points Earned: 1.0/1.0
Correct Answer(s): B
8. Programmers write ____ to define specific tasks that may be used at many points in a program.
A) classes
B) methods
C) modules
D) None of the above.
Points Earned: 1.0/1.0
Correct Answer(s): B
9. Many prepackaged classes and methods are provided in the .NET FCL, an acronym for the .
A) Framework Class Library
B) Framework Class Listing
C) Form Class Library
D) None of the above.
Points Earned: 1.0/1.0
Correct Answer(s): A
10. Which of the following correctly calls the Math class method Sqrt with a value of 36?
A) Sqrt(36);
B) Math.Sqrt(36);
C) Math.Sqrt = 36;
D) None of the above.
Points Earned: 1.0/1.0
Correct Answer(s): B
11. Which of the following describes a static variable?
A) a variable with one copy shared by all class objects
B) a variable whose value may not be changed
C) all of the above
D) None of the above.
Points Earned: 1.0/1.0
Correct Answer(s): A
12. When may an application omit the string[] args parameter from the Main header?
A) when the application does not need to use strings
B) when the application does not take command-line arguments
C) when the application does not output any strings
D) All of the above
Points Earned: 1.0/1.0
Correct Answer(s): B
13. Which of the following can be an argument to a method?
A) constants
B) variables
C) expressions
D) All of the above
Points Earned: 1.0/1.0
Correct Answer(s): D
14. How are various parameters separated in the method header?
A) braces
B) brackets
C) periods
D) commas
Points Earned: 1.0/1.0
Correct Answer(s): D
15. Let there be method called Function which takes 3 parameters of type bool. Which of the following method headers could it represent?
A) Function(bool a, bool b, bool c)
B) Function()
C) Both of the above
D) None of the above
Points Earned: 1.0/1.0
Correct Answer(s): A
16. The parameter list in the method header and the arguments in the method call must agree in:
A) number
B) type
C) order
D) all of the above
Points Earned: 1.0/1.0
Correct Answer(s): D
17. When an object is concatenated with a String:
A) a compilation error occurs
B) the object's class name is used
C) the object's ToString method is implicitly called
D) a runtime error occurs
Points Earned: 1.0/1.0
Correct Answer(s): C
18. To call a static method, use the _________ name followed by a period, and the method with its arguments.
A) class's
B) instance variable's
C) namespace's
D) All of the above
Points Earned: 1.0/1.0
Correct Answer(s): A
19. Which keyword can programmers use to break out of a void method?
A) continue
B) next
C) break
D) return
Points Earned: 1.0/1.0
Correct Answer(s): D
20. A static method can ________.
A) call only other static methods of the same class directly
B) manipulate only static fields in the same class directly
C) be called using the class name and a dot (.)
D) All of the above
Points Earned: 1.0/1.0
Correct Answer(s): D
21. Which statement is false?
A) Forgetting to return a value from a method that should return a value is a compilation error.
B) If a method does not return a value, the return-value-type in the method declaration can be omitted.
C) Placing a semicolon after the right parenthesis enclosing the parameter list of a method declaration is a syntax error.
D) Re-declaring a method parameter as a local variable in the method's body is a compilation error.
Points Earned: 1.0/1.0
Correct Answer(s): B
22. Stacks are _____________ data structures.
A) FIFO
B) Random
C) LIFO
D) None of the above.
Points Earned: 1.0/1.0
Correct Answer(s): C
23. What is pushed onto the program execution stack when a method is call?
A) the whole method
B) the return address of the method being called
C) the object of method being called
D) the class of the method being called
Points Earned: 1.0/1.0
Correct Answer(s): B
24. The local variables used in each invocation of a method during an application's execution are stored ________.
A) the program execution stack
B) the activation record
C) the stack frame
D) All of the above.
Points Earned: 1.0/1.0
Correct Answer(s): D
25. A(n) ____ conversion occurs when a type is converted to a type that can hold more data.
A) implicit
B) widening
C) explicit
D) None of the above.
Points Earned: 1.0/1.0
Correct Answer(s): A
26. An int must be explicitly casted to which of the following?
A) sbyte
B) double
C) bool
D) float
Points Earned: 1.0/1.0
Correct Answer(s): A
27. Let x be a double. How can you typecast a double into a float?
A) implicitly
B) x = float
C) (float)x
D) x(float)
Points Earned: 1.0/1.0
Correct Answer(s): C
28. What does the Framework Class Library hold?
A) namespaces
B) classes
C) methods
D) All of the above.
Points Earned: 1.0/1.0
Correct Answer(s): D
29. Which directive allows programmers to use the Framework Class Library?
A) namespace
B) using
C) load
D) import
Points Earned: 1.0/1.0
Correct Answer(s): B
30. A ____ is provided to a random number generator to ensure the same sequence of numbers is not generated during each execution.
A) date
B) parameter
C) seed
D) None of the above.
Points Earned: 1.0/1.0
Correct Answer(s): C
31. Random-number generator scaling is the process of:
A) causing each number in a range to have equal likelihood of being generated
B) modifying the range from which a number will be generated
C) calculating a sequence of numbers to be generated
D) None of the above.
Points Earned: 1.0/1.0
Correct Answer(s): B
32. A(n) ____ is a value type that contains a set of constant values.
A) enumeration
B) object
C) set
D) None of the above.
Points Earned: 1.0/1.0
Correct Answer(s): A
33. Which of the following cannot be an enum's underlying type?
A) int
B) ulong
C) sbyte
D) double
Points Earned: 1.0/1.0
Correct Answer(s): D
34. Identifiers declared within a class have ____.
A) block scope
B) class scope
C) local scope
D) None of the above.
Points Earned: 1.0/1.0
Correct Answer(s): B
35. If a local variable in a method has the same name as a variable in the main program, what will occur?
A) an error is generated
B) the variable in the main program is "hidden" until the method is finished executing
C) the variable in the main program will override the variable from the method
D) None of the above.
Points Earned: 1.0/1.0
Correct Answer(s): B
36. Which of the following statements describes block scope?
A) It begins at the opening { of the class declaration and terminates at the closing }
B) It is valid for one statement only.
C) It limits label scope to only the method in which it is declared.
D) It begins at the identifier's declaration and ends at the terminating right brace (}).
Points Earned: 1.0/1.0
Correct Answer(s): D
37. Which of these statements best defines scope?
A) Scoping allows the programmer to use a class without using its fully qualified name.
B) Scope is the portion of a program that can refer to an entity by its simple name.
C) Scope refers to the classes that have access to a variable.
D) Scope determines whether a variable's value can be altered.
Points Earned: 1.0/1.0
Correct Answer(s): B
38. Which of the following will violate the rules of overloading methods?
A) Methods with the same signatures but different return types.
B) Methods with different number of arguments.
C) Methods with different signatures but the same return type.
D) Method with different types of arguments.
Points Earned: 1.0/1.0
Correct Answer(s): A
39. Which of the following method header represents Function(true, 0, 2.6)?
A) void Function( bool b, double d, int c )
B) void Function( bool b, double d, double d )
C) void Function( bool b, int c, double d )
D) b and c
Points Earned: 1.0/1.0
Correct Answer(s): D
40. Overloaded methods always have the same _________.
A) return type
B) order of the parameter
C) number of the parameters
D) method name
Points Earned: 1.0/1.0
Correct Answer(s): D
41. The technique of dividing large programs into simple problems is known as divide and conquer.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
42. C# provides features to facilitate the design, implementation, operation and maintenance of large programs.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
43. Methods can return at most one value.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
44. The return type of a method's return value is specified in the method call.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
45. Modularizing a program with methods allows software reusability.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
46. Methods should be large and perform as many tasks as possible.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
47. Repeating high-quality, high-performance code in a program helps ensure higher quality programs.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
48. The statements defining a method are written every time they need to be executed.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
49. Prepackaged methods and classes are available for use in the .NET Framework Class Library.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
50. To provide a better understanding of a program, all methods and classes should be written by the programmer.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
51. Methods defined by the programmer may only consist of predefined .NET method calls.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
52. Any variable declared with keyword const is a constant and cannot be changed after the constant is declared.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
53. A static variable represents class-wide information.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
54. A program contains a copy of a static variable for each object that is instantiated.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
55. The Math class only provides methods.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
56. Main is declared static because it is application's entry point; allows the execution environment to invoke Main without creating an instance of the class.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
57. Methods are called by writing the name of the method followed by a left square bracket followed by the argument (or a comma-separated list of arguments) of the method followed by a right square bracket.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
58. Strings can only be concatenated with the function instance_variable.Concat("example").A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
59. When a method call is within another method call, the calls will execute from the outside in.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
60. Method arguments may not be expressions.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
61. A static method may access static and non-static members.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
62. To access the class's non-static members, a static method must use a reference to an object of the class.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
63. When a return statement executes, control proceeds immediately to the first statement after the method that issues the return.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
64. Stack data structures have 3 functions.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
65. Since memory in a computer is finite, an error may occur known as stack overflow.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
66. Conversions that cause data loss are not allowed in C#.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
67. C# will attempt to perform conversions that do not result in data loss implicitly.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
68. Converting a simple type to another simple type may change the value.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
69. By including using System; at the top of a C# source code, programmers can use the unqualified class name, Console, instead of the fully qualified class name, System.Console.A) True
B) False
Points Earned: 0.0/1.0
Correct Answer(s): True
70. Programmers must already know the namespaces he/she needs in order to use the Framework Class Library.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
71. It is always better to write your own code than to search and use a class from the FCL.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
72. Values returned by the Random class method Next are pseudo-random numbers.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
73. The Next method produces a random number from zero up to and including the number it is provided by the programmer.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
74. A particular seed value always produces the same series of random numbers.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
75. When using Next, the range of possible values can be reduced, but the lowest value must be zero.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
76. The values produced by Random are weighted so that some values will be generated with greater frequency than others.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
77. Values produced by random-number generating methods are truly random. There is no way to predict the next result.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
78. If a change is made to an enumeration, the programmer must change the program in every place that the old value was used.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
79. To compare a simple-type value to the underlying value of an enumeration constant, you must use a cast operator to make the two types match.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
80. Any variables declared in a for structure header have block scope within that structure.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
Subscribe to:
Posts (Atom)