Short answerEasy2 marks
Name the following: (i) A keyword used to call a package in the program. (ii) Any one reference data type.
Topic: Keywords and data types
Previous-year question practice database
Answer
Exam answer
(i) import (ii) String (arrays and classes are equally acceptable)
Explanation
(i) import brings a package or class into the program, as in import java.util.Scanner;. Do not confuse it with the keyword package, which DECLARES the package a file belongs to. (ii) A reference (non-primitive) data type holds a reference to an object rather than a value directly. String, arrays, classes and interfaces all qualify. Any of the eight primitives — int, char, double and so on — would be wrong. A quick test: reference types are written with a capital first letter; primitives are lower case.
More from Library Classes
What is the output of the statement Math.pow(36, 6/5);?2026The output of the statement:
System.out.println(Character.toUpperCase('b') + 2); is:2026What is the type of parameter to be given for the method parseInt()?2026Write the Java expression to find the sum of cube root of x and the absolute value of y.2026Character class methods are found in the package called:2025The output of Math.max(-7, Math.min(-5, -4)) is2025