Practice high-yield Programming & Software Development MCQs on Ruby Gems — Part 1 with worked academic solutions for FPSC, PPSC, NTS, NITB, PTS.
Questions
40
Difficulty Level
Exam-Level
Target Exams
FPSC, PPSC, NTS...
Estimated Time
48 mins
Exam-Level FPSC PPSC NTS NITB PTS
Verified for Commission Syllabus • Oct 14, 2026
40
Verified Practice Questions
Interactive test mode with detailed academic worked solutions
Live Progress|0/40 answered
✓0 correct
✗0 wrong
0% score
🎉 Set complete! All 40 questions answered.
Question 1 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What are Ruby Gems?
Correct Answer: Option D — Pre-packaged libraries or applications that provide additional functionality to Ruby applications
Detailed Academic Explanation:
Pre-packaged libraries or applications that provide additional functionality to Ruby applications is the correct answer to “What are Ruby Gems”. This question is standard in competitive examination syllabi for Ruby Gems.
💡Key Conceptual Anchor:Ruby Gems
Question 2 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
How do you install a Ruby Gem?
Correct Answer: Option C — gem install gem_name
Detailed Academic Explanation:
gem install gem_name is the correct answer to “How do you install a Ruby Gem”. This question is standard in competitive examination syllabi for Ruby Gems.
💡Key Conceptual Anchor:Ruby Gems
Question 3 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which command is used to list all installed gems in Ruby?
Correct Answer: Option B — gem list
Detailed Academic Explanation:
gem list is the correct answer to “Which command is used to list all installed gems in Ruby”. This question is standard in competitive examination syllabi for Ruby Gems.
💡Key Conceptual Anchor:Ruby Gems
Question 4 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is Bundler in the context of Ruby Gems?
Correct Answer: Option C — A dependency manager for Ruby projects
Detailed Academic Explanation:
A dependency manager for Ruby projects is the correct answer to “What is Bundler in the context of Ruby Gems”. This question is standard in competitive examination syllabi for Ruby Gems.
💡Key Conceptual Anchor:Ruby Gems
Question 5 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What does the command gem uninstall gem_name do in Ruby?
Correct Answer: Option D — Uninstalls a specified gem
Detailed Academic Explanation:
Uninstalls a specified gem is the correct answer to “What does the command gem uninstall gem_name do in Ruby”. This question is standard in competitive examination syllabi for Ruby Gems.
💡Key Conceptual Anchor:Ruby Gems
Question 6 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the purpose of the Gemfile in Ruby projects?
Correct Answer: Option A — To specify dependencies for the project
Detailed Academic Explanation:
To specify dependencies for the project is the correct answer to “What is the purpose of the Gemfile in Ruby projects”. This question is standard in competitive examination syllabi for Ruby Gems.
💡Key Conceptual Anchor:Ruby Gems
Question 7 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which command is used to update all installed gems to their latest versions in Ruby?
Correct Answer: Option D — gem update
Detailed Academic Explanation:
gem update is the correct answer to “Which command is used to update all installed gems to their latest versions in Ruby”. This question is standard in competitive examination syllabi for Ruby Gems.
💡Key Conceptual Anchor:Ruby Gems
Question 8 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the purpose of the gemfile.lock file in Ruby projects?
Correct Answer: Option C — To lock the versions of gems specified in the Gemfile
Detailed Academic Explanation:
To lock the versions of gems specified in the Gemfile is the correct answer to “What is the purpose of the gemfile.lock file in Ruby projects”. This question is standard in competitive examination syllabi for Ruby Gems.
💡Key Conceptual Anchor:Ruby Gems
Question 9 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What does the command gem search keyword do in Ruby?
Correct Answer: Option B — Searches for gems with names matching the keyword
Detailed Academic Explanation:
Searches for gems with names matching the keyword is the correct answer to “What does the command gem search keyword do in Ruby”. This question is standard in competitive examination syllabi for Ruby Gems.
💡Key Conceptual Anchor:Ruby Gems
Question 10 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which command is used to build a Ruby gem from a gemspec file?
Correct Answer: Option A — gem build gemspec_file
Detailed Academic Explanation:
gem build gemspec_file is the correct answer to “Which command is used to build a Ruby gem from a gemspec file”. This question is standard in competitive examination syllabi for Ruby Gems.
💡Key Conceptual Anchor:Ruby Gems
Question 11 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the purpose of the gemspec file in a Ruby gem?
Correct Answer: Option D — To specify information about the gem, such as its name, version, and dependencies
Detailed Academic Explanation:
To specify information about the gem, such as its name, version, and dependencies is the correct answer to “What is the purpose of the gemspec file in a Ruby gem”. This question is standard in competitive examination syllabi for Ruby Gems.
💡Key Conceptual Anchor:Ruby Gems
Question 12 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the purpose of the gem environment command in Ruby?
Correct Answer: Option C — Displays information about the RubyGems environment
Detailed Academic Explanation:
Displays information about the RubyGems environment is the correct answer to “What is the purpose of the gem environment command in Ruby”. This question is standard in competitive examination syllabi for Ruby Gems.
💡Key Conceptual Anchor:Ruby Gems
Question 13 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
How do you create a new Ruby gem?
Correct Answer: Option B — By running bundle gem gem_name
Detailed Academic Explanation:
By running bundle gem gem_name is the correct answer to “How do you create a new Ruby gem”. This question is standard in competitive examination syllabi for Ruby Gems.
💡Key Conceptual Anchor:Ruby Gems
Question 14 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What does the command gem pristine gem_name do in Ruby?
Correct Answer: Option C — Restores a gem to its pristine condition
Detailed Academic Explanation:
Restores a gem to its pristine condition is the correct answer to “What does the command gem pristine gem_name do in Ruby”. This question is standard in competitive examination syllabi for Ruby Gems.
💡Key Conceptual Anchor:Ruby Gems
Question 15 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the purpose of the --no-ri and --no-rdoc flags when installing gems?
Correct Answer: Option D — To skip generating documentation for installed gems
Detailed Academic Explanation:
To skip generating documentation for installed gems is the correct answer to “What is the purpose of the --no-ri and --no-rdoc flags when installing gems”. This question is standard in competitive examination syllabi for Ruby Gems.
💡Key Conceptual Anchor:Ruby Gems
Question 16 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the purpose of the gem update --system command in Ruby?
Correct Answer: Option A — Updates the RubyGems system to the latest version
Detailed Academic Explanation:
Updates the RubyGems system to the latest version is the correct answer to “What is the purpose of the gem update --system command in Ruby”. This question is standard in competitive examination syllabi for Ruby Gems.
💡Key Conceptual Anchor:Ruby Gems
Question 17 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
How do you specify a specific version of a gem to be installed in a Gemfile?
Correct Answer: Option D — gem 'gem_name', '= version_number'
Detailed Academic Explanation:
gem 'gem_name', '= version_number' is the correct answer to “How do you specify a specific version of a gem to be installed in a Gemfile”. This question is standard in competitive examination syllabi for Ruby Gems.
💡Key Conceptual Anchor:Ruby Gems
Question 18 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which command is used to uninstall all gems except default gems in Ruby?
Correct Answer: Option C — gem cleanup
Detailed Academic Explanation:
gem cleanup is the correct answer to “Which command is used to uninstall all gems except default gems in Ruby”. This question is standard in competitive examination syllabi for Ruby Gems.
💡Key Conceptual Anchor:Ruby Gems
Question 19 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What does the --remote flag do in the context of the gem list command in Ruby?
Correct Answer: Option C — Lists gems available on the remote server
Detailed Academic Explanation:
Lists gems available on the remote server is the correct answer to “What does the --remote flag do in the context of the gem list command in Ruby”. This question is standard in competitive examination syllabi for Ruby Gems.
💡Key Conceptual Anchor:Ruby Gems
Question 20 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the purpose of the gem owner gem_name command in Ruby?
Correct Answer: Option D — Displays the owners of a specified gem
Detailed Academic Explanation:
Displays the owners of a specified gem is the correct answer to “What is the purpose of the gem owner gem_name command in Ruby”. This question is standard in competitive examination syllabi for Ruby Gems.
💡Key Conceptual Anchor:Ruby Gems
Question 21 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which command is used to view information about a specific gem in Ruby?
Correct Answer: Option A — gem info gem_name
Detailed Academic Explanation:
gem info gem_name is the correct answer to “Which command is used to view information about a specific gem in Ruby”. This question is standard in competitive examination syllabi for Ruby Gems.
💡Key Conceptual Anchor:Ruby Gems
Question 22 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the purpose of the --version flag when installing a gem using the gem install command in Ruby?
Correct Answer: Option D — Specifies the version of the gem to be installed
Detailed Academic Explanation:
Specifies the version of the gem to be installed is the correct answer to “What is the purpose of the --version flag when installing a gem using the gem install command in Ruby”. This question is standard in competitive examination syllabi for Ruby Gems.
💡Key Conceptual Anchor:Ruby Gems
Question 23 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the purpose of the --development flag when installing gems using Bundler?
Correct Answer: Option C — Installs development dependencies along with regular dependencies
Detailed Academic Explanation:
Installs development dependencies along with regular dependencies is the correct answer to “What is the purpose of the --development flag when installing gems using Bundler”. This question is standard in competitive examination syllabi for Ruby Gems.
💡Key Conceptual Anchor:Ruby Gems
Question 24 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the purpose of the bundle install --without production command in Ruby projects?
Correct Answer: Option B — Installs gems excluding those specified in the production group
Detailed Academic Explanation:
Installs gems excluding those specified in the production group is the correct answer to “What is the purpose of the bundle install --without production command in Ruby projects”. This question is standard in competitive examination syllabi for Ruby Gems.
💡Key Conceptual Anchor:Ruby Gems
Question 25 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What does the gem yank gem_name --version version_number command do in Ruby?
Correct Answer: Option C — Removes a specific version of a gem from the gem repository
Detailed Academic Explanation:
Removes a specific version of a gem from the gem repository is the correct answer to “What does the gem yank gem_name --version version_number command do in Ruby”. This question is standard in competitive examination syllabi for Ruby Gems.
💡Key Conceptual Anchor:Ruby Gems
Question 26 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the purpose of the gem outdated command in Ruby?
Correct Answer: Option D — Lists installed gems that have newer versions available
Detailed Academic Explanation:
Lists installed gems that have newer versions available is the correct answer to “What is the purpose of the gem outdated command in Ruby”. This question is standard in competitive examination syllabi for Ruby Gems.
💡Key Conceptual Anchor:Ruby Gems
Question 27 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What does the gem pristine --all command do in Ruby?
Correct Answer: Option B — Restores all installed gems to their pristine condition
Detailed Academic Explanation:
Restores all installed gems to their pristine condition is the correct answer to “What does the gem pristine --all command do in Ruby”. This question is standard in competitive examination syllabi for Ruby Gems.
💡Key Conceptual Anchor:Ruby Gems
Question 28 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the purpose of the --development flag when updating gems using Bundler?
Correct Answer: Option A — Updates development dependencies along with regular dependencies
Detailed Academic Explanation:
Updates development dependencies along with regular dependencies is the correct answer to “What is the purpose of the --development flag when updating gems using Bundler”. This question is standard in competitive examination syllabi for Ruby Gems.
💡Key Conceptual Anchor:Ruby Gems
Question 29 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What does the gem list --local command do in Ruby?
Correct Answer: Option D — Lists gems installed locally
Detailed Academic Explanation:
Lists gems installed locally is the correct answer to “What does the gem list --local command do in Ruby”. This question is standard in competitive examination syllabi for Ruby Gems.
💡Key Conceptual Anchor:Ruby Gems
Question 30 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the purpose of the bundle exec command in Ruby projects?
Correct Answer: Option C — Executes a command in the context of the current project's Gemfile
Detailed Academic Explanation:
Executes a command in the context of the current project's Gemfile is the correct answer to “What is the purpose of the bundle exec command in Ruby projects”. This question is standard in competitive examination syllabi for Ruby Gems.
💡Key Conceptual Anchor:Ruby Gems
Question 31 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What does the gem fetch gem_name command do in Ruby?
Correct Answer: Option B — Downloads the gem file without installing it
Detailed Academic Explanation:
Downloads the gem file without installing it is the correct answer to “What does the gem fetch gem_name command do in Ruby”. This question is standard in competitive examination syllabi for Ruby Gems.
💡Key Conceptual Anchor:Ruby Gems
Question 32 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which command is used to check the details of a specific gem version in Ruby?
Correct Answer: Option C — gem spec gem_name -v version_number
Detailed Academic Explanation:
gem spec gem_name -v version_number is the correct answer to “Which command is used to check the details of a specific gem version in Ruby”. This question is standard in competitive examination syllabi for Ruby Gems.
💡Key Conceptual Anchor:Ruby Gems
Question 33 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the purpose of the gem dependency gem_name command in Ruby?
Correct Answer: Option D — Lists all dependencies of a specified gem
Detailed Academic Explanation:
Lists all dependencies of a specified gem is the correct answer to “What is the purpose of the gem dependency gem_name command in Ruby”. This question is standard in competitive examination syllabi for Ruby Gems.
💡Key Conceptual Anchor:Ruby Gems
Question 34 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What does the gem uninstall gem_name -v version_number command do in Ruby?
Correct Answer: Option A — Uninstalls a specific version of a gem
Detailed Academic Explanation:
Uninstalls a specific version of a gem is the correct answer to “What does the gem uninstall gem_name -v version_number command do in Ruby”. This question is standard in competitive examination syllabi for Ruby Gems.
💡Key Conceptual Anchor:Ruby Gems
Question 35 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which command is used to open the documentation for a specific gem in Ruby?
Correct Answer: Option D — gem open gem_name
Detailed Academic Explanation:
gem open gem_name is the correct answer to “Which command is used to open the documentation for a specific gem in Ruby”. This question is standard in competitive examination syllabi for Ruby Gems.
💡Key Conceptual Anchor:Ruby Gems
Question 36 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the purpose of the --no-document flag when installing gems using Bundler?
Correct Answer: Option C — Skips generating documentation for installed gems
Detailed Academic Explanation:
Skips generating documentation for installed gems is the correct answer to “What is the purpose of the --no-document flag when installing gems using Bundler”. This question is standard in competitive examination syllabi for Ruby Gems.
💡Key Conceptual Anchor:Ruby Gems
Question 37 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What does the gem install gemfile command do in Ruby?
Correct Answer: Option B — Installs a gem using the specified gemfile
Detailed Academic Explanation:
Installs a gem using the specified gemfile is the correct answer to “What does the gem install gemfile command do in Ruby”. This question is standard in competitive examination syllabi for Ruby Gems.
💡Key Conceptual Anchor:Ruby Gems
Question 38 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which command is used to list outdated gems and their dependencies in Ruby?
Correct Answer: Option A — gem outdated --all
Detailed Academic Explanation:
gem outdated --all is the correct answer to “Which command is used to list outdated gems and their dependencies in Ruby”. This question is standard in competitive examination syllabi for Ruby Gems.
💡Key Conceptual Anchor:Ruby Gems
Question 39 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the purpose of the gem install gem_name -N command in Ruby?
Correct Answer: Option D — Installs the gem without documentation
Detailed Academic Explanation:
Installs the gem without documentation is the correct answer to “What is the purpose of the gem install gem_name -N command in Ruby”. This question is standard in competitive examination syllabi for Ruby Gems.
💡Key Conceptual Anchor:Ruby Gems
Question 40 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the purpose of the gem environment gemdir command in Ruby?
Correct Answer: Option D — Displays the directory where gems are installed
Detailed Academic Explanation:
Displays the directory where gems are installed is the correct answer to “What is the purpose of the gem environment gemdir command in Ruby”. This question is standard in competitive examination syllabi for Ruby Gems.
💡Key Conceptual Anchor:Ruby Gems
✓Link copied to clipboard
Continue Your Practice
Advance Html — Part 1
Master the next curriculum module with 40 exam-standard MCQs.
💡Examiner's Advisory for Programming & Software Development
In competitive commission exams (FPSC, PPSC, KPPSC, SPSC, CSS, PMS), questions are frequently phrased with distractor options designed to catch rote learners. Whenever you answer an MCQ, read the Detailed Academic Explanation and Conceptual Anchor to understand why the remaining options are incorrect.