 # Answer 12 assume that x and y are int variables with

• 8

Course Hero uses AI to attempt to automatically extract content from documents to surface to you and others so you can study better, e.g., in search results, to enrich docs, and more. This preview shows page 4 - 6 out of 8 pages.

Answer: __________12)Assume that x and y are int variables with x = 5, y = 3, and a and d are char variables with a = 'a' and d= 'A', and examine the following conditions:Condition 1:(x < y && x > 0)Condition 2:(a != d || x != 5)Condition 3:!(true && false)Condition 4:(x > y || a == 'A' || d != 'A')a)All 4 Conditions are trueb)Only Condition 2 is truec)Condition 2 and Condition 4 are true onlyd)Conditions 2, 3 and 4 are all true, Condition 1 is note)All 4 Conditions are false
Answer: __________13)The statement if (x < 0) y = x; else y = 0;can be rewritten using a conditional operator as
Name: ___________________________Answer_____________________________14)What is balance after the following code is executed?int balance = 10;while (balance > 0) {if (balance < 9)balance = balance - 8;else balance = balance1;}Answer______________
15)Given that s is a String, what does the following loop do?for (int j = s.length( ); j > 0; j--)System.out.print(s.charAt(j-1));

Course Hero member to access this document

Course Hero member to access this document

End of preview. Want to read all 8 pages?

Course Hero member to access this document

Term
Winter
Professor
NoProfessor
Tags
Letter case, Lower case, Chicago Loop
• • • 