Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Given the following: int x = 4/5; String y = \"Happy Birthday\" System.out.print

ID: 3839960 • Letter: G

Question

Given the following: int x = 4/5; String y = "Happy Birthday" System.out.println(y.charAt(x)); What will be printed to the console? A. Program will cause a runtime error B. The program will run but will print nothing C. The letter P D. The letter H E. Confetti will launch on the screen while the birthday song plays What is updog after the following statement is executed? x = Math.pow(2, 4); updog = (x > 0)? 9:- 16; A. 0 B. 8 C. 9 D. 16 E. Not much, what's up with you? What will be printed by the following line of code: Int x = 5, y = 0; boolean batman = (false && (x/y) > 0); if (batman) System.out.println("False"); else System.out.println("True"); A. True B. The program will have a compiler error C. The program will have a runtime error D. False E. How awesome Batman is.

Explanation / Answer

4)ans) D (The Letter H)

Reason:

x=4/5 then the result stored in the variable is 0 (as 4/5 =0)

y.charAt(0) so the first character of the string "Happy Birthday" is 'H'

________________

5)Ans) c(9)

here Math.pow(2,4)= 16 (2 raised to the power 4)

as it is greater than 16, the value 9 is stored in the variable updog

________________

6)Ans) A (true)

________________Thank You

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote