Test Series - java

Test Number 5/64

Q: What is the use of Access modifier "pubic" in Java language?
A. To hide the main method from misuse
B. To call the main method outside of Class or Package by JVM
C. To protect main method
D. None of the above
Solution: no solution
Q: Choose a Single Line Comment in Java Language below?
A. //Some comments
B. Some comments//
C. /*Some comments*/
D. */Some comments/*
Solution: no solution
Q: Choose a multiline comment in Java language below?
A. /*comments are going cars are moving*/
B. */comments are going cars are moving/*
C. //comments are going cars are moving//
D. None of the above
Solution: no solution
Q: String args[] in main method are used for?
public static void main(String args[])
{
  //
}
A. Passing arguments at compile time
B. Passing arguments at run time
C. Counting number of words
D. Nothing
Solution: C:/>java Hello AFRICA GOLDMINE
Hello - Class name
AFICA - First argument
GOLDMINE - Second argument
Q: What is the default return type of a method in Java language?
A. void
B. int
C. short
D. None of the above
Solution: You have to explicitly mention a return type.
Q: Name of a Class, Variable, Method or an Interface in Java language is called?
A. Argument
B. Value
C. Identifier
D. None of the above
Solution: no solution
Q: A valid identifier in Java language may contain which characters?
A. 0-9
B. A-Z, a-z
C. $, _ (Underscore)
D. All the above
Solution: no solution
Q: A valid Identifier or name in Java language can start with which character?
A. a-z, A-Z
B. $, _
C. 0-9
D. A and B
Solution: Up to JDK 8, only a single underscore symbol can be used as an identifier of a class, method or a variable. JDK 9 does not allow.
Q: What are the valid White Spaces available in Java language?
A. Space
B. Enter
C. Tab
D. All the above
Solution: no solution
Q: Choose a correct version of Java Documentation Comment?
A. /* comments */
B. /** comments */
C. /* comments **/
D. /** comments **/
Solution: Documentation comment allows writing notes about the program. javadoc commmand on the source java file generates a HTML Java documentation with the embedded comments.

You Have Score    /10