wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Core Java Quiz

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

what is size of int in Java?

a)

2 bytes

b)

4 bytes

c)

6 bytes

d)

8 bytes

2.

what is size of long int in Java?

a)

2 bytes

b)

4 bytes

c)

6 bytes

d)

8 bytes

3.

what is size of char in Java?

a)

2 bytes

b)

4 bytes

c)

6 bytes

d)

1 bytes

4.

String in a Java is primitive (built-in) data type or class?

a)

data type

b)

class

5.

What size will be required to store value 324.98 in Java?

a)

2

b)

3

c)

6

d)

8

6.

Which of these can not be used for a variable name in Java and any other programming languages?

a)

identifier

b)

keyword

c)

identifier & keyword

d)

none of the mentioned

7.

Import java.lang.*;

class Rectangle

{

int l,b,a;

a=l*b;

void fun()

{

l=10;

b=20;

system.out.println("Area = ", a);

}

}

Identify errors in above program segment.

a)

Error in import line and Error in println line both

b)

Error in import line

c)

Error in println line

d)

No error at all

8.

Which of the following rule is INCORRECT in Java?

a)

Class should not be end with semi-colon

b)

Constants to be written in CAPITAL letters

c)

main() should be inside the class

d)

We can write Java program without using class

9.

Which of these access specifiers must be used for main() method in Java?

a)

private

b)

public

c)

protected

d)

none of the mentioned

10.

Which of the following is a valid declaration of an object of class Box?

a)

Box obj = new Box();

b)

Box obj = new Box;

c)

obj = new Box();

d)

new Box obj;