• Card 45 / 76: Which of the following statements is/are true about declaring a return type? (Choose all that apply.)
    A) The keyword void is used to signify that a method does not return any value.
    B) The use of the keyword void is optional if the method isn’t returning anything.
    C) If a method is returning an int, it must declare this by having int precede the method name in the method signature.
    D) If the return type is omitted, a method may or may not return data, depending on the condition inside of the method.

    Answer:
    A) The keyword void is used to signify that a method does not return any value.
    C) If a method is returning an int, it must declare this by having int precede the method name in the method signature.

  • Keyboard Shortcuts

    Previous Card ← Previous Card Button
    Next Card → Next Card Button
    Flip Card Space-Bar
<< First < Previous Next > Last >>

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now
Explanation:

A and C.

A is correct because the void keyword means the method will not return any data.

C is correct because the data type of the variable to be returned must precede the method name.

B and D are incorrect.

B is incorrect because void is not optional if the method isn’t returning anything. The void keyword must be included in this condition.

D is incorrect because a method must always declare a return type or void. If it is a constructor, it can omit a return type and it will be implied as void.

Hide Choices Interactive Question Exam Home Page
https://www.jobilize.com/quiz-my-oca-mock-exam-by-mike-wolf

My OCA Mock

Author:

Access: Public Instant Grading

Flash Cards plugin by Curtis Blackwell github.com/curtisblackwell/flash_cards
Google Play and the Google Play logo are trademarks of Google Inc.
Ask
Anonymous User
Start Quiz
Copy and paste the following HTML code into your website or blog.
<iframe src="https://www.jobilize.com/embed/quiz-my-oca-mock-exam-by-mike-wolf" width="600" height="600" frameborder="0" marginwidth="0" marginheight="0" scrolling="yes" style="border:1px solid #CCC; border-width:1px 1px 0; margin-bottom:5px" allowfullscreen webkitallowfullscreen mozallowfullscreen> </iframe>