Bird
0
0

Given this Gemfile:

medium📝 Predict Output Q4 of 15
Ruby - Gems and Bundler
Given this Gemfile:
source 'https://rubygems.org'
gem 'nokogiri', '~> 1.12.0'
gem 'httparty', '~> 0.18.0'

What will Bundler do when you run bundle install for the first time?
AInstall nokogiri and httparty gems with versions matching constraints and create Gemfile.lock
BOnly create Gemfile.lock without installing gems
CInstall latest versions ignoring constraints
DRaise an error because Gemfile.lock is missing
Step-by-Step Solution
Solution:
  1. Step 1: Understand bundle install behavior on first run

    It installs gems matching version constraints and generates Gemfile.lock.
  2. Step 2: Confirm that Gemfile.lock is created after installation

    Gemfile.lock records exact installed versions for future consistency.
  3. Final Answer:

    Install nokogiri and httparty gems with versions matching constraints and create Gemfile.lock -> Option A
  4. Quick Check:

    bundle install first run = install gems + create Gemfile.lock [OK]
Quick Trick: bundle install installs gems and creates Gemfile.lock first time [OK]
Common Mistakes:
  • Thinking bundle install skips installation if Gemfile.lock missing
  • Assuming latest versions install ignoring constraints
  • Believing Gemfile.lock must exist before install

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Ruby Quizzes