wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Operators

Total questions: 20

Worksheet time: 10mins

Name
Class
Date
1.

Which of the following is incorrect?

a)

int count = 5o.0;

b)

int salary = 50_000;

c)

int salary = 50_00;

d)

all of these are incorrect

2.
When we want to print in Java, we use the code ......
a)
system.out.print();
b)
System.out.println();
c)
System.Out.Printf();
d)
System.out.show();
3.
A variable that holds a whole number
a)
String
b)
boolean
c)
int
d)
float
4.
What is at the end of a line of code?
a)
#
b)
;
c)
)
d)
>
5.
What does a comment look like in Java?
a)
//comment
b)
\\comment
c)
==comment
d)
\comment
6.

int x = 5;

int y = 6

int z = 50;

System.out.println(x + y + z);


What will be the output?

a)

61

b)

5650

c)

66

d)

x + y + z

7.

Which of the following is NOT a NON-primitive data type

a)

String

b)

Array

c)

double

d)

class

8.

which of the following is NOT a primitive data type?

a)

byte

b)

array

c)

char

d)

boolean

9.

Which of the following is the right way of defining char variable?

a)

char myGrade = 'B';

b)

char myGrade = "B";

c)

char myGrade 'B';

d)

char myGrade = "B"

10.

Which of the following is assignment operator?

a)

==

b)

=

c)

=+

d)

++

11.

x /= 3


Which of the below statements matches with above statement?

a)

x = 3 / x

b)

x = x / 3

c)

x / 3

d)

x /x = 3

12.

int x = 4;

System.out.println(x < 5 && x < 10);


What will be the output?

a)

false

b)

true

c)

4

d)

x < 5 && x < 10

13.

int x = 4.4;

int y = 5.5;

System.out.println(x == y);


What will be the output?

a)

4.4

b)

true

c)

false

d)

5.5

14.

What is the output of below code?


int x = 5;

System.out.println(x++);

System.out.println(x);

a)

5

5

b)

6

6

c)

5

6

d)

6

5

15.

Command to compile Java program

a)

javax

b)

javay

c)

javac

d)

Java

16.

Command to run a Java program

a)

javaa

b)

java

c)

jaava

d)

jaavaa

17.

JDK stands for

a)

Java Developer Kit

b)

Java Development Kit

c)

Java Design Kit

d)

Java Debugging Kit

18.

JRE stands for

a)

Java Run Environment

b)

Java Run Execution

c)

Java Runtime Environment

d)

Java Ready Execution

19.

Java is

a)

Machine dependent language

b)

Machine independent language

20.

java compiler converts the java file into _________ file.

a)

.jvm

b)

.class

c)

.obj

d)

.java