Font size
WorksheetsJava
Total questions: 25
Worksheet time: 14mins
Which of the following is the best description of a "relational operator"?
Comparison symbols used in logical expressions
Mathematical symbols used to calculate numeric results
Links that control the relationships between objects
None of these are true
Which of the following is the best description of a "relational operator"?
Comparison symbols used in logical expressions
Mathematical symbols used to calculate numeric results
Links that control the relationships between objects
None of these are true
Given two numbers A and B, which of the following expressions will be true when "A is less than B"?
A < B
A > B
A == B
A != B
Given two numbers A and B, which of the following expressions will be true when "A is equal to B"?
A != B
A == B
A = B
A.eq(B)
How many times will the following code print "Welcome to Java"?
int count = 0;
while (count <= 10) {
System.out.println("Welcome to Java");
count++;
}
What will this code display?
int i = 0;
do { System.out.print (i + ", ");
} while (i < 5);
0, 0, 0, 0, 0, 0, 0, 0, (repeat forever)
0, 1, 2, 3, 4,
1, 2, 3, 4, 5,
Compile error
10,
True/False Do-while loops can be nested inside of other loops.
True
False
Which of the following is a type of polymorphism in Java?
Compile time polymorphism
Execution time polymorphism
Multiple polymorphism
Multilevel polymorphism
Which of these keywords is used to make a class?
class
struct
int
none of the mentioned
x /= 3
Which of the below statements matches with above statement?
x = 3 / x
x = x / 3
x / 3
x /x = 3
Which of the following is assignment operator?
==
=
=+
++
Which of the following is the right way of defining char variable?
char myGrade = 'B';
char myGrade = "B";
char myGrade 'B';
char myGrade = "B"
which of the following is NOT a primitive data type?
byte
array
char
boolean
Which of the following is NOT a NON-primitive data type
String
Array
double
class
System.out.print();
Which of the following is incorrect?
int count = 5o.0;
int salary = 50_000;
int salary = 50_00;
all of these are incorrect
__________ is needed to access a method in a class.
class name
class variable
function
object
main method is a
non static method
static method
Which of the following class is used to read input during execution?
Array
String
Scanner
Main
Syntax for main method
void main()
void main(String[] args)
public static void main(String[] args)
public main(String[] args)
Java runs on
Unix/Linux
Macintosh
Windows
All of the above
int z=1.5;
What will be the value of z?
z=1.5
run time error
compilation error
z=1.15
