Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

funWithJava

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

How many primitives data types are in java ?

a)

7

b)

8

c)

6

d)

9

2.

What is NOT a name of a primitive data type in Java?

a)

Int

b)

Float

c)

stand-in

d)

string

3.

Which of the following option makes java portable and secure ?

a)

applet

b)

Bytecode is executed by JVM

c)

Use of exception handling

d)

Dynamic binding between objects

4.

(a)   is used to find and fix bugs in the Java programs.

5.

What is the output of following code?


class Equals

{

public static void main(String [] args)

{

int x = 100; double y = 100.1;

boolean b = (x = y);

System.out.println(b);

}

}

a)

true

b)

false

c)

compilation error

d)

exception will be generated

6.

Evaluate the Java expression, (++z + y - y + z + x++)

if the initial values of x=3, y=5, and z=10

a)

34

b)

24

c)

19

d)

23

7.

What is a class?

a)

A class is a section of computer memory that contains objects.

b)

A class is a section of the hard disk reserved for object-oriented programs.

c)

A class is a description of a type of object.

d)

A class is part of an object that contains variables.

8.

If you start a Java application by java Hello World, which is the first method that will be executed?

a)

The method of main()the class HelloWorld.

b)

The method of run()the class HelloWorld.

c)

The method of run()the class HelloWorld.

d)

The method applet().

9.

Which is a valid declarations of a String?

a)

String s1 = null;

b)

String s2 = 'null';

c)

String s3 = (String) 'abc';

d)

String s4 = (String) '\ufeed';

10.

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

a)

Not a Number

b)

0

c)

Infinity

d)

Run time exception