Bird
0
0

Which method name follows Ruby convention for a method that returns a boolean value?

easy📝 Conceptual Q11 of 15
Ruby - Methods
Which method name follows Ruby convention for a method that returns a boolean value?
? is used at the end of method names that return true or false.
Asave
Bupdate!
Ccalculate
Dvalid?
Step-by-Step Solution
Solution:
  1. Step 1: Understand the meaning of ? suffix

    In Ruby, methods ending with ? return true or false, indicating a boolean check.
  2. Step 2: Identify the method that returns a boolean

    Among the options, valid? clearly suggests a boolean check, while others do not.
  3. Final Answer:

    valid? -> Option D
  4. Quick Check:

    Boolean methods end with ? = valid? [OK]
Quick Trick: Boolean methods end with ? to show true/false result [OK]
Common Mistakes:
MISTAKES
  • Confusing ! with ? suffix
  • Using ? for methods that modify objects
  • Not using ? for boolean-returning methods

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Ruby Quizzes