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)
2. Java is one of language that support object oriented programming. ( T / F)
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)
4. System.out.println is one of the pre-defined methods in Java. ( T / F)
5. An identifier is a sequence of characters that consist of letters, digits, underscores (_), and dollar signs ($).( T / F)
2. Java is one of language that support object oriented programming. ( T / F)
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)
4. System.out.println is one of the pre-defined methods in Java. ( T / F)
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 it descriptions.
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. (Computing
the volume of a cylinder) Write an algorithm and a Java program that reads
in the radius and length of a cylinder and computes its volume using the
following formulas: [20 marks]
Area
|
= radius *
radius * p
|
volume
|
= area * length
|
G. (Finding the largest) Write an algorithm and a java program that
input ten integers and find the largest. [20 marks]
No comments:
Post a Comment