wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Quiz on Java

Total questions: 20

Worksheet time: 20mins

Name
Class
Date
1.

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

2.

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

a)

JVM

b)

JDK

c)

JIT

d)

JRE

3.

Syntax to compile java program from command prompt

a)

java Filename.java

b)

javac Filename

c)

javac Filename.java

d)

java Filename

4.

Which component is responsible for converting bytecode into machine specific code?

a)

JVM

b)

JDK

c)

JIT

d)

JRE

5.

Which of the following is not a valid Java comment?

a)

/** Comment 1 */

b)

*/ Comment 2 /*

c)

// Comment 3

d)

/* Comment 4 */

6.

When saving a Java source file, save it with an extension of

a)

.java.

b)

.javac.

c)

.src.

d)

.class.

7.

Which of the following is not a rule that must be followed when naming identifiers?

a)

After the first character, you may use the letters a-z, A-Z, an underscore, a dollar sign, or digits 0-9.

b)

Identifiers can contain spaces.

c)

Uppercase and lowercase characters are distinct.

d)

The first character must be one of the letters a-z, A-Z, an underscore or a dollar sign.

8.

To print "Hello, world" on the monitor, use the following Java statement:

a)

System.out.println("Hello, world");

b)

System Print = "Hello, world";

c)

SystemOutPrintln('Hello, world');

d)

system.out.println{Hello, world};

9.

Which company owns Java?

a)

Oracle

b)

Microsoft

c)

Google

d)

Apple

e)

Intel

10.

Who invented Java?

a)

James Gosling

b)

Sergey Brin

c)

Steve Jobs

d)

Bill Gates

e)

Tim Berners-Lee

11.

Java was originally named:

a)

Coffee

b)

Oak

c)

New C++

d)

Duke

12.

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

a)

super

b)

this

c)

extend

d)

extends

13.

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

14.

What is the extension of compiled java classes?

a)

.java

b)

.class

c)

.txt

d)

.js

15.
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();
16.

Where does a java program start executing instructions from:

a)

class

b)

source file

c)

main method

d)

object

17.

Which of these keywords is used to make a class?

a)

class

b)

struct

c)

int

d)

none of the mentioned

18.

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

19.

Which of the following is not OOPS concept in Java?

a)

Inheritance

b)

Encapsulation

c)

Polymorphism

d)

Compilation

20.
Which type of data is used to enter the value ("Welcome")?
a)
Text
b)
Characters
c)
String
d)
Boolean