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

4-Which statements placed at //INSERT HERE will cause the following code to comp

ID: 3596355 • Letter: 4

Question

4-Which statements placed at //INSERT HERE will cause the following code to complie and print the number 1.5 /I INSERT HERE System.out.printin(x/y) A) ntx- 3 int y B) yte x-300 double y -200.0 ci double x-3.0 int y 2 D) int x-3/21 double y -1.0 S)- Which of the following is a valid Java declaration statement? short x-3, float fi byte b float g “ 10.0 integer y cj 61- Which of the following correctly computes the sine of 30 degrees? A)) Math.sin(Math.toRadians (30.0)) Math.sin (Math.toDegrees (30.0)) C) Math.sin(30.0) D) sin (30.0 7)-What is the result of the following? final int x-3 inty 4 // iine 1 line 2 1ine 3 System.out.println("xy: I iine

Explanation / Answer

Question 4:

Option C is correct, beacuse in oreder to print decimal we need double primitive type

Question 5:

Both Option A and B is correct, beacuse float should be containing 'f' at end of initialization and integer is not a type where int is.

Question 6:

Option B is correct, for sin method we should pass the angle in radian value

Question 7:

Option B is correct as a final variable cannot be assigned a value

Question 8:

Option A is correct

Question 9:

Option D is correct because we should pass input stream System.in to scanner

Question 10:

Option A is correct

Question 11:

Option D is correct because the scope of i is bound to for loop only

Question 12:

Option D is correct because only one statement will be considered under scope of if logic if no {} braces are used

Question 13:

Print as x = 3 y = 4 z =4 because x3 got pre-incremented where y3 got post incremented

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