Programming Chp 2 quiz
Operator precedence rules ensure that addition and subtraction always take place prior to multiplication, division, or remainder in an expression. True. False
False
An escape sequence is used to represent special characters such as a carriage return or a tab, and always begins with a backslash. True False
True
The equal sign (=) is the C# assignment operator. True False
True
How is a Boolean variable declared in a program? a. A bool type variable must be declared, followed by the bool value. b. An int type variable must be declared, followed by the bool value. c. A char type variable must be declared, followed by the bool value. d. A boolean type variable must be declared, followed by the bool value.
a. A bool type variable must be declared, followed by the bool value.
What operator is used for exponentials in the C# programming language? a. None of the above. b. ^ c. * d. %
a. None of the above.
What method from the Convert class can be used to convert a specified value to an 8-bit unsigned integer? a. ToByte() b. ToSingle() c. ToDecimal() d. ToInt16()
a. ToByte()
In C#, += adds the operand on the right to the operand on the left and assigns it to the operand on the left in one step. What is the name for this operator? a. add and assign b. prefix increment c. postfix increment d. increment and assign
a. add and assign
What type of program specifically allows and accepts user input? a. interactive b. static program c. procedural program d. constant program
a. interactive program
In the C# statement moneyString = someMoney.ToString("F3"), what is "F3" an example of? a. standard numeric format string b. literal constant c. named constant d. intrinsic type
a. standard numeric format string
What keyword can be used to create a named identifier for a memory location whose contents cannot change? a.const b. static c. fix d. final
a.const
What method can be used to accept user input from the keyboard on the console? a. Next() b. ReadLine() c. Input() d. NextLine()
b. ReadLine()
What data type can be used to hold any single character, including numbers and non-printing characters? a. int b. char c. bool d. string
b. char
What type of operator can be used to reduce a variable's value by 1 either at time of evaluation, or after it is evaluated, depending on placement? a. sub and assign operator b. decrement operator c. add and assign operator d. increment operator
b. decrement operator
When using arithmetic operations with operands of dissimilar types, an automatic conversion of nonconforming operands to a unifying type occurs. What is this conversion process called? a. level cast b. implicit cast c. explicit cast d. manual cast
b. implicit cast
What type of expression has a Boolean value as a result? a. decrement b. comparison c. unifying d. assignment
b.Comparison
What method can be used as an alternative to the Convert class methods to change a string into a number? a. Assign() b. Cast() c. Parse() d. Write()
c. Parse()
What happens when "string1" is added to "string2" using the + sign in the C# programming language? a. A type error occurs, and the program is halted. b. The strings are converted to integer equivalents and then added together. c. The strings are concatenated together. d. The result is returned as a boolean integer
c. The strings are concatenated together.
What statement regarding operator precedence is accurate? a. Operations are always evaluated left to right, regardless of the expressions. b. Multiplication, division, and addition always take place prior to the calculation of a remainder c. Operations that are placed in parentheses are evaluated first. d. Addition and subtraction operations are evaluated first.
c.Operations that are placed in parentheses are evaluated first
When running a program, an instruction to the user to enter data for the program to process is known by what term? a. hint b. cue c. prompt d. line
c.prompt
An assignment that is made when a variable is declared is known as what? a. A definition of the variable b. An allocation of the variable c. An assignment to the variable d. An initialization of the variable
d. An initialization of the variable
You are performing an arithmetic operation and have placed the desired result type in parentheses followed by a variable to be cast with the result. What is this an example of? a. intrinsic casting b. automatic casting c. explicit casting d. implicit casting
d. implicit casting
What uses curly braces containing a number that indicates the desired position for a variable in a list that follows a string used for formatting purposes? a. whitespace b. format string c. namespace d. placeholder
d. placeholder
What data type can be used to hold a series of characters? a. char b. int c. sbyte d. string
d. string