Question 1 What is the output after the following code executes? int x=10; if (
ID: 3560321 • Letter: Q
Question
Question 1 What is the output after the following code executes?
int x=10; if ( ++x > 10 ) {
x = 13;
}
cout << x;
Question 2 What is the output of the following program segment?
int x = 0;
++x;
x++;
++x;
x++;
++x;
cout << x;
Question 3 What is the value of the following expression? (false || (4-3 && 6))
true
false
0
illegal syntax
Question 4
if x is -1, what is the value of (!(x == 0))?
false
true
unable to determine
invalid syntax
Question 5 Given the following code, what is the final value of i at the end of the program? int i; for(i=0; i<=4;i++) { cout << i << endl; }
Question 5 pow(2,3) is the same as pow(3,2). Question 14 options: True False
Question 6 The functions pow(), sqrt(), and fabs() are found in which include file?
cstdlib
cmath
iostream
regular
Question 7 What is the output of the following function call? //function body int factorial(int n) { int product=0; while(n > 0) { product = product * n; n; } return product; } //function call cout << factorial(4);
Explanation / Answer
Question 1 What is the output after the following code executes?
int x=10; if ( ++x > 10 ) {
x = 13;
}
cout << x;
x = 13
Question 2 What is the output of the following program segment?
int x = 0;
++x; // 1
x++; // 2
++x; // 3
x++; // 4
++x; // 5
cout << x;
x = 5
Question 3 What is the value of the following expression? (false || (4-3 && 6))
true
Question 4
if x is -1, what is the value of (!(x == 0))?
true
Question 5 Given the following code, what is the final value of i at the end of the program? int i; for(i=0; i<=4;i++) { cout << i << endl; }
0
1
2
3
4
Question 5 pow(2,3) is the same as pow(3,2). False
Question 6 The functions pow(), sqrt(), and fabs() are found in which include file?
cmath
Question 7 What is the output of the following function call? //function body
int factorial(int n)
{ int product=0; while(n > 0)
{
product = product * n; n--; }
return product;
} //function call
cout << factorial(4);
0
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.