COSC 1436 PRACTICE EXAM ALL QUESTIONS AND
ANSWERS GRADED A+
✔✔True - ✔✔Each byte in memory is identified by a unique number known as an
address.
✔✔// - ✔✔single line comment
✔✔/* */ - ✔✔block comment
✔✔# - ✔✔beginning of preprocessor
✔✔; - ✔✔end of a complete statement
✔✔endl - ✔✔new line
✔✔" " - ✔✔used to signify a string
✔✔' ' - ✔✔used to signify a character
✔✔{ } - ✔✔enclose a group of statements (such as lines in a function)
✔✔\ - ✔✔escape character
✔✔Constant identifier names must be written in all caps - ✔✔Which of the following is
NOT true regarding named constants?
Use the following keyword to define a constant: const
Constant identifier names must be written in all caps.
An initialization value must be given at a declaration/definition time.
A compiler error will occur if a statement attempts to change the value of a constant.
✔✔+ - ✔✔addition
✔✔- - ✔✔subtraction or negation
✔✔* - ✔✔multiplication
✔✔/ - ✔✔division
✔✔% - ✔✔modulus/remainder
✔✔= - ✔✔assignment
✔✔int - ✔✔What is the correct data type of this literal: -342
, ✔✔double/float - ✔✔What is the correct data type of this literal: 9.0
✔✔string - ✔✔What is the correct data type of this literal: "Hello"
✔✔char - ✔✔What is the correct data type of this literal: 'X'
✔✔string - ✔✔What is the correct data type of this literal: "X"
✔✔bool - ✔✔What is the correct data type of this literal: true
✔✔1stNum - ✔✔Which of the following is NOT a legal identifier?
_firstNum
num_1
first_num
1stNum
firstNum
✔✔1 - ✔✔How many bytes are needed to store: 'n'
✔✔2 - ✔✔How many bytes are needed to store: "n"
✔✔1 - ✔✔How many bytes are needed to store: '\n'
✔✔2 - ✔✔How many bytes are needed to store: "\n"
✔✔4 - ✔✔How many bytes are needed to store: "\\n\\"
✔✔b=a+2 - ✔✔Write a statement that adds 2 to the variable a and stores the result in
the variable b.
✔✔b=a-8 - ✔✔Write a statement that subtracts 8 from the variable a and stores the
result in the variable b.
✔✔Erroneous value - ✔✔Based on the following code and the following input, what will
be the value in the variable num3 after the cin line:
int num1, num2, num3;
char symbol;
cout << "Enter the data: ";
cin >> num1 >> symbol >> num2 >> num3;
Input:
48 18 * 28 $
ANSWERS GRADED A+
✔✔True - ✔✔Each byte in memory is identified by a unique number known as an
address.
✔✔// - ✔✔single line comment
✔✔/* */ - ✔✔block comment
✔✔# - ✔✔beginning of preprocessor
✔✔; - ✔✔end of a complete statement
✔✔endl - ✔✔new line
✔✔" " - ✔✔used to signify a string
✔✔' ' - ✔✔used to signify a character
✔✔{ } - ✔✔enclose a group of statements (such as lines in a function)
✔✔\ - ✔✔escape character
✔✔Constant identifier names must be written in all caps - ✔✔Which of the following is
NOT true regarding named constants?
Use the following keyword to define a constant: const
Constant identifier names must be written in all caps.
An initialization value must be given at a declaration/definition time.
A compiler error will occur if a statement attempts to change the value of a constant.
✔✔+ - ✔✔addition
✔✔- - ✔✔subtraction or negation
✔✔* - ✔✔multiplication
✔✔/ - ✔✔division
✔✔% - ✔✔modulus/remainder
✔✔= - ✔✔assignment
✔✔int - ✔✔What is the correct data type of this literal: -342
, ✔✔double/float - ✔✔What is the correct data type of this literal: 9.0
✔✔string - ✔✔What is the correct data type of this literal: "Hello"
✔✔char - ✔✔What is the correct data type of this literal: 'X'
✔✔string - ✔✔What is the correct data type of this literal: "X"
✔✔bool - ✔✔What is the correct data type of this literal: true
✔✔1stNum - ✔✔Which of the following is NOT a legal identifier?
_firstNum
num_1
first_num
1stNum
firstNum
✔✔1 - ✔✔How many bytes are needed to store: 'n'
✔✔2 - ✔✔How many bytes are needed to store: "n"
✔✔1 - ✔✔How many bytes are needed to store: '\n'
✔✔2 - ✔✔How many bytes are needed to store: "\n"
✔✔4 - ✔✔How many bytes are needed to store: "\\n\\"
✔✔b=a+2 - ✔✔Write a statement that adds 2 to the variable a and stores the result in
the variable b.
✔✔b=a-8 - ✔✔Write a statement that subtracts 8 from the variable a and stores the
result in the variable b.
✔✔Erroneous value - ✔✔Based on the following code and the following input, what will
be the value in the variable num3 after the cin line:
int num1, num2, num3;
char symbol;
cout << "Enter the data: ";
cin >> num1 >> symbol >> num2 >> num3;
Input:
48 18 * 28 $