WorksheetsUnit 5: Input in Java
Total questions: 14
Worksheet time: 4hrs 30mins
Name the package that contains Scanner class.
(a)
Complete the code below to create an object of Scanner class:
Scanner sc = new Scanner( (a) );
Name the type of error in case given below:
Missing semicolon.
Syntax Error
Logical Error
Run-time error
Name the method of Scanner class that is used to input an integer data from the standard input stream.
(a)
Name the type of error in case given below:
int a;b;c;
Syntax Error
Logical Error
Run-time error
Which of the following are valid comments?
/* comment */
* comment
// coment
*/ comment */
Name the type of error in case given below:
Math.sqrt(36 – 45)
Syntax Error
Logical Error
Run-time error
Name the method of Scanner class that is used to input a String data from the standard input stream.
(a)
Name the type of error in case given below:
Multiplication operator used when the operation should be division.
Syntax Error
Logical Error
Run-time error
Name the keyword, to use the classes defined in a package.
(a)
Name the package that is invoked by default.
(a)
Name the type of error in case given below:
Division by a variable that contains a value of zero.
Syntax Error
Logical Error
Run-time error
Name the keyword used to call a package in the program.
(a)
Which of the following is not a valid comment in Java?
Single line comment
Double line comment
Multi line comment
Documentation comment
