Latest Update Graded A+
Which keyword is used to define a method in Java?
A. function
B. define
C. method
D. void
✔✔ D. void
Which of the following statements about method overloading is true?
A. Methods must have the same return type
B. Methods must have the same number of parameters
C. Methods must have different parameter lists
D. Methods must have the same body
✔✔ C. Methods must have different parameter lists
Which of the following is the correct way to pass an argument to a method in Java?
A. methodName[value]
1
,B. methodName{value}
C. methodName(value)
D. methodName<-value
✔✔ C. methodName(value)
Which of the following statements about method return types is true?
A. A method must always return a value
B. A method with a void return type cannot return a value
C. A method cannot have parameters if it returns a value
D. A method can return multiple values
✔✔ B. A method with a void return type cannot return a value
Which keyword is used to exit a method and return a value?
A. stop
B. return
C. exit
D. end
✔✔ B. return
2
, Which of the following method calls is valid in Java?
A. `displayMessage[“Hello”]`
B. `displayMessage{“Hello”}`
C. `displayMessage(“Hello”)`
D. `displayMessage<-“Hello”`
✔✔ C. `displayMessage(“Hello”)`
Which access modifier allows a method to be accessed from any class?
A. private
B. protected
C. public
D. default
✔✔ C. public
Which of the following best describes recursion in Java?
A. A method that calls itself
B. A method that runs continuously
3