Test Series - java

Test Number 49/64

Q: A Java method is comparable to a __ in c language.
A. structure
B. union
C. function
D. enum
Solution: no solution
Q: All Java methods must have a return type. (TRUE / FALSE)
A. TRUE
B. FALSE
C. Compiler error
D. None
Solution: no solution
Q: State TRUE or FALSE. A Java method can have the same name as the class name.
A. TRUE
B. FALSE
C. Compiler error
D. None
Solution: no solution
Q: in Java, add a ___ to a constructor to convert it into a method.
A. if statement
B. static
C. return type
D. semicolon
Solution: no solution
Q: Java method signature is a combination of ___.
A. Return type
B. Method name
C. Argument List
D. All the above
Solution: no solution
Q: In Java, a method name can not start with a ___.
A. number
B. # (pound)
C. - (hyphen)
D. All the above
Solution: no solution
Q: In Java, a method name can start with ___.
A. Alphabet
B. Underscore (_)
C. Dollar ($)
D. All the above
Solution: no solution
Q: In Java, a method name can contain numbers from 2nd character onwards. (TRUE / FALSE).
A. TRUE
B.  FALSE
C. Compiler error
D. None
Solution: no solution
Q: Choose the correct identifier for a method name in Java.
A. 1show
B. $hide
C. *show$
D. 3_click
Solution: no solution
Q: What is the output of the below Java program with an empty return statement?
public class TestingMethods2
{
  void show()
  {
    System.out.println("SHOW Method..");
    return;
  }
  public static void main(String[] args)
  {
    TestingMethods2 t2 = new TestingMethods2();
    t2.show();
  }
}
A. SHOW Method..
B. No output
C. Compiler error
D. None
Solution: Yes. A void method can use an empty return statement.

You Have Score    /10