My Grade Book
Grades for Aliyan Alli
Grades for Be Prepared (Java)–Practice Exam 4-I
This 90-minute timed test started 5/1/2017 10:30pm and finished 5/1/2017 10:30pm.
40 of 40 problems have been submitted, total points 0/40.
Question 1 Question 11 Question 21 Question 31
Question 2 Question 12 Question 22 Question 32
Question 3 Question 13 Question 23 Question 33
Question 4 Question 14 Question 24 Question 34
Question 4 Question 15 Question 25 Question 35
Question 6 Question 16 Question 26 Question 36
Question 7 Question 17 Question 27 Question 37
Question 8 Question 18 Question 28 Question 38
Question 9 Question 19 Question 29 Question 39
Question 10 Question 20 Question 30 Question 40
Student's Answers
Question 1
Assuming that x and y are int variables, the expression
!(x > y && y <= 0)
is equivalent to which of the following?
https://www.eimacs.com/eimacs/submissions?cid=47597&sid=E2266613020&wuid=E1925940&showanswers=1#submissionsanswers Page 1 of 41
,Gradebook: Student answers 5/1/17, 10:31 PM
A. !(x <= y) || (y > 0)
B. x > y && y <= 0
C. x <= y || y > 0
D. x > y || y < 0
E. x <= y && y <= 0
Question 1
A B C D E
Score:
Submitted: 5/1/2017 10:30pm
The following model answer has been provided to you by the grader. Carefully compare your
answer with the one provided here.
Use De Morgan's Laws.
The answer is C.
View the page
Question 2
Which of the following describes the return value of the following method?
/** Precondition: amt represents a positive value in dollars
* and cents (for example, 1.15 represents
* one dollar and fifteen cents)
*/
private int process(double amt)
{
return (int)(amt * 100 + 0.5) % 100;
}
A. the cent portion in amt
B. the number of whole dollars in amt
C. amt converted into cents
D. amt rounded to the nearest integer
E. the smallest number of whole dollars that is greater than or equal to amt
https://www.eimacs.com/eimacs/submissions?cid=47597&sid=E2266613020&wuid=E1925940&showanswers=1#submissionsanswers Page 2 of 41
,Gradebook: Student answers 5/1/17, 10:31 PM
Question 2
A B C D E
Score:
Submitted: 5/1/2017 10:30pm
The following model answer has been provided to you by the grader. Carefully compare your
answer with the one provided here.
% 100 leaves the last 2 digits.
The answer is A.
View the page
Question 3
What is the output of the following code segment?
int sum = 0, d = -1;
for (int count = 10; count > 0; count--)
{
sum += d;
if (d > 0)
{
d++;
}
else
{
d--;
}
d = -d;
}
System.out.println(sum);
A. 0
B. 5
C. -5
D. 10
E. -10
https://www.eimacs.com/eimacs/submissions?cid=47597&sid=E2266613020&wuid=E1925940&showanswers=1#submissionsanswers Page 3 of 41
, Gradebook: Student answers 5/1/17, 10:31 PM
Question 3
A B C D E
Score:
Submitted: 5/1/2017 10:30pm
The following model answer has been provided to you by the grader. Carefully compare your
answer with the one provided here.
0 - 1 + 2 - 3 + 4 - ... + 10
= 0 + (-1 + 2) + ( -3 + 4) + ... + ( -9 + 10)
= 5.
The answer is B.
View the page
Question 4
Recall that in Java, the prefix 0x followed by one or more hexadecimal digits 0 - F defines an integer constant in the
hexadecimal number system. For example,
int n = 0xF;
System.out.println(n);
displays 15. What is the output from the following statement?
System.out.println(0x10 + 10);
A. 4
B. 12
C. 26
D. 32
E. 0x1010
Question 4
A B C D E
Score:
Submitted: 5/1/2017 10:30pm
https://www.eimacs.com/eimacs/submissions?cid=47597&sid=E2266613020&wuid=E1925940&showanswers=1#submissionsanswers Page 4 of 41