wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

java

Total questions: 50

Worksheet time: 25mins

Name
Class
Date
1.

Which of the following option leads to the portability and security of Java?

a)

Bytecode is executed by JVM

b)

The applet makes the Java code secure and portable

c)

Use of exception handling

d)

Dynamic binding between objects

2.

Which of the following is not a Java features?

a)

Dynamic

b)

Architecture Neutral

c)

Use of pointers

d)

Object-oriented

3.

_____ is used to find and fix bugs in the Java programs.

a)

JVM

b)

JRE

c)

JDK

d)

JDB

4.

What does the expression float a = 35 / 0 return?

a)

0

b)

Not a number

c)

Infinity

d)

Run time exception

5.

Which of the following is a valid declaration of a char?

a)

char ch = '\utea';

b)

char ca = 'tea';

c)

char cr = \u0223;

d)

char cc = '\itea';

6.

Evaluate the following Java expression, if x=3, y=5, and z=10:

++z + y - y + z + x++

a)

24

b)

23

c)

20

d)

25

7.

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 )

8.

Which of the following is not OOPS concept in Java?

a)

Inheritance

b)

Encapsulation

c)

Polymorphism

d)

Compilation

9.

Which of the following is a type of polymorphism in Java?

a)

Compile time polymorphism

b)

Execution time polymorphism

c)

Multiple polymorphism

d)

Multilevel polymorphism

10.

When does method overloading is determined?

a)

At run time

b)

At compile time

c)

At coding time

d)

At execution time

11.

Which concept of Java is a way of converting real world objects in terms of class?

a)

Polymorphism

b)

Encapsulation

c)

Abstraction

d)

Inheritance

12.

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

a)

JVM

b)

JDK

c)

JIT

d)

JRE

13.

Which of the below is invalid identifier with the main method?

a)

public

b)

static

c)

final

d)

private

14.

What is use of interpreter?

a)

They convert bytecode to machine language code

b)

They read high level code and execute them

c)

They are intermediated between JIT and JVM

d)

It is a synonym for JIT

15.

What is the extension of compiled java classes?

a)

.java

b)

.class

c)

.txt

d)

.js

16.

Which of these keywords is used to make a class?

a)

class

b)

struct

c)

int

d)

none of the mentioned

17.

Which of these statement is incorrect?

a)

Every class must contain a main() method

b)

Applets do not require a main() method at all

c)

There can be only one main() method in a program

d)

main() method must be made public

18.

Which of the following statements is correct?

a)

Public method is accessible to all other classes in the hierarchy

b)

Public method is accessible only to subclasses of its parent class

c)

Public method can only be called by object of its class

d)

Public method can be accessed by calling object of the public class

19.

Which of this keyword must be used to inherit a class?

a)

super

b)

this

c)

extend

d)

extends

20.

What is the keyword "final" used for in Java?

a)

identify a constant

b)

identify an integer

c)

identify a string

d)

Identify a final answer

21.

Java was originally named:

a)

Coffee

b)

Oak

c)

New C++

d)

Duke

22.

Which of the following is NOT a numeric data type

a)

int

b)

double

c)

float

d)

decimal

23.

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

24.

The numeric type int uses how many bits?

a)

31

b)

32

c)

63

d)

64

25.

Which of the following is an example of a reference variable declaration?

a)

int count;

b)

String name;

c)

float gpa;

d)

char firstInitial;

26.

Where does a java program start executing instructions from:

a)

class

b)

source file

c)

main method

d)

object

27.
We are use Scanner Library in java for...
a)
Give permissions to the user
b)
Correcting software errors
c)
Allows user to read data
d)
Allows the user to enter data
28.
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();
29.
A variable that holds a whole number
a)
String
b)
boolean
c)
int
d)
float
30.
A variable that holds words
a)
String
b)
boolean
c)
int
d)
float
31.
A variable that holds a decimal number
a)
String
b)
boolean
c)
int
d)
float
32.
A variable that holds a character
a)
String
b)
boolean
c)
int
d)
char
33.
What is at the end of a line of code?
a)
#
b)
;
c)
)
d)
>
34.
These controls the behavior of a program.
a)
class
b)
object
c)
method
d)
void
35.
What does a comment look like in Java?
a)
//comment
b)
\\comment
c)
==comment
d)
\comment
36.

Java programs are ______

a)

Translated

b)

Compiled

c)

Interpreted

d)

Understood

37.

________ & _________ are two types of java programs

a)

Application

b)

Applets

c)

Operating System

d)

System Software

38.

(a)   is java's interpreter.

39.

(a)   java package supports scanner classes

40.

(a)   java package supports math functions

41.

Single Line Comments are initiated with (a)  

42.

Multiline comments are initiated with (a)  

43.

Documentation comments initiate with (a)  

44.

Who developed Java?

a)

James Gosling

b)

Bjarne Stroustrup

c)

Robert James

d)

None

45.

JVM is responsible for machine to be platform independent.

a)

TRUE

b)

FALSE

46.

What is Programming?

a)

A city in Kansas

b)

Communicating using the computer

c)

Using the computer to execute a program

d)

None Of The Above

47.

Tick the Languages which Are Used In Coding?

a)

English

b)

Python

c)

Java

d)

Pythoñ

48.

Which one of the following is correct ?

a)

system.out.print

b)

System.out.printl

c)

System.Out.Print

d)

System.out.print

49.

a= 22 , b= 12 , c= a+b . What is c

a)

33

b)

35

c)

48

d)

34

50.

The text inside the double quotes (including the double quotes) is

a)

Double Quotes

b)

String

c)

Integer

d)

Variable