wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

java base 1

Total questions: 16

Worksheet time: 11mins

Name
Class
Date
1.

Which component is used to compile, debug and execute the java programs?

a)

JRE

b)

JIT

c)

JDK

d)

JVM

2.

Which of these cannot be used for a variable name in Java?

a)

identifier & keyword

b)

identifier

c)

keyword

d)

none of the mentioned

3.

Which of the following is not an OOPS concept in Java?

a)

Polymorphism

b)

Compilation

c)

Inheritance

d)

Encapsulation

4.

Which of these are selection statements in Java?

a)

break

b)

continue

c)

for()

d)

if()

5.

What is the value stored in x in following lines of code?

int x, y, z;

 x = 0;

 y = 1;

 x = y = z = 8;

a)

1

b)

9

c)

8

d)

0

6.

Which of the following for loop declaration is not valid?

a)

for ( int i = 99; i >= 0; i / 9 )

b)

for ( int i = 7; i <= 77; i += 7 )

c)

for ( int i = 20; i >= 2; - -i )

d)

for ( int i = 2; i <= 20; i = 2* i )

7.

What does JVM stands for?

a)

Java Variable Machine

b)

Java Virtual Machine

c)

Java Virtual Mechanism

d)

None of the above

8.

What is JVM ?

a)

JVM is the confined memory area

b)

All java programs run inside JVM memory

c)

JVM provides security to the computer by giving controlled access to Files and Memory on a computer

d)

All the above

9.

Which of the following is incorrect?

a)

int count = 50.0;

b)

int salary = 50_000;

c)

int salary = 50_00;

d)

all of these are incorrect

10.

Where does a java program start executing instructions from:

a)

class

b)

source file

c)

main method

d)

object

11.
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();
12.

What will be the output of the program?

a)

ok

b)

ok dokey

c)

dokey

d)

No output is produced

13.

What will be the output of the program?

a)

0

b)

7

c)

8

d)

14

14.

What will be the output of the program?

a)

small

b)

huge

c)

tiny

d)

Compilation fails

15.

What is the numerical range of a char?

a)

-128 to 127

b)

-(215) to (215) - 1

c)

0 to 32767

d)

0 to 65535

16.

What will be the output of the program?

a)

9 7 7 foo 7 7foo

b)

72 34 34 foo34 34foo

c)

9 7 7 foo34 34foo

d)

72 7 34 foo34 7foo