Assume that x and y are boolean variables and have been properly initialized.

Upgrade to remove ads

Show

    Only ₩37,125/year

    • Flashcards

    • Learn

    • Test

    • Match

    • Flashcards

    • Learn

    • Test

    • Match

    Terms in this set (10)

    What are if statements used for in programs?

    Making decisions

    Which if statement below tests if letter holds J? ( letter is a char)

    if (letter == 'J')

    What does the following code do?
    if (month == 4)
    if (day <= 21)
    System.out.println("Aries");

    Tests if month is 4 and day is less than or equal to 21.

    What is output to the screen by the following code?
    int x = 29 % 10;
    if (x > 10)
    System.out.println(1);
    else if (x > 8)
    System.out.println(2);
    else if (x > 6)
    System.out.println(3);
    else if ( x > 4)
    System.out.println(4);
    else
    System.out.println(5);

    2

    Consider the following code:
    int x = 8;
    int y = 17;
    if (x != y)
    System.out.print ("one");
    else if (x > y)
    System.out.print ("two");
    else if (y < x)
    System.out.print ("three");
    else if (y >= x)
    System.out.print("four");
    else
    System.out.print("five");
    What is the output?

    one

    A && (A || B)

    The following truth table matches which boolean condition?

    Given the variables, which boolean condition is true?
    int a = 5;
    int b = 5;

    b >= a || a >= b

    To test if a grade is a C (between 70 and 79 inclusive) you would use the following if statement:
    if ( g ______ 70 ______ g ______ 79)
    What three sets of symbols correctly fill in the blanks?

    >=, &&, <=

    Consider the following expression. Assume that x and y are properly initialized boolean variables.
    (x && y) || !(x || y)
    The result of evaluating the expression above is best described as:

    true only when x and y have the same value

    Consider the following code:
    if ( !(val >= 80 && val < 90) )
    Which of the following produces the same output?

    if (val < 80 || val >= 90)

    Students also viewed

    Exam 2

    20 terms

    moskos2003

    Edhesive Unit 4

    54 terms

    Hallie_Johnson13

    APCSA S1 EXAM

    98 terms

    hannahk___

    Unit 3

    67 terms

    Hallie_Johnson13

    Sets found in the same folder

    Term 1: Lesson 20 - Flag Variables

    13 terms

    rosabellle

    Term 1: Lesson 4 - Data Types

    44 terms

    rosabellle

    Term 1: Lesson 16 - De Morgan's Law

    12 terms

    rosabellle

    Foundations of Government Part 2

    23 terms

    KJones-WoodlawnTeacher

    Other sets by this creator

    verbes

    114 terms

    rosabellle

    Term 1: Lesson 23 - One-Dimensional Arrays

    6 terms

    rosabellle

    Term 1: Lesson 22 - String Functions

    24 terms

    rosabellle

    Term 1: Lesson 21 - Strings and Class Ty…

    30 terms

    rosabellle

    Verified questions

    algebra

    Write down the first five terms of each sequence. $\left\{d_{n}\right\}=\left\{(-1)^{n-1}\left(\frac{n}{2 n-1}\right)\right\}$

    Verified answer

    algebra

    Find each sum, difference, or product. Give your answer in the simplest radical form. $\\$$(3+$$\sqrt{3})+(3+$$\sqrt{3})$

    Verified answer

    algebra

    Solve each inequality. Give the solution set in interval notation. $|3 x-4| \geq 2$

    Verified answer

    algebra

    Rewrite each expression without parentheses and using only positive exponents. a. $\left(3 x^{2} y\right)(5 x)$ b. $\left(x^{2} y^{3}\right)\left(x^{-2} y^{-2}\right)$ c. $\frac{x^{3}}{x^{-2}}$ d. $\left(2 x^{-1}\right)^{3}$

    Verified answer

    Recommended textbook solutions

    Assume that x and y are boolean variables and have been properly initialized.

    Numerical Analysis

    9th EditionJ. Douglas Faires, Richard L. Burden

    873 solutions

    Assume that x and y are boolean variables and have been properly initialized.

    Elementary Number Theory

    7th EditionDavid Burton

    776 solutions

    Assume that x and y are boolean variables and have been properly initialized.

    Elementary Differential Geometry

    2nd EditionBarrett O'Neill

    297 solutions

    Assume that x and y are boolean variables and have been properly initialized.

    Book of Proof

    2nd EditionRichard Hammack

    340 solutions

    Other Quizlet sets

    Non-Risk Factor Violations #18-58

    16 terms

    cunninghamj6

    Targeted Med Surg Perioperative

    30 terms

    Melissa_McKinney6

    The Study of Minerals - Lab 1

    38 terms

    tjadeg

    Respiratory System

    12 terms

    Shilena_Smith