wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Unit 5: Input in Java

Total questions: 14

Worksheet time: 4hrs 30mins

Name
Class
Date
1.

Name the package that contains Scanner class.

(a)  

2.

Complete the code below to create an object of Scanner class:

Scanner sc = new Scanner( (a)   );

3.

Name the type of error in case given below:

Missing semicolon.

a)

Syntax Error

b)

Logical Error

c)

Run-time error

4.

Name the method of Scanner class that is used to input an integer data from the standard input stream.

(a)  

5.

Name the type of error in case given below:

int a;b;c;

a)

Syntax Error

b)

Logical Error

c)

Run-time error

6.

Which of the following are valid comments?

a)

/* comment */

b)

* comment

c)

// coment

d)

*/ comment */

7.

Name the type of error in case given below:

Math.sqrt(36 – 45)

a)

Syntax Error

b)

Logical Error

c)

Run-time error

8.

Name the method of Scanner class that is used to input a String data from the standard input stream.

(a)  

9.

Name the type of error in case given below:

Multiplication operator used when the operation should be division.

a)

Syntax Error

b)

Logical Error

c)

Run-time error

10.

Name the keyword, to use the classes defined in a package.

(a)  

11.

Name the package that is invoked by default.

(a)  

12.

Name the type of error in case given below:

Division by a variable that contains a value of zero.

a)

Syntax Error

b)

Logical Error

c)

Run-time error

13.

Name the keyword used to call a package in the program.

(a)  

14.

Which of the following is not a valid comment in Java?

a)

Single line comment

b)

Double line comment

c)

Multi line comment

d)

Documentation comment