Quiz 7B

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

Assume that a is a boolean variable and b is an int Fill in the blanks for the code corresponding to "if a is true, increment b by 1; if a is false, increment b by 2: if (a) b++; else b=_____.

b+2

What is the output of this code sequence? if (27%3 == 0) System.out.prinln ("27 is divisible by 3"); else System.out.println("27 is not divisible by 3"); System.out.println("done"); -done -27 is not divisible by 3 -27 is divisible by 3 -27 is divisible by 3 followed by done on the next line

27 is divisible by 3 followed by done on the next line

Assume that a is a boolean with the value of true and b is an int with the value of 2 What is the output? if (a) b=b+5; else b=b+2; b=b+4; System.out.println("b is "+b); -b is 6 -b is 8 -b is 7 -b is 11

b is 11

What is the output of this code sequence? if ((true || false) && (false || true)) System.out.println("Inside the true block); System.out.println("end of sequence"); -inside the true block followed by end of sequence on the next line -inside true block only -end of sequence only

inside true block followed by end of sequence on the next line

What is the output of this code sequence? boolean a=true System.out.println(a); -This actually will not run. There is a syntax error. -a -true -false

true

Assume that a is a boolean variable and b is an int Fill in the blanks for the code corresponding to "if a is true increment b by 1" If (______) ______++;

a b


Set pelajaran terkait

14 differential reinforcement live action

View Set

Module 05: Life and European Expansion in the 18th Century

View Set

Chapter 5 - Short Term & Working Memory

View Set

Economics 370 - Economics of Labor University at Albany - Midterm 1 review

View Set

(C5W4): Create High-Fidelity Designs and Prototypes in Figma - Weekly challenge 4: Participate in design critique sessions

View Set