Font size
WorksheetsLatihan UPS2
Total questions: 15
Worksheet time: 13mins
This is an example of not valid variable declaration.
string name,
Rewrite a valid java variable declaration.
(a)
All the primitive data types are
String
int
double
char
Data type to represents integer
(a)
An array consists of
Data type
Size
Index location
Value
Name
Which of the following statement is TRUE. Declare a name array and makes it refer to an array of three elements
String [ ] name = {" Adam", " Kevin" , "Aminah" };
String [ ] name = {Adam, Kevin , Aminah };
String [3 ] name = {" Adam", " Kevin" , "Aminah" };
string [ ] name = {" Adam", " Kevin" , "Aminah" };
Declare an array variable
int [ ] counts;
int [5 ] counts;
int [ ] counts [ ] ;
Create array
counts = new int [5];
counts [ ] = new int [5];
marks = new int [50];
marks = new int [-85];
Declare a variable and create array
int [ ] counts = new int [5];
int [ ] counts = new Int [5];
int [ ] counts = New int [5];
int [ ] counts = new int [ ];
Which of the following statement is TRUE about identifier?
The name of identifier can begin with a digit
An identifier must starts with a character (A-Z, a-z), an underscore ( _ ) or a dollar sign ( $ )
Reserved word / Keyword listed in Java cannot be used as identifier.
Give the value of the following expression:
50/100 =
(a)
Assigned values a= 10, b=3.
Determine the value of arithmetic expression:
a % b =
(a)
Assigned values a= 10, b=3.
Determine the value of arithmetic expression:
a / b =
(a)
Assigned values a= 10, b=3.
Determine the value of arithmetic expression:
a + b / a =
(a)
Assigned values a= 10, b=3.
Determine the value of arithmetic expression:
a % b - a =
(a)
Convert the algebraic expression into Java expressions:
(a)
