WorksheetsTopic 3 : Java Language
Total questions: 35
Worksheet time: 18mins
which one this keywords are used to create a class in java
class
struct
int
none of the avove
What would the new value of A be?
A=1;
a++;
1
2
3
4
Which statement(s) are equivalent to i = i + 1?
i += 1
i++
i -= 1
i--
What symbol represents the and operator in Java?
AND
and
&
&&
What symbol represents the or operator in Java?
OR
or
||
|
If a=2, b=5, c=3
Find result for : 8 * (a + b + c) – a % c
80
81
77
78
int a = 2, b = 2, c = 0;
double d = 30.1;
Find answer for = (a > b) &&(( c <d) || (c!=a))
35.9
80
true
false
What index value is used to locate the last element in the nums ArrayList?
nums.size()-1
nums.length()-1
nums.size()
nums.length
This expression executes at the end of each iteration of the for loop.
a. initialization expression
b. test expression
c. update expression
d. statement block
This expression is executed by the for loop only once, regardless of the number of iterations.
a. initialization expression
b. test expression
c. update expression
d. preincrement expression
List all arguments that exist in this program segment:-
double point, String student
point, student
name, mark
name[i], mark[i]
List all parameters that exist in this program segment:-
double point, String student
point, student
name, mark
name[i], mark[i]
Identify the error that exist in this program segment:-
An array data type cannot be use as argument.
The argument was not in the right sequence with the parameter.
The variable name in parameter not as same with the argument.
Program consist 0 error.
Identify the object that used to call a method.
Status
name[i], mark[i]
mtd
void
Fix the error by replacing with the correct java statement.
void Status(String student, double point)
void Status ( name[i], mark[i] )
int Status(String student, double point)
void Status ( String name[i], double mark[i] )
Create a method name Bonus that will read a basic payment and an hour variable as parameter to calculate an extra salary.
Identify the error that exist in this method program:-
Wrong use of return method type
variable extra was unknown.
doble is not one of the data type
A wrong use of hour data type.
Identify the error that exist in this method program:-
Wrong use of return method type
variable extra was unknown.
doble is not one of the data type
A wrong use of hour data type.
Identify types of error that exist in this method program:-
Logic error
runtime error
syntax error
Why method is important?
Break program into a small program and easy to debug.
Easier to read and understand aspecially when involving with a big program.
More practical when we need to reuse the code.
Can store more similar values in a single variable.
Java is a
Procedure Oriented Language
Structure Oriented Language
Object_Oriented Language
Machine Language
The name of the following should be the file name in Java
Object Name
Variable Nam
Class Name
Array Name
Java program does not run without below function
user()
system()
main()
void()
Java is
Machine dependent language
Machine independent language
Which of the following statements is invalid?
Tutor jimmy = new CSTutor();
CSTutor sally = new JavaTutor();
Tutor suzie = new JavaTutor();
Tutor johnny = new Tutor();
