Bird
0
0

Which of the following is the correct syntax to declare a module named Utilities in Ruby?

easy📝 Syntax Q3 of 15
Ruby - Modules and Mixins
Which of the following is the correct syntax to declare a module named Utilities in Ruby?
Amodule Utilities() end
Bmodule Utilities {}
Cmodule Utilities; end
Dmodule Utilities do end
Step-by-Step Solution
Solution:
  1. Step 1: Recall Ruby module syntax

    Ruby modules are declared with module Name and closed with end.
  2. Step 2: Identify correct syntax

    module Utilities; end uses correct syntax: module Utilities; end. Other options use invalid Ruby syntax.
  3. Final Answer:

    module Utilities; end -> Option C
  4. Quick Check:

    Correct module syntax = module Name; end [OK]
Quick Trick: Use 'module Name; end' for simple module declaration [OK]
Common Mistakes:
  • Adding parentheses after module name
  • Using braces {} instead of end
  • Using do...end block for module

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Ruby Quizzes