Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Question 1:
- How many statements (as defined in class) are there in the code below?
- Warning: is a tricky one. The code is valid
- { println("Step 2");
- { println("Step 2a");
- { println("Step 2a.1");
- { }
- }
- }
- }
- A. 1
- B. 3
- C. 4
- D. 7
- E. None of the above
- ---------------------
- Question 2:
- What value do you expect x to have after
- executing the code below?
- float x = (16.0+8.0/2)*(1/2);
- A. 0.0
- B. 6.0
- C. 10.0
- D. 12.0
- E. 20.0
- ---------------------
- Question 3:
- What value do you expect x to have after
- executing the code below?
- int x = (1/2)*(3+2+5f);
- A. 0
- B. 5
- C. 10
- D. Nothing - there is an error
- ---------------------
- Question 4:
- What type is the result of the expression below?
- 123456789L + 1.0
- A. int
- B. long
- C. float
- D. double
- ---------------------
- Question 5:
- What value do you expect y to have after
- executing the code below?
- float x = 0.2/0.3;
- float y = x*45.0;
- A. 30 exactly
- B. 30.0 exactly
- C. 30.0 approximately
- D. Nothing - there is an error
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement