Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. What is the output of the following code? int x = 25, y = 15; x = x / y; cout < < x;

1. What is the output of the following code?

int x = 25, y = 15; x = x / y; cout << x;

a.

2

b.

1.667

c.

25

d.

1

2. What is the output for the following code? (Write only the number with no extra spaces or characters.)

int x, y, z; x = 21; y = 8; z = x % y; cout << z;

3. What is the output for the following code? (Write only the number with no extra spaces or characters.)

int x, y, z; x = 15; y = 4; z = x / y; cout << z;

4. What is the final value of z?

int x = 3; double y = 8.0, z; z = y / x;

a.

2.6667

b.

2

c.

3

d.

2.3333

5. What is the final value of c?

int a = 55, b = 10; double c; c = a / b;

6. What is the final value of j?

int h = 15, i = 4, j = 10; j = h / 2 + i * 3 + j / 3;

7. What is the final value of avg?

double s = 100, t = 110, u = 120, avg; avg = s + t + u / 3;

8. What is the final value of z?

double z; z = 20 / 6 + 2.5;

9. What will the output be?

int a = 50, b = 5; int c; c = a % b; cout << "The answer is" << c << "inches";

a.

The answer is 0 inches

b.

The answer is10inches

c.

The answer is0inches

d.

The answer is 10 inches

10. If the input is 7 and x is a variable of type int, then the statement cin >> x; assigns the value 7 to x.

a)True

b)False

11. How many lines will be printed by the following statement?

cout << "Hello" << endl << "Out" << "There";

a.

3

b.

1

c.

none

d.

2

12. Given the following statements, match each C++ code segment with its corresponding output:

int a = 25, b = 20; double c = 5.0;

1. ___ cout << a + b / 2.0 + 1.5 * c;

2. ___ cout << a / b;

3. ___ cout << 62 % 28 + a / c;

4. ___ cout << 5 % 3 + 7;

5. ___ cout << 2.0 * a / b;

6. ___ cout << a * 2 / b;

A.2.5

B.6.2

C.30

D.9

E.11

F.2

G.1

H.1

I.1.25

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

OCA Oracle Database SQL Exam Guide Exam 1Z0-071

Authors: Steve O'Hearn

1st Edition

1259585492, 978-1259585494

More Books

Students also viewed these Databases questions