Question
1. Which expression determines whether x is less than 120 and greater than 20? Select one: a. (x < 120) && (x > 20) b.
1. Which expression determines whether x is less than 120 and greater than 20?
Select one:
a. (x < 120) && (x > 20)
b. (x < 120) || (x > 20)
c. (x < 120) !! (x > 20)
d. (20 < x < 120)
2. What is the output of the following code?
int main() {
int i = 0;
int j = 2;
for (i = 0; i <= 6; i = i + 2) {
cout << (i * j) << " ";
}
return 0;
}
Select one:
a. 0 4 8 12 16
b. 0 4 8 12
c. 0 2 4 6
d. 0 2 4 6 8
3. Which function takes the log of base ten of float y?
Select one:
a. log(y);
b. log10(y);
c. fabs(y);
d. ceil(y);
4. What is the output of the following code?
int main() {
int a = 2; int b = 2;
int c = 15;
while (a < 10) {
a = a + 1;
if ( (b * a) < c) continue;
cout << a << " ";
}
return 0;
}
Select one:
a. 7 8 9
b. 9 10 11
c. 8 9 10
d. 7 8 9 10
5. What is the output of the following code?
int main() {
int x = 5; int y = 6; int z = 2;
x = z + y;
z = z * 3;
cout << z;
return 0;
}
Select one:
a. 2
b. 6
c. 8
d. 11
6. Which expression determines whether two times x is greater than y?
Select one:
a. !( (x * 2) > y)
b. (x * 2) > y
c. !( (x * 2) == y)
d. x > (y * 2)
7. What is the output of the following code?
int main() {
string firstName = "Travis";
string lastName = "Jones";
string fullName = "";
fullName = firstName + " "; // line 5
fullName += lastName; // line 6
cout << fullName;
return 0;
}
Select one:
a. Travis Jones
b. Jones Travis
c. No output. Error on line 5.
d. No output. Error on line 6.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started