Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

2 What is the output of the following code? int main() { bool isPos = false; int x = 12; isPos = (x > 0);

2

What is the output of the following code?

int main() {

bool isPos = false;

int x = 12;

isPos = (x > 0);

if (isPos) {

cout << x is positive;

}

else {

cout << x is negative;

}

return 0;

}

Select one:

a. x is positive

b. x is negative

c. x is positivex is negative

d. No output.

4

What is the output of the following code?

int main() {

int x = 20; int y = 0;

if( x > 20 ) {

y = 30;

}

else {

y = 10;

}

cout << y;

return 0;

}

Select one:

a. 20

b. 10

c. 0

d. 30

8

Define a new enumeration type named StopLight with three named values Green, Yellow, Red, in that order.

Select one:

a. enum StopLight {Green, Yellow, Red};

b. enum StopLight (Green, Yellow, Red);

c. enum {Green, Yellow, Red} StopLight ;

d. enum (StopLight) {Green, Yellow, Red};

9

How many times will the output statement execute in the following code?

int main() {

int i = 0; int j = 0;

for(i = 1; i <= 3; ++i) {

for(j = 1; j <= 5; ++j) {

cout << i << j << " ";

}

}

return 0;

}

Select one:

a. 3

b. 8

c. 15

d. 24

13

Which expression determines whether x is 120 or less?

Select one:

a. x > 120

b. x < 120

c. x >= 120

d. x <= 120

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

Step: 3

blur-text-image

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

Database Processing

Authors: David M. Kroenke

12th Edition International Edition

1292023422, 978-1292023427

More Books

Students also viewed these Databases questions