wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Latihan UPS2

Total questions: 15

Worksheet time: 13mins

Name
Class
Date
1.

This is an example of not valid variable declaration.

string name,

Rewrite a valid java variable declaration.

(a)  

2.

All the primitive data types are

a)

String

b)

int

c)

double

d)

char

3.

Data type to represents integer

(a)  

4.

An array consists of

a)

Data type

b)

Size

c)

Index location

d)

Value

e)

Name

5.

Which of the following statement is TRUE. Declare a name array and makes it refer to an array of three elements

a)

String [ ] name = {" Adam", " Kevin" , "Aminah" };

b)

String [ ] name = {Adam, Kevin , Aminah };

c)

String [3 ] name = {" Adam", " Kevin" , "Aminah" };

d)

string [ ] name = {" Adam", " Kevin" , "Aminah" };

6.

Declare an array variable

a)

int [ ] counts;

b)

int [5 ] counts;

c)

int [ ] counts [ ] ;

7.

Create array

a)

counts = new int [5];

b)

counts [ ] = new int [5];

c)

marks = new int [50];

d)

marks = new int [-85];

8.

Declare a variable and create array

a)

int [ ] counts = new int [5];

b)

int [ ] counts = new Int [5];

c)

int [ ] counts = New int [5];

d)

int [ ] counts = new int [ ];

9.

Which of the following statement is TRUE about identifier?

a)

The name of identifier can begin with a digit

b)

An identifier must starts with a character (A-Z, a-z), an underscore ( _ ) or a dollar sign ( $ )

c)

Reserved word / Keyword listed in Java cannot be used as identifier.

10.

Give the value of the following expression:


50/100 =

(a)  

11.

Assigned values a= 10, b=3.

Determine the value of arithmetic expression:


a % b =

(a)  

12.

Assigned values a= 10, b=3.

Determine the value of arithmetic expression:


a / b =

(a)  

13.

Assigned values a= 10, b=3.

Determine the value of arithmetic expression:


a + b / a =

(a)  

14.

Assigned values a= 10, b=3.

Determine the value of arithmetic expression:


a % b - a =

(a)  

15.

Convert the algebraic expression into Java expressions:


 g= (y1 + y2)g=\ \sqrt{\left(y1\ +\ y2\right)}  



(a)