Java
Autor: Guria • November 4, 2016 • Exam • 4,979 Words (20 Pages) • 602 Views
Page 1 of 20
CmSc 150: Mid Term Exam - SOLUTIONS
The first five problems check your very basic knowledge of Java. If you make more than 5 errors, your grade cannot be more than C+, no matter how you have solved the remaining problems. Be very careful!
- Are the following numbers integers in C++ (check the appropriate box):
Yes | No | Yes | No | |||
578.0 | X | 3495 | X | |||
0.0 | X | 67. | X | |||
6,789 | X | -16 | X | |||
-86 | X | 58 | X | |||
0,89 | X | -456. | X | |||
33% | X | +999 | X |
- Which of the following are acceptable variable names in Java:
Yes | No | Yes | No | |||
true | X | value3 | X | |||
num | X | To-day | X | |||
Figure.02 | X | TaxRate | X | |||
Figure_2 | X | Total Sum | X | |||
table_2 | X | Welcome! | X | |||
SUM | X | street | X | |||
fig_2_3 | X | intNumber | X | |||
integer | X | _sum_ | X |
- Which of the following are valid assignment statements (check for statement syntax and for variable names syntax):
Yes | No | Yes | No | |||
num = sum + 5; | X | X + y = z; | X | |||
value = 8*sum.; | X | 5 = x - y; | X | |||
yX = 68 | X | if = x + 9; | X | |||
ff = 8 + name; | X | 9x = 6x + 3x; | X |
...