C# Chapter 2 Part 1
Another way to write the following expression is _______
ans *= v1 - 1
ans = ans * v1--;
If you expect to receive an "A" in this course, which of the following declarations would be most appropriate for storing the grade?
char letterGrade
T/F) C# allows you to mix numeric integral types and floating-point types in an expression.
True
(T/F) An int variable would be the most appropriate type for a memory location that will be used to store the monthly membership dues for the computer club.
False
(T/F) An appropriate identifier used to store the total transaction amount is totalTransactionAmount.
True
(T/f) The bool data type can take values of true/false and on/off/
False
The decimal equivalent for 3.42e-5 in scientific notation is .00342
False
The result of the following expression is
______.double ans, v1 = 45.7, v2 = 10.5;
int v3 = 5;
ans = (int) v1 + v2 / (double) v3;
47.1
Which of the following formats displays two digits to the right of the decimal?
{0:C}
{0:c}
{0:f2}
(all of the above)
Which of the following would be the most appropriate identifier for a memory location that will store the amount of rainfall for a given period of time?
amountOfRain
(T/F) With only 8 bits, you can represent 2^8 or 256 different decimals.
True
(T/F) Placing the two plus symbols (++) before an identifier causes one to be added to the memory location referenced by the variable prior to any other statement's execution.
True
(T/F) An error will be produced when moreData is assigned the boolean variable shown above because the keyword true should be enclosed in double quotation marks.
False
Which of the following is a valid identifier?
finaleGrade
What is stored in ans as a result of the arithmetic expression, given the following declarations?
int ans = 5, v1 = 2, v2 = 10, v3 = 18;
ans += v1 + 10 * (v2-- / 5) + v3 / v2;
29
(T/F) the value 78,888.90 is printed as output when the {0:c} format specifiers used in 78888.894
False
(T/f) The result of "123" + "321" is "123321"
True
The compiler is responsible for ____.
Translating high-level programming language into machine-readable form
WriteLine( ) differs from Write( ) in that ____.
WriteLine( ) advances to the next line after it finishes displaying output
Using the object-oriented approach, a(n) ____ is a combined set of attributes and actions.
Class
Which of the following would display "Good day!" on the screen?
Console.WriteLine("Good day!");
(T/F) Procedural programming is also called structured programming.
False
Comments that use two forward slashes are called ____.
inline
Given the following output statement, what would be displayed?
Console.Write("Ok\\ \"I\'m sure\"");
Ok\ "I'm sure"
(T/F) Since C# is an object oriented language, everything is designed around a class.
True
The system namespace contains classes that define commonly used types or classes.
True
One class predefined as part of .NET is ____
Console
If you write a program and, instead of multiplying two values together as intended, you divide one value by the other, you produce a(n) ____ error.
logic
(T/F) The rule that every statement should end with a semicolon is an example of a syntax rule.
True
(T/F) Classes and class diagrams are used most often with the structured procedural approach to software development.
False
(T/F) The Framework Class Library (FCL) consists of more than 2,000 classes.
True
(T/F) In C#, it is tradition to name the file containing the class the same name as the class name, except the file name will have a .c# extension affixed to the end of the name.
False
In a C# program, namespace is used to ____
Group functionally related types under a single name.
(T/F) Each instruction statement has a semantic meaning—a specific way in which it should be used.
True
(T/F) Procedural and object oriented are two commonly used design methods.
True
(T/F) Comments are considered instructions to the computer.
False
Problem specifications often include the desired output of the program in terms of what is to be displayed, saved, or printed.
True
The ____ parameter type cannot be used unless the original argument is initialized before it is sent to the method.
ref
____ is added to hold the screen when the program runs.
Read( )
All programs consist of at least one ____________.
method
Call by ____________ is the default parameter type.
value
All Main( ) method headings must include the ____________ modifier meaning that the method belongs to the type itself rather than to a specific object of a class.
static
(T/F) The Read( ) method is different from the ReadLine( ) method in that the Read( ) returns an int and the ReadLine( ) returns a string argument.
true
(T/F) One way to ensure that you have one entry and one exit from a method is to include a single return statement as the last statement in the method.
T
The Math class has a number of static methods located in the ____ namespace.
System
double answer = Math.Pow(3, 2);
The result of the call to Math.Pow( ) in the above statement is to store ____ in answer:
9
Which of the following is NOT a parameter type?
in