CS 159 Final Lab Quizzes
T/F: The first character of an identifier cannot be a digit character. - Answers-True
T/F: Every program must have exactly one function named main. - Answers-True.
T/F: The float data type uses the character 'd' as its t ype conversion code associated with its
placeholder. - Answers-False
T/F: The C programming language provides single-line and multi-line options for commenting. - Answers-
True
T/F: The documentation of a program is improved through the use of symbolic constants. - Answers-
True
T/F:
A scanf function is composed of a format string and a data list. - Answers-True
T/F: The following is a course standard: Indent all code found within the main function at least two
spaces. - Answers-False
T/F: The following is a course standard: Place a single space between all operators and operands. -
Answers-True
T/F: The width modifier may be used to specify the minimum number of positions reserved for the
output. - Answers-True
,T/F: An identifier selected for a variable must be meaningful, or descriptive, of the variable's role in your
program. - Answers-True
T/F: The fabs function is found in math.h. - Answers-True
Simplify the following expression: 84 % 0 - Answers-Arithmetic Exception.
Simplify the following expression: 16%17 - Answers-16.
Given that x = 3, y = 2, z = 5 and each variable is an integer, what is the value assigned to x after the
following expression: x /= z - y; - Answers-1.
Simplify the following expression: 37 % 14 - Answers-9.
Simplify the following expression 51 % 5 - Answers-1.
Given that x = 3, y = 2, z = 5 and each variable is an integer, what is the value assigned to x after the
following expression: x += z * y; - Answers-13.
T/F: Comment all variables to the right of each declarations. - Answers-True
T/F: Multiple variables can be declared on a single line if they are related. - Answers-False.
Given A and B are integer variables, both are greater than zero, and A is less than B. What is the range of
values possible as a result of the expression: B % A? - Answers-Range is [0, A - 1]
, What is the result of the following expression: / 2.0 - Answers-0.0
What is the result of the following expression: 4 / (float) 5 - Answers-0.8
T/F: The possible result of the following expression for any non-negative integer x is 0 or 1: (x + 1) % x -
Answers-False
T/F: The smallest possible value of the following expression for any non-negative integer x is 0: (x + 2) %
(x + 1) - Answers-True.
What is the result of the following expression: 13. - Answers-6.75
T/F: An implicit type conversion is necessary when an operator has operands of different types. -
Answers-True.
What is the result of the following expression: (float) 4 / (int) 2.2 - Answers-2.0
T/F: An explicit type conversion is applied to the value of a variable after that value has been retrieved
from memory. - Answers-True
T/F: The result of the following expression is 17: (int) (17.3 + 0.5) - Answers-True
T/F: The return statement is optional in a void function but can be used as long as no parentheses are
used. - Answers-True.
T/F: The individual task represented by a function should be testable apart from the rest of the program.
- Answers-True.
T/F: The first character of an identifier cannot be a digit character. - Answers-True
T/F: Every program must have exactly one function named main. - Answers-True.
T/F: The float data type uses the character 'd' as its t ype conversion code associated with its
placeholder. - Answers-False
T/F: The C programming language provides single-line and multi-line options for commenting. - Answers-
True
T/F: The documentation of a program is improved through the use of symbolic constants. - Answers-
True
T/F:
A scanf function is composed of a format string and a data list. - Answers-True
T/F: The following is a course standard: Indent all code found within the main function at least two
spaces. - Answers-False
T/F: The following is a course standard: Place a single space between all operators and operands. -
Answers-True
T/F: The width modifier may be used to specify the minimum number of positions reserved for the
output. - Answers-True
,T/F: An identifier selected for a variable must be meaningful, or descriptive, of the variable's role in your
program. - Answers-True
T/F: The fabs function is found in math.h. - Answers-True
Simplify the following expression: 84 % 0 - Answers-Arithmetic Exception.
Simplify the following expression: 16%17 - Answers-16.
Given that x = 3, y = 2, z = 5 and each variable is an integer, what is the value assigned to x after the
following expression: x /= z - y; - Answers-1.
Simplify the following expression: 37 % 14 - Answers-9.
Simplify the following expression 51 % 5 - Answers-1.
Given that x = 3, y = 2, z = 5 and each variable is an integer, what is the value assigned to x after the
following expression: x += z * y; - Answers-13.
T/F: Comment all variables to the right of each declarations. - Answers-True
T/F: Multiple variables can be declared on a single line if they are related. - Answers-False.
Given A and B are integer variables, both are greater than zero, and A is less than B. What is the range of
values possible as a result of the expression: B % A? - Answers-Range is [0, A - 1]
, What is the result of the following expression: / 2.0 - Answers-0.0
What is the result of the following expression: 4 / (float) 5 - Answers-0.8
T/F: The possible result of the following expression for any non-negative integer x is 0 or 1: (x + 1) % x -
Answers-False
T/F: The smallest possible value of the following expression for any non-negative integer x is 0: (x + 2) %
(x + 1) - Answers-True.
What is the result of the following expression: 13. - Answers-6.75
T/F: An implicit type conversion is necessary when an operator has operands of different types. -
Answers-True.
What is the result of the following expression: (float) 4 / (int) 2.2 - Answers-2.0
T/F: An explicit type conversion is applied to the value of a variable after that value has been retrieved
from memory. - Answers-True
T/F: The result of the following expression is 17: (int) (17.3 + 0.5) - Answers-True
T/F: The return statement is optional in a void function but can be used as long as no parentheses are
used. - Answers-True.
T/F: The individual task represented by a function should be testable apart from the rest of the program.
- Answers-True.