Chapter 4 MC2 Review - Computer Programming

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

What will be the value of ans after the following statements are executed? int x = 40; int y = 40; if (x = y) ans = x + 10;

The code contains an error and will not compile. C

When a character is stored in memory, it is actually the ________ that is stored.

Unicode number C

Enclosing a group of statements inside a set of braces creates

a block of statements. C

Which of the following expressions will determine whether x is less than or equal to y?

x <= y C

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

120 C

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); }

40 C

Java requires that the boolean expression being tested by an if statement be enclosed in

A set of parenthesis C

The ________ statement is used to create a decision structure which allows a program to have more than one path of execution.

If C

Which of the following statements will create an object from the Random class?

Random myNumber = new Random(); C

A ________ is a boolean variable that signals when some condition exists in the program.

flag C

Which of the following expressions will generate a random number in the range of 1 through 10?

myNumber = randomNumbers.nextInt(10) + 1; C

What will be the value of discountRate after the following statements are executed? double discountRate; char custType = 'B'; switch (custType) { case 'A': discountRate = 0.08; break; case 'B': discountRate = 0.06; case 'C': discountRate = 0.04; default: discountRate = 0.0; }

0.0 C

What will be displayed after the following statements are executed? int hours = 30; double pay, payRate = 10.00; pay = hours <= 40 ? hours*payRate : hours*payRate*2.0; System.out.println(pay);

300.0 C

Which of the following expressions determines whether the char variable, chrA, is not equal to the letter 'A'?

chrA != 'A' C

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

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


संबंधित स्टडी सेट्स

1. First Americans To A New Nation

View Set

Medical Microbiology pathogenic Bacteria

View Set

Chapter 16 InQuizitive: Economic Policy

View Set

Neurovascular (Ch 42, 43, 45) Iggy

View Set

Texas Promulgated Contract Forms

View Set

Planning, Goal Setting, Strategy Formulation, Execution, Organizational Structure, Innovation and Change, Communication, Leading Teams, Quality and Performance

View Set

Plasma Membrane and Plant Cell Wall

View Set

Chapter 19:Neural mechanisms - Chemoreceptor reflexes

View Set