Uploaded by wxsp52

Variable Worksheet 1

advertisement

Computer Science – Variables Worksheet 1

DIRECTIONS : Fill in each blank with the correct answer/output. Assume each statement happens in order and that one statement may affect the next statement. int x = 128; out.println(x); //line1 1. 128 x = -98; byte b = 24; char c = 97; out.println(x); out.println(c); double d = 9.9; d = 5.2; out.println(d); out.println(d); float f = 9.87f; out.println(f); short s = 350; out.println(s); //line2 out.println(b); //line3 //line4 //line5 //line6 //line7 //line8 int z = 'A'+5; out.println(z); //line9 c = 'A'+5; out.println(c); //line10 double w = 'a'+5; out.println(w); //line11 long u = 'A'-48; out.println(u); w = f+5; out.println(w); //line12 //line13 b = (byte)x; w = 'A' * 2.0; f = w; u = 982743L; d = 3.2e2; s = c; z = w; out.println(b); out.println(w); out.println(f); out.println(u); out.println(d); out.println(s); out.println(z); //line14 //line15 //line18 //line16 //line17 //line19 //line20 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 2. -98 3. 24 4. 97 5. 9.9 6. 5.2 7. 8. 9. 10. 9.87 350 70 F 102.0 17 14.86999885559082 -98 130.0 Syntax_Error 982743 320.0 Syntax_Error Syntax_Error

Download