Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 1 int n1 = 12; int n2 = 18; int n3 = 21; What is the result of each boolean expression? n1 < n2

Question 1

int n1 = 12;

int n2 = 18;

int n3 = 21;

What is the result of each boolean expression?

n1 < n2 ["True", "False"]

n3 == n2 ["True", "False"]

n3 == (n1 + 9) ["True", "False"]

(n2 > n1) && (n2 < n3) ["True", "False"]

n3 >= (n1 + n2) ["True", "False"]

! (n1 == n2) ["True", "False"]

Question 2

The following code will result in a divide by 0 error.

intValue = 0;

if (intValue != 0 && (10 / intValue) > 2)

// do something

True

False

Question 3

What is the output of the following code if intValue = 0?

if (intValue = 0)

cout << "true" << endl;

else

cout << "false" << endl;

true

false

Question 4

What is the output of the following code if score has a value of 85?

if (score < 60)

cout << "F" << endl;

else if (score < 70)

cout << "D" << endl;

else if (score < 80)

cout << "C" << endl;

else if (score < 90)

cout << "B" << endl;

else

cout << "A" << endl;

Group of answer choices

A

B

C

D

Question 5

What is the exact output of the following code if score has a value of 70?

if (score < 60)

cout << "F";

if (score < 70)

cout << "D";

if (score < 80)

cout << "C";

if (score < 90)

cout << "B";

if (score <= 100)

cout << "A";

Question 6

If A and B are boolean expressions, for (A && B) to evaluate to true, A and B must each separately evaluate to true.

True

False

Question 7

If A and B are boolean expressions, for (A || B) to evaluate to true, A and B must each separately evaluate to true.

Group of answer choices

True

False

Question 8

If A and B are boolean expressions, for ! (A && B) to evaluate to true, A and B must each separately evaluate to false.

True

False

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

More Books

Students also viewed these Databases questions