All Ruby quizzes
Advanced30 questions75 minutes

Ruby Advanced Quiz

Master advanced metaprogramming, performance optimization, DSLs, and Ruby internals

Start the quiz

Sample questions from this quiz

A preview of the style and depth. Try each one, then reveal the answer — or skip straight to the timed quiz.

1. What is singleton class/eigenclass?

  • Object class
  • Hidden class unique to each object
  • Instance class
  • Meta class
Show answer

Answer: Hidden class unique to each object. Singleton class is hidden class for each object. Access with class << obj. Define singleton methods here. Understanding crucial for metaprogramming. Part of Ruby object model.

2. What is class << self?

  • Opens singleton class for defining class methods
  • Class methods block
  • Class context
  • Self scope
Show answer

Answer: Opens singleton class for defining class methods. class << self opens singleton class. Define class methods here. Alternative to self.method. More common in gems/frameworks. Cleaner for multiple class methods.

3. What is const_missing?

  • Constant loader
  • Called when constant not found
  • Constant fallback
  • Missing constant handler
Show answer

Answer: Called when constant not found. const_missing called when constant undefined. Implement autoloading, lazy loading. Rails uses for autoloading. Powerful but can hide errors. Define on module/class.

Frequently asked questions

How many questions are in this Ruby quiz?+

30 questions, with a 75-minute time limit. Every question includes a written explanation of the correct answer.

Is this Ruby quiz free?+

Yes. Every quiz on CodexQuizz is free and needs no account. You only enter a name if you choose to post your score to the leaderboard.

What level is the advanced quiz aimed at?+

Master advanced metaprogramming, performance optimization, DSLs, and Ruby internals

Can I use this to prepare for a Ruby interview?+

Yes. The questions cover the topics that come up in Ruby technical screens, and the explanations are written so that a wrong answer still teaches you the underlying concept.

Ready to test your Ruby?

30 questions, 75 minutes. Free, no sign-up.

Start now