wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

BlueJ

Total questions: 10

Worksheet time: 7mins

Name
Class
Date
1.

What is the size of the short datatype

a)

16 bits

b)

18 bits

c)

64 bits

d)

32 bits

e)

None

2.

Arrange the following primitive datatypes in an ascending order of their size: char,long,double,int

(a)  

3.

What will be the output of the following code?

String n="Computer Knowledge"

System.out.println(s.indexOf('m'));

System.out.println(s.length());

(a)  

4.

What is the function equals() used for?

(a)  

5.

Mention the three types of loop

(a)  

6.

Which math function is used to calculate the power of a number

a)

Math.pow()

b)

Math.log()

c)

Math.cos()

d)

Math.abs()

7.

What is the escape sequence for horizontal tab

a)

\t

b)

\v

c)

\0

d)

\b

8.

Which of these are tokens

a)

Keywords

b)

Identifiers

c)

String

d)

Array

9.

Write a java expression for the following code

1/3ab + 1/2cd

(a)  

10.

If a=48;find a= a++ + ++a;

a)

45

b)

50

c)

98

d)

46