A. Response to the following statements by
circling either T (TRUE) or F (FALSE). [10M]
I.
1. Java enables users to develop and
deploy applications on the Internet for servers, desktop computers, and small
hand-held devices.( T / F)
II.
2. Java is one of language that support
object oriented programming. ( T / F)
IV.
3. Reserved words or keywords are
words that have a specific meaning to the compiler and cannot be used for other
purposes in the program. ( T / F)
I.
5. An identifier is a sequence of
characters that consist of letters, digits, underscores (_), and dollar signs
($).( T / F)
B. Match the following Statement / Name to its description.
No
|
Statements
|
|
Description
|
I.
|
x = 1;
|
|
Constants
|
II.
|
int x = 1;
|
|
Addition
|
III.
|
double radius;
|
|
Declaring and Initializing
|
IV.
|
final int SIZE = 3;
|
|
Multiplication
|
V.
|
+
|
|
Assignment Statements
|
VI.
|
*
|
|
Remainder
|
VII.
|
%
|
|
Declaring Variables
|
C. Answer the following questions
I.
What is debugging? [2 marks]
II.
What is the difference between a constant and
a variable? [2 marks]
D. Which of the following are invalid identifiers,
why? [7 marks]
I.
one
II.
hello_there
III.
hello,there
IV.
my Window
V.
JAVA
VI.
1234
VII.
acct122
E. Evaluate the following expressions:
[4 marks]
I.
10 + 2 / 2
II.
3 * 3 + 3 % 2
III.
3 + 2 / 5 + -2 * 4
IV.
2 * (1 + -(3/4) / 2) * (2 - 6 % 3)
F. Write a java fragment for the
following problems.
0.
Write a for statement to print integer 1 to
20. [example]
int I;
For (i=1; i<=10; i++)
System.out.Println(i);
I.
Write a for statement to print integer 50 to
60. (3 marks)
II.
Write a for statement to print the following
output. (3 marks)
2
4 6 8 10
No comments:
Post a Comment