wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Java Basics

Total questions: 81

Worksheet time: 41mins

Name
Class
Date
1.

Java is a

a)

Procedure Oriented Language

b)

Structure Oriented Language

c)

Object_Oriented Language

d)

Machine Language

2.

The name of the following should be the file name in Java

a)

Object Name

b)

Variable Nam

c)

Class Name

d)

Array Name

3.

Java program is

a)

Interpreted

b)

Compiled

4.

Java program does not run without below function

a)

user()

b)

system()

c)

main()

d)

void()

5.

A ___________ file is created after successful compilation of a Java program.

a)

Object file

b)

Array file

c)

Class file

d)

String file

6.

Command to compile Java program

a)

javax

b)

javay

c)

javac

d)

Java

7.

Command to run a Java program

a)

javaa

b)

java

c)

jaava

d)

jaavaa

8.

JDK stands for

a)

Java Developer Kit

b)

Java Development Kit

c)

Java Design Kit

d)

Java Debugging Kit

9.

JRE stands for

a)

Java Run Environment

b)

Java Run Execution

c)

Java Runtime Environment

d)

Java Ready Execution

10.

Java is

a)

Machine dependent language

b)

Machine independent language

11.

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

a)

JVM

b)

JDK

c)

JRE

d)

JIT

12.

Which component is responsible for converting bytecode into machine specific code

a)

JVM

b)

JDK

c)

JRE

d)

JIT

13.

Which component is responsible to run java program

a)

JVM

b)

JDK

c)

JRE

d)

JIT

14.

What is the extension of compiled java classes

a)

.classs

b)

.java

c)

.txt

d)

.js

15.

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

16.

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

17.

Which of the following is not a Java features?

a)

Dynamic

b)

Architecture Neutral

c)

Use of pointers

d)

Object-oriented

18.

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

a)

JVM

b)

JRE

c)

JDK

d)

JDB

19.

Which of the following tool is used to generate API documentation in HTML format from doc comments in source code?

a)

javap tool

b)

javaw command

c)

Javadoc tool

d)

javah command

20.

Java is ______________________

a)

Object based

b)

Object Oriented

c)

fully object oriented

d)

procedural

21.

Java was developed by

a)

James gosling

b)

John gosling

c)

James frank

d)

John frank

22.

JDK stands for (a)  

23.

JVM stands for (a)  

24.

List out oops concept.

4 lines
25.

Int data types represents _______ bits.

a)

8

b)

16

c)

32

d)

64

26.

There are (a)   types of data types.

27.

(a)   is a piece of memory that can contain a data value.

28.

How many types of array?

a)

1

b)

2

c)

3

d)

4

29.

List out types of inheritance.

a)

Single

b)

Mulitple

c)

Multi level

d)

Hierarchy

30.

Which one of the following is escape sequences?

a)

\r

b)

\n

c)

\f

d)

\t

31.

Which statement is true about java ?

a)

Java is a sequence-depended programming language

b)

Java is a code dependent programming language

c)

Java is a platform-dependent programming language

d)

Java is a platform-independent programming language

32.

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

a)

JRE

b)

JIT

c)

JDK

d)

JVM

33.

Which one of the following is not a java feature

a)

Object-oriented

b)

Use of pointers

c)

Portable

d)

Dynamic and Extensible

34.

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

a)

Identifier & keyword

b)

Identifier

c)

Keyword

d)

None of the mentioned

35.

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

a)

Polymorphism

b)

Inheritance

c)

Compilation

d)

Encapsulation

36.

Which of these are selection statements in java

a)

Break

b)

Continue

c)

For ( )

d)

If ( )

37.

Which of these keywords is used to define interfaces in java

a)

intf

b)

Intf

c)

interface

d)

Interface

38.

Which of the following is a superclass of every class in java ?

a)

ArrayList

b)

Abstract class

c)

Object class

d)

String

39.

Which of these packages contains the exception stack Overflow in java ?

b)

Java.system

c)

Java.lang

d)

Java.util

40.

Which of these statements is incorrect about tread ?

a)

Start() method is used to begin execution of the thread

b)

Run () method is used to begin execution of a thread before start() method in special cases

c)

A thread can be formed by implementing runnable interface only

d)

A thread can be formed by a class that extends thread class

41.

Which of these keywords are used for the block to be examined for exceptions ?

a)

Check

b)

Throw

c)

Catch

d)

Try

42.

Which one of the following is not an access modifier ?

a)

Protected

b)

Void

c)

Public

d)

Private

43.

What is the numerical range of a char data tupe in java ?

a)

0 to 256

b)

-128 to 127

c)

0 to 65535

d)

0 to 32767

44.

When does method overloading is determined?

a)

At run time

b)

At compile time

c)

At coding time

d)

At execution time

45.

When overloading does not occur ?

a)

More than one method with same name but different method signature and different number or type of parameters

b)

More than one method with same name,same signature but different number of signature

c)

More than one method with same name,same signature,same number of parameters but different type

d)

More than one method with same , same number of parameters and type but different signature

46.

What is it called if an object has its own life cycle and there is no owner

a)

Aggregation

b)

Composition

c)

Encapsulation

d)

Association

47.

Method overriding is combination of inheritance and polymorphism ?

a)

True

b)

False

48.

Which of the below is invalid identifier with the main method

a)

Public

b)

Static

c)

Private

d)

Final

49.

How can we identify whether a compilation unit is class or interface from a .class file ?

a)

Java source file header

b)

Extension of compilation unit

c)

We cannot different between class and interface

d)

The class or interface name should be postfixed with unit type

50.

What is use of interpreter ?

a)

They covert 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

51.

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

52.

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

a)

JVM

b)

JDK

c)

JIT

d)

JRE

53.

Syntax to compile java program from command prompt

a)

java Filename.java

b)

javac Filename

c)

javac Filename.java

d)

java Filename

54.

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

a)

JVM

b)

JDK

c)

JIT

d)

JRE

55.

Which of the following is not a valid Java comment?

a)

/** Comment 1 */

b)

*/ Comment 2 /*

c)

// Comment 3

d)

/* Comment 4 */

56.

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

a)

.java.

b)

.javac.

c)

.src.

d)

.class.

57.

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.

58.

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};

59.

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

a)

super

b)

this

c)

extend

d)

extends

60.

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

61.

What is the extension of compiled java classes?

a)

.java

b)

.class

c)

.txt

d)

.js

62.
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();
63.

Where does a java program start executing instructions from:

a)

class

b)

source file

c)

main method

d)

object

64.

Which of these keywords is used to make a class?

a)

class

b)

struct

c)

int

d)

none of the mentioned

65.

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

66.

Which of the following is not OOPS concept in Java?

a)

Inheritance

b)

Encapsulation

c)

Polymorphism

d)

Compilation

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

Which company owns Java?

a)

Oracle

b)

Microsoft

c)

Google

d)

Apple

e)

Intel

69.

Who invented Java?

a)

James Gosling

b)

Sergey Brin

c)

Steve Jobs

d)

Bill Gates

e)

Tim Berners-Lee

70.

Java was originally named:

a)

Coffee

b)

Oak

c)

New C++

d)

Duke

71.

Java has (a)   primitive data types.

72.

JDK stands for (a)  

73.

List out oops concept.

4 lines
74.

Java is ___________.

a)

Structured Programming Language

b)

Object Oriented Programming Language

c)

Query Language

d)

None of the above

75.

________ keyword is used to monitor an exception.

a)

try

b)

catch

c)

throw

d)

throws

76.

Java was developed by

a)

James gosling

b)

John gosling

c)

James frank

d)

John frank

77.

Java does not support

a)

Single Inheritance

b)

Multiple Inheritance

c)

Multilevel Inheritance

d)

Hierarchical Inheritance

78.

Which one of the following is escape sequences?

a)

\r

b)

\n

c)

\f

d)

\t

79.

Java is

a)

Simple

b)

Object Oriented

c)

Platform dependent

d)

interpreted

80.

What will be the output?

a)

24

b)

32

c)

23

d)

31

81.
a)

a

b)

b

c)

c

d)

d