Bird
0
0

Given this ~/.irbrc snippet:

medium📝 Predict Output Q4 of 15
Ruby - Ecosystem and Best Practices
Given this ~/.irbrc snippet:
IRB.conf[:SAVE_HISTORY] = 1000
IRB.conf[:HISTORY_FILE] = ".irb_history"

What will happen when you exit IRB?
AThe last 1000 commands will be saved to the file ".irb_history"
BIRB will clear the history file on exit
CIRB will save only the last command to ".irb_history"
DNo history will be saved because the file name is invalid
Step-by-Step Solution
Solution:
  1. Step 1: Understand the meaning of SAVE_HISTORY and HISTORY_FILE

    SAVE_HISTORY sets how many commands to save; HISTORY_FILE sets the file name.
  2. Step 2: Interpret the snippet

    It saves the last 1000 commands to ".irb_history" on exit.
  3. Final Answer:

    The last 1000 commands will be saved to the file ".irb_history" -> Option A
  4. Quick Check:

    History saved count and file name = saved commands [OK]
Quick Trick: SAVE_HISTORY sets count; HISTORY_FILE sets file name [OK]
Common Mistakes:
  • Assuming history is cleared on exit
  • Thinking only one command is saved
  • Believing file name must be absolute path

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Ruby Quizzes