CS111 Quiz 3

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

What is the value of average after the following code executes? double average; average = 1.0 + 2.0 + 3.0 / 3.0;

4.0

What will the value of x be after the following statements execute? int x = 0; int y = 5; int z = 4; x = y + z * 2;

13

Assume that x is an int variable. What value is assigned to x after the following assignment statement is executed? x = - 3 + 4 % 6 / 5;

-3

What is the value stored at x, given the statements: int x; x = 3 / static_cast<int> (4.5 + 6.4);

0

Which line in the following program will cause a compiler error? 1 #include <iostream> 2 using namespace std; 3 4 int main() 5 { 6 const int MY_VAL = 77; 7 MY_VAL = 99; 8 cout << MY_VAL << endl; 9 return 0; 10 }

7

What will the value of result be after the following statement executes? result = 6 - 3 * 2 + 7 - 10 / 2 ;

2

What will the value of x be after the following statements execute? x = (19 − 3) * (2 + 3) / 4

20

In the following C++ statement, what will be executed first according to the order of precedence? result = 6 - 3 * 2 + 7 - 10 / 2;

3 * 2

Write the C++ expression for the following algebraic expression. (a^3)/(b^2 k^4)

c = pow(a, 3) / (pow(b, 2) * pow(k, 4));

You want the user to enter the length, width, and height from the keyboard. Which cin statement is correctly written?

cin >> length >> width >> height;


Kaugnay na mga set ng pag-aaral

ch. 6 cinematographic properties of the shot

View Set

2022 CompTIA SECURITY+ SY0-601 BEST EXAM STUDY by Brian MacFarlane

View Set

Davis Edge Leadership and Management Quiz

View Set

CFA Level 1 Understanding Balance Sheets

View Set

4.7 & 4.8 - Inverse Trigonometric Functions and Applications & Models

View Set

Womens Health/Disorders and Childbearing Health EVOLVE

View Set