Bird
0
0

Given the Gemfile line gem 'nokogiri', '~> 1.10.0', which of the following versions will Bundler accept when installing?

medium📝 Predict Output Q13 of 15
Ruby - Gems and Bundler
Given the Gemfile line gem 'nokogiri', '~> 1.10.0', which of the following versions will Bundler accept when installing?
A1.9.0
B1.10.5
C2.0.0
D1.11.0
Step-by-Step Solution
Solution:
  1. Step 1: Interpret the '~> 1.10.0' constraint

    This means versions >= 1.10.0 and < 1.11.0 are allowed.
  2. Step 2: Check each version against the range

    Version 1.9.0 is less than 1.10.0 (not allowed). 1.10.5 is between 1.10.0 and 1.11.0 (allowed). 2.0.0 is greater than 1.11.0 (not allowed). 1.11.0 is equal to the upper bound (not allowed).
  3. Final Answer:

    1.10.5 -> Option B
  4. Quick Check:

    ~> 1.10.0 allows 1.10.x but not 1.11.0 [OK]
Quick Trick: ~> locks last digit, allows patch updates only [OK]
Common Mistakes:
  • Allowing versions equal to upper bound
  • Confusing minor and patch version limits
  • Assuming major version updates allowed

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Ruby Quizzes