Skip to main content

Classes And Objects In Ruby MCQs with Explanations

Practice high-yield Programming & Software Development MCQs on Classes And Objects In Ruby with worked academic solutions for FPSC, PPSC, NTS, NITB, PTS.

Questions
31
Difficulty Level
Exam-Level
Target Exams
FPSC, PPSC, NTS...
Estimated Time
38 mins
Exam-Level FPSC PPSC NTS NITB PTS
Verified for Commission Syllabus • Oct 14, 2026
31

Verified Practice Questions

Interactive test mode with detailed academic worked solutions

Live Progress | 0/31 answered
✓ 0 correct ✗ 0 wrong 0% score
Question 1 of 31
★ FPSC ★ PPSC

What is the keyword used to define a class in Ruby?

Question 2 of 31
★ FPSC ★ PPSC

Which keyword is used to create a new instance of a class in Ruby?

Question 3 of 31
★ FPSC ★ PPSC

How do you define a constructor in Ruby?

Question 4 of 31
★ FPSC ★ PPSC

Which of the following is used to access instance variables in Ruby?

Question 5 of 31
★ FPSC ★ PPSC

What does the attr_accessor method do in Ruby?

Question 6 of 31
★ FPSC ★ PPSC

What is the purpose of the initialize method in Ruby?

Question 7 of 31
★ FPSC ★ PPSC

What is the method used to inherit from a superclass in Ruby?

Question 8 of 31
★ FPSC ★ PPSC

What does the super keyword do in Ruby?

Question 9 of 31
★ FPSC ★ PPSC

What is the method used to check if an object is an instance of a particular class in Ruby?

Question 10 of 31
★ FPSC ★ PPSC

What is the method used to define class methods in Ruby?

Question 11 of 31
★ FPSC ★ PPSC

What is the method used to define instance methods in Ruby?

Question 12 of 31
★ FPSC ★ PPSC

What is the keyword used to refer to the current instance of a class in Ruby?

Question 13 of 31
★ FPSC ★ PPSC

Which method is used to define class variables in Ruby?

Question 14 of 31
★ FPSC ★ PPSC

What does the private keyword do in a Ruby class?

Question 15 of 31
★ FPSC ★ PPSC

What does the protected keyword do in a Ruby class?

Question 16 of 31
★ FPSC ★ PPSC

How do you access instance variables in Ruby?

Question 17 of 31
★ FPSC ★ PPSC

What is the method used to define instance variables in Ruby?

Question 18 of 31
★ FPSC ★ PPSC

Which keyword is used to inherit a class in Ruby?

Question 19 of 31
★ FPSC ★ PPSC

What does the super keyword do in Ruby classes?

Question 20 of 31
★ FPSC ★ PPSC

What is the syntax for defining a class method in Ruby?

Question 21 of 31
★ FPSC ★ PPSC

What is the method used to define a class variable in Ruby?

Question 22 of 31
★ FPSC ★ PPSC

What is the method used to access class variables in Ruby?

Question 23 of 31
★ FPSC ★ PPSC

What is the syntax for defining an instance method in Ruby?

Question 24 of 31
★ FPSC ★ PPSC

Which method is used to define getter and setter methods for instance variables in Ruby?

Question 25 of 31
★ FPSC ★ PPSC

Which keyword is used to call a method on an object in Ruby?

Question 26 of 31
★ FPSC ★ PPSC

What is the syntax for defining a class in Ruby?

Question 27 of 31
★ FPSC ★ PPSC

How do you access class variables in Ruby?

Question 28 of 31
★ FPSC ★ PPSC

What is the method used to define a class method in Ruby?

Question 29 of 31
★ FPSC ★ PPSC

What is the method used to create a new instance of a class in Ruby?

Question 30 of 31
★ FPSC ★ PPSC

What is the method used to access instance variables in Ruby?

Question 31 of 31
★ FPSC ★ PPSC

Which method is used to define a class method in Ruby?

✓ Link copied to clipboard
Continue Your Practice

Advance Html — Part 1

Master the next curriculum module with 40 exam-standard MCQs.

Next Practice Set →

💡 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.

More Modules in Programming & Software Development

View All →
📚

Study Guides

Topic summaries and syllabus breakdown

Explore Guides →
🎯

Complete Library

Search through 78,000+ verified MCQs

Browse Library →
📱

Mobile App

Offline mock tests and instant bookmarks

Get Mobile App →