RR Java Chapter 3

¡Supera tus tareas y exámenes ahora con Quizwiz!

braces, { }

A block of code is enclosed in a set of ________.

str1.equals(str2)

If str1 and str2 are both String objects, which of the following expressions will correctly determine whether or not they are equal?

True or false?

The boolean expression in an if statement must evaluate to ________.

1000

What will be the value of bonus after the following statements are executed? int bonus, sales = 10000; if (sales < 5000) bonus = 200; else if (sales < 7500) bonus = 500; else if (sales < 10000) bonus = 750; else if (sales < 20000) bonus = 1000; else bonus = 1250;

multiple alternative decision structure

The switch statement is a ________.

9 12

What does the following code display? int d = 9, e = 12; System.out.printf("%d %d\n", d, e);

40

What will be displayed after the following statements are executed? int y = 10; if (y == 10) { int x = 30;x += y; System.out.println(x); }

0.04

What will be the value of discountRate after the following statements are executed? double discountRate = 0.0; int purchase = 1250; char cust = 'N'; if (purchase > 1000) if (cust == 'Y')discountRate = 0.05; elsediscountRate = 0.04; else if (purchase > 750) if (cust == 'Y')discountRate = 0.04; elsediscountRate = 0.03; elsediscountRate = 0.0;

15

What will be the value of x after the following statements are executed? int x = 75; int y = 60; if (x > y) x = x - y;

ans = 60, x = 0, y = 50

What will be the values of ans, x, and y after the following statements are executed? int ans = 35, x = 50, y = 50; if (x >= y) { ans = x + 10; x -= y; } else { ans = y + 10; y += x; }

1000

What would be the value of bonus after the following statements are executed? int bonus, sales = 85000; char dept = 'S'; if (sales > 100000) if (dept == 'R')bonus = 2000; else bonus = 1500; else if (sales > 75000) if (dept == 'R') bonus = 1250; else bonus = 1000; else bonus = 0;

((x <= 500 || x > 650) || !(y == 1000))

Which of the following is the correct boolean expression to test for: int x being a value less than or equal to 500 or greater than 650, or int y not equal to 1000?

if (temp >= 0 && temp <= 100)

Which of the following statements determines whether the variable temp is within the range of 0 through 100 (inclusive)?

System.out.printf("$%,.2f", 12.7801);

Which of the following will format 12.7801 to display as $12.78?

Relational

________ operators are used to determine whether a specific relationship exists between two values.


Conjuntos de estudio relacionados

38. Dividends and share repurchase (Web + Sch. Note)

View Set

Unit Chemical Quantities, "The Mole - 1 step" -Wksh #1

View Set

Systematic Review/ Meta Analysis

View Set

Random Variables and Probability Models

View Set

Developmental Stages Infant to Adolescent

View Set

Instruction, Professional Issues, and Technology

View Set

AP Psych - Unit 11 - Social Psychology

View Set

Business Law Ch. 19 Formation and Terms of Sales Contracts

View Set