A. Disables command history and uses default prompt
B. Changes prompt color but does not save history
C. Causes a syntax error and IRB won't start
D. Sets a simple prompt and saves last 1000 commands in history
Solution
Step 1: Understand IRB.conf[:PROMPT_MODE]
Setting :PROMPT_MODE to :SIMPLE changes IRB prompt to a simple style.
Step 2: Understand IRB.conf[:SAVE_HISTORY]
Setting :SAVE_HISTORY to 1000 means IRB saves the last 1000 commands in history.
Final Answer:
Sets a simple prompt and saves last 1000 commands in history -> Option D
Quick Check:
Prompt = simple, History saved = 1000 [OK]
Hint: Look for keys in IRB.conf to know prompt and history settings [OK]
Common Mistakes:
Thinking it disables history
Assuming syntax error from valid config
Confusing prompt style with color only
4. You wrote this in your ~/.irbrc file:
IRB.conf[:SAVE_HISTORY] = '1000'
But IRB does not save history as expected. What is the problem?
medium
A. The key :SAVE_HISTORY is invalid
B. The value should be an integer, not a string
C. IRB does not support saving history
D. You must restart the computer for changes to apply
Solution
Step 1: Check the data type of the value
:SAVE_HISTORY expects an integer number, not a string.
Step 2: Identify the error cause
Using a string like '1000' causes IRB to ignore the setting, so history is not saved.
Final Answer:
The value should be an integer, not a string -> Option B
Quick Check:
Integer value needed for history count [OK]
Hint: Use numbers, not strings, for numeric IRB config values [OK]
Common Mistakes:
Using quotes around numbers
Thinking IRB can't save history
Believing a full restart is needed
5. You want to customize IRB so that it automatically requires the 'json' library, sets a custom prompt showing the current time, and saves 500 commands in history. Which ~/.irbrc snippet correctly does this?