Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Assignment Quiz

Total questions: 47

Worksheet time: 33mins

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 does not run without below function

a)

user()

b)

system()

c)

main()

d)

void()

4.

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

a)

Object file

b)

Array file

c)

Class file

d)

String file

5.

JDK stands for

a)

Java Developer Kit

b)

Java Development Kit

c)

Java Design Kit

d)

Java Debugging Kit

6.

What does JVM stands for?

a)

Java Variable Machine

b)

Java Virtual Machine

c)

Java Virtual Mechanism

d)

None of the above

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.

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

9.

The keyword "method" is another name for

a)

an object

b)

a class

c)

a function

d)

a variable

10.

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

11.

The numeric type int uses how many bits?

a)

31

b)

32

c)

63

d)

64

12.
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
13.
These have identity, state, and behavior.
a)
class
b)
object
c)
method
d)
void
14.
An object is an instance of a:
a)
parameter
b)
method
c)
class
d)
application
15.
Which of the following concepts of OOPS means exposing only necessary information to client?
a)
Encapsulation
b)
Abstraction
c)
Data hiding
d)
Data binding
16.

The process by which objects of one class acquire the properties of objects of another class is known as

a)

Polymorphism

b)

Inheritance

c)

Data Hiding

d)

Association

17.

Which from the following is a feature that allows us to perform a single action in different ways.

a)

Abstraction

b)

Polymorphism

c)

Encapsulation

d)

Inheritance

18.

Attributes of an object are also known as

a)

methods

b)

properties

c)

classes

d)

functions

19.

Name the data type: 1.0

a)

double

b)

int

c)

char

d)

boolean

20.

Name the data type: '3'

a)

int

b)

char

c)

String

d)

None of the above

21.

Which expression evaluates to true?

a)

false == false

b)

true != true

c)

4 < 4

d)

true == true != true

22.

which of the following is wrapper class in java

a)

Float

b)

Integer

c)

Double

d)

all of above

23.

which one of the following is true?

a)

runnable interface declares the start method

b)

Thread.start() method is used to move a thread from a new state to the runnable state

c)

Thread.runnable() method is used to move a thread from new state to the runnable state

d)

Thread.run() method is used to move a thread from new state to the runnable state

24.

which of this class is used by character streams for reading data from buffer

a)

BufferReader

b)

InputStreamReader

c)

FileReader

d)

FileInputStream

25.
What is the difference between a class and an object?
a)
A class is a blueprint to make an object
b)
An object is a blueprint to make a class
c)
A blueprint is an object to make a class
d)
Blueprint class is an object make a
26.

What is the main difference between float and double data types?

a)

4.1 is an example of float.

b)

4.11 is an example of double.

c)

Float consists of 8 bytes, and double consists of 4 bytes.

d)

Float consists of 4 bytes, and double consists of 8 bytes.

27.

In Java, execution starts from ___________ function.

a)

get()

b)

main()

c)

java()

d)

display()

28.
Create an array of 12 strings called months.
a)
String[] months = new String[12];
b)
String months = new String[12];
c)
String[] months = new String[];
d)
String[12] months = new String[];
29.
What value is at index 1 in this array?  String[] names = {"Mack", "Dennis", "Dee", "Charlie"};
a)
Mack
b)
Dennis
c)
Dee
d)
Charlie
30.
Index values of an array range from ______________.
a)
0 to length – 1
b)
1 to length
c)
0 to length
d)
0 to length + 1
31.

How many ways a thread can be created in Java multithreading?

a)

1

b)

2

c)

5

d)

10

32.

Which will contain the body of the thread in Java?

a)

Start()

b)

Run()

c)

Main()

d)

Execute()

33.

The life cycle of a thread in java is controlled by

a)

JRE

b)

JDK

c)

JVM

d)

None

34.

Which method is used to get current running thread object?

a)

runningThread()

b)

currentThread()

c)

runnableThread()

d)

None

35.

In JAVA multi threading, a thread can be created by_______

a)

Extending class

b)

Implementing Runnable Interface

c)

both

d)

none

36.

Q) Execution of a java thread begins on which method call?

a)

Start ()

b)

Run ()

c)

Execute ()

d)

Launch ()

37.
Which of these is not a Thread state?
a)
New
b)
Runnable
c)
sleep
d)
terminated
38.
What is sometimes also called a lightweight process?
a)
Thread
b)
Process
c)
JVM
39.

which member of a class can be accessible by the class of another package?

a)

public

b)

private

c)

defualt

d)

protected

40.

Choose the correct sequence.

a)

Select  Start -> Control Panel ->Environment Variables -> System Variables -> CLASSPATH

b)

Select  Start -> Control Panel ->system& security-> System -> Advanced -> Environment Variables -> System Variables -> CLASSPATH

c)

Select  Start -> Control Panel ->system& security-> System -> System Variables -> CLASSPATH

d)

Select  Start -> system& security-> System -> Advanced -> Environment Variables -> System Variables -> CLASSPATH

41.

what is syntax to improt a particular class of package?

a)

import class_name.*;

b)

import package_name.*;

c)

import pak1.pak2.pak3;

d)

import packaage_name.class_name;

42.

package types

a)

user defined

b)

built-in package

c)

both

d)

none

43.

Collection of similar classes, interfaces and sub packages

a)

variable

b)

Interface

c)

packages

d)

class

44.

The following example shows the creation of a

import java.applet.*;

import java.awt.*;


public class Main extends Applet{

public void paint(Graphics g){

g.drawString("Welcome in Java Applet.",40,20);

}

}

a)

a. Banner using Applet

b)

b. Basic Applet

c)

c. Display clock

d)

d. None of the above

45.

Which of the following loops will execute the body of loop even when condition controlling the loop is initially false?

a)

for

b)

while

c)

do..while

d)

None of the above

46.

Your full name

4 lines
47.

Your Reg No

4 lines