Question: You can assign int values to int, double, and decimal variables.

Answer Choices:
True
False

Answer: False

 

Question: Which one of the following statements declares a string variable named message?

Answer Choices:
message string;
string = message;
string message;
message = string;

Answer: string message;

 

Question: You can use a(n) __________ to explicitly convert a value from one numeric data type to another, even if the conversion might result in a loss of data.

Answer Choices:
cast operator
conversion formula
data binding
explicit operator

Answer: cast operator

 

Question: You can declare multiple variables of different data types with one declaration statement.

Answer Choices:
True
False

Answer: False

 

Question: A variable’s __________ indicates the type of data that the variable will hold.

Answer Choices:
name
location in memory
data type
assignment value

Answer: data type

 

Question: You can use an _______ to explicitly convert a value from one numeric data type to another, even if the conversion might result in a loss of data.

Answer Choices:
explicit operator
cast operator
data binding
conversion formula

Answer: cast operator

 

Question: The C# language provides many data types for storing fundamental types of data, such as strings, integers, and real numbers.

Answer Choices:
True
False

Answer: True

 

Question: Because decimal is the preferred data type for storing monetary amounts, remembering that “m” stands for “money” might help you to remember that decimal literals must end with the letter m or n.

Answer Choices:
True
False

Answer: False

 

Question: A variable declaration specifies three things about the variable: the variable’s data type, the variable’s name, and the variable’s location in memory.

Answer Choices:
True
False

Answer: False

 

Question: To convert a string to any of the numeric data types, we use a family of methods in the .NET Framework known as the _______.

Answer Choices:
ToString methods
Parse methods
Convert methods
IsCxx methods

Answer: Parse methods

 

Question: You cannot assign a double or a decimal value to an int variable because such an assignment could result in __________.

Answer Choices:
buffer overflow
complex parse errors
a loss of data
value sharing conflicts

Answer: a loss of data

 

Question: Which one of the following assignment statements, for variables of the double data type, will cause an error?

Answer Choices:
double density = 33.12;
double length = 0.05;
double num = 4;
double bonus = 33.5m;

Answer: double bonus = 33.5m;

 

Question: The C# compiler will compile code that tries to use an unassigned variable.

Answer Choices:
True
False

Answer: False

 

Question: The binary representation of the decimal number 212 is:

Answer Choices:
11101110
10110100
10110110
11010100

Answer: 11010100

 

Question: Which one of the following statements declares the string variables city, state, and zip using a single declaration statement?

Answer Choices:
<font face=”Courier New”>string city, state, zip;</font>
<font face=”Courier New”>string city; string state; string zip;</font>
<font face=”Courier New”>string city state zip;</font>
<font face=”Courier New”>string city; string state; string zip;</font>

Answer: <font face=”Courier New”>string city, state, zip;</font>

 

Question: Programs use data types to store data in memory.

Answer Choices:
True
False

Answer: True

 

Question: Which one of the following statements initializes the color variable with the string “red”?

Answer Choices:
string color = “red”;
“red” = string color;
color = “red”;
string color[“red”];

Answer: string color = “red”;

 

Question: In C#, the + operator has two uses: string concatenation and numeric addition.

Answer Choices:
True
False

Answer: True

 

Question: Which one of the following assignment statements, for variables of the decimal data type, will cause an error?

Answer Choices:
<font face=”Courier New”>decimal cost = .99m;</font>
<font face=”Courier New”>decimal retail = 100;</font>
<font face=”Courier New”>decimal wholesale = 50.0;</font>
<font face=”Courier New”>decimal fee = 0.01m;</font>

Answer: <font face=”Courier New”>decimal retail = 100;</font>

 

Question: Once you have assigned a value to a variable, you can use the variable in other operations.

Answer Choices:
True
False

Answer: True

 

Question: In C#, a variable must be assigned a value before it can be used.

Answer Choices:
True
False

Answer: True