wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Class X - Java 1

Total questions: 15

Worksheet time: 7mins

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.

The \u0021 article referred to as a

a)

Unicode escape sequence

b)

Octal escape

c)

Hexadecimal

d)

Line feed

4.

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

a)

0

b)

Not a Number

c)

Infinity

d)

Run time exception

5.

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

a)

24

b)

23

c)

20

d)

25

6.

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 )

7.

Which keyword is used for accessing the features of a package?

a)

package

b)

import

c)

extends

d)

export

8.

Given,

int values[ ] = {1,2,3,4,5,6,7,8,9,10};

for(int i=0;i< Y; ++i)

System.out.println(values[i]);


Find the value of value[i]?

a)

10

b)

11

c)

15

d)

None of the above

9.

What is the range of byte data type in Java?

a)

-128 to 127

b)

-32768 to 32767

c)

-2147483648 to 2147483647

d)

None of the mentioned

10.

What will be the output of the following Java statement?

class output {

public static void main(String args[]) {

double a, b,c;

a = 3.0/0;

b = 0/4.0;

c=0/0.0;

System.out.println(a); System.out.println(b); System.out.println(c);

} }

a)

Infinity

b)

0.0

c)

NaN

d)

all of the mentioned

11.

What will be the output of the following Java code?

class increment {

public static void main(String args[]) {

int g = 3; System.out.print(++g * 8);

} }

a)

25

b)

24

c)

32

d)

33

12.

Literal can be of which of these data types?

a)

Integer

b)

Float

c)

Boolean

d)

All of the above

13.

What will be the output of the following Java program?

class variable_scope {

public static void main(String args[]) {

int x; x = 5;

{

int y = 6;

System.out.print(x + " " + y);

}

System.out.println(x + " " + y);

} }

a)

5 6 5 6

b)

5 6 5

c)

Runtime error

d)

Compilation/Syntax error

14.

If an expression contains double, int, float, long, then the whole expression will be promoted into which of these data types?

a)

Long

b)

Int

c)

Double

d)

Float

15.

What will be the output of the following Java code?

class char_increment {

public static void main(String args[]) {

char c1 = 'D'; char c2 = 84;

c2++;

c1++;

System.out.println(c1 + " " + c2); } }

a)

E U

b)

U V

c)

V E

d)

U F