1. (TCO 1) Which of the following is an invalid C++ identifier? (Points : 5) Two
ID: 3627646 • Letter: 1
Question
1. (TCO 1) Which of the following is an invalid C++ identifier? (Points : 5)TwoForOne
A_+_B
two_for_one
A_plus_B
2. (TCO 1) Which of the following identifies syntax errors in programs written in a high-level language? (Points : 5)
Assembler
Compiler
Preprocessor
Linker
3. (TCO 1) For the values given, what will c contain after executing the following?
int a = 9, b = 4, c = -1;
c = a / b - 1;
(Points : 5)
3
1.25
1
-1
4. (TCO 1) For the values given, what will c contain after executing the following?
int a = 9, b = 4, c = -1;
c += b++ * a;
(Points : 5)
45
36
44
35
5. (TCO 1) A slash sign (/) is called (Points : 5)
the separation operator.
the divide operator.
the slash operator.
None of the above
6. (TCO 1) What is the result of 56 % 10? (Points : 5)
10
5
5.6
6
7. (TCO 1) What is the output for the following code fragment?
int var1 = 20;
cout << var1--;
cout << ++var1;
(Points : 5)
1920
1921
2020
2021
8. (TCO 1) Which operation in the following expression will be performed first?
c = ++a / b + 5;
(Points : 5)
++a
a / b
b + 5
assignment to c
9. (TCO 2) When used with cout, << is called (Points : 5)
the insertion operator
the extraction operator
the assignment operator
None of the above
10. (TCO 2) Which of the following would you add to your program to read an entire line of input into a string variable named input? (Points : 5)
cin >> input;
cin.getline(input);
getline(cin, input);
cin << input;
11. (TCO 2) Which statement outputs a double value in a field of seven characters with four digits after the decimal point? (Points : 5)
cout << 7chars << 4digits << 1.2345678;
cout << fixed << setprecision(4) << 1.2345;
cout << setprecision(7) << setw(4) << 1.2345;
cout << setprecision(4) << setw(7) << 1.2345678;
Explanation / Answer
1. A_+_B 2. Compiler 3. 1 4. 35 5. Divide operator 6. 6 7. 2020 8. ++a 9. insertion operator 10. cin.getline(input) 11. coutRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.