Object Oriented Programming _Oop_ Concepts In Ruby MCQs with Explanations
Practice high-yield Programming & Software Development MCQs on Object Oriented Programming _Oop_ Concepts In Ruby with worked academic solutions for FPSC, PPSC, NTS, NITB, PTS.
Questions
35
Difficulty Level
Exam-Level
Target Exams
FPSC, PPSC, NTS...
Estimated Time
42 mins
Exam-Level FPSC PPSC NTS NITB PTS
Verified for Commission Syllabus • Oct 14, 2026
35
Verified Practice Questions
Interactive test mode with detailed academic worked solutions
Live Progress|0/35 answered
✓0 correct
✗0 wrong
0% score
🎉 Set complete! All 35 questions answered.
Question 1 of 35
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is a class in Ruby?
Correct Answer: Option A — A blueprint for objects
Detailed Academic Explanation:
A blueprint for objects is the correct answer to “What is a class in Ruby”. This question is standard in competitive examination syllabi for Object Oriented Programming _Oop_ Concepts In Ruby.
💡Key Conceptual Anchor:Object Oriented Programming _Oop_ Concepts In Ruby
Question 2 of 35
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which keyword is used to define a class in Ruby?
Correct Answer: Option A — class
Detailed Academic Explanation:
class is the correct answer to “Which keyword is used to define a class in Ruby”. This question is standard in competitive examination syllabi for Object Oriented Programming _Oop_ Concepts In Ruby.
💡Key Conceptual Anchor:Object Oriented Programming _Oop_ Concepts In Ruby
Question 3 of 35
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What does the initialize method do in a Ruby class?
Correct Answer: Option D — Initializes new objects
Detailed Academic Explanation:
Initializes new objects is the correct answer to “What does the initialize method do in a Ruby class”. This question is standard in competitive examination syllabi for Object Oriented Programming _Oop_ Concepts In Ruby.
💡Key Conceptual Anchor:Object Oriented Programming _Oop_ Concepts In Ruby
Question 4 of 35
★ FPSC
★ PPSC
★ FPSC
★ PPSC
In Ruby, what is an object?
Correct Answer: Option A — An instance of a class
Detailed Academic Explanation:
An instance of a class is the correct answer to “In Ruby, what is an object”. This question is standard in competitive examination syllabi for Object Oriented Programming _Oop_ Concepts In Ruby.
💡Key Conceptual Anchor:Object Oriented Programming _Oop_ Concepts In Ruby
Question 5 of 35
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which method is used to create a new instance of a class in Ruby?
Correct Answer: Option A — new
Detailed Academic Explanation:
new is the correct answer to “Which method is used to create a new instance of a class in Ruby”. This question is standard in competitive examination syllabi for Object Oriented Programming _Oop_ Concepts In Ruby.
💡Key Conceptual Anchor:Object Oriented Programming _Oop_ Concepts In Ruby
Question 6 of 35
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the purpose of the attr_accessor method in Ruby classes?
Correct Answer: Option A — To define both reader and writer methods for class attributes
Detailed Academic Explanation:
To define both reader and writer methods for class attributes is the correct answer to “What is the purpose of the attr_accessor method in Ruby classes”. This question is standard in competitive examination syllabi for Object Oriented Programming _Oop_ Concepts In Ruby.
💡Key Conceptual Anchor:Object Oriented Programming _Oop_ Concepts In Ruby
Question 7 of 35
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which keyword is used to refer to the current instance of a class in Ruby?
Correct Answer: Option A — self
Detailed Academic Explanation:
self is the correct answer to “Which keyword is used to refer to the current instance of a class in Ruby”. This question is standard in competitive examination syllabi for Object Oriented Programming _Oop_ Concepts In Ruby.
💡Key Conceptual Anchor:Object Oriented Programming _Oop_ Concepts In Ruby
Question 8 of 35
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the purpose of inheritance in Ruby classes?
Correct Answer: Option A — To allow a class to inherit properties and behaviors from another class
Detailed Academic Explanation:
To allow a class to inherit properties and behaviors from another class is the correct answer to “What is the purpose of inheritance in Ruby classes”. This question is standard in competitive examination syllabi for Object Oriented Programming _Oop_ Concepts In Ruby.
💡Key Conceptual Anchor:Object Oriented Programming _Oop_ Concepts In Ruby
Question 9 of 35
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is encapsulation in Ruby classes?
Correct Answer: Option A — The bundling of data with the methods that operate on that data
Detailed Academic Explanation:
The bundling of data with the methods that operate on that data is the correct answer to “What is encapsulation in Ruby classes”. This question is standard in competitive examination syllabi for Object Oriented Programming _Oop_ Concepts In Ruby.
💡Key Conceptual Anchor:Object Oriented Programming _Oop_ Concepts In Ruby
Question 10 of 35
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which method is called automatically when an object is created in Ruby?
Correct Answer: Option A — initialize
Detailed Academic Explanation:
initialize is the correct answer to “Which method is called automatically when an object is created in Ruby”. This question is standard in competitive examination syllabi for Object Oriented Programming _Oop_ Concepts In Ruby.
💡Key Conceptual Anchor:Object Oriented Programming _Oop_ Concepts In Ruby
Question 11 of 35
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What does the super keyword do in a Ruby class?
Correct Answer: Option A — Calls the same method in the superclass
Detailed Academic Explanation:
Calls the same method in the superclass is the correct answer to “What does the super keyword do in a Ruby class”. This question is standard in competitive examination syllabi for Object Oriented Programming _Oop_ Concepts In Ruby.
💡Key Conceptual Anchor:Object Oriented Programming _Oop_ Concepts In Ruby
Question 12 of 35
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the following is a correct way to define a class method in Ruby?
Correct Answer: Option A — def self.method_name
Detailed Academic Explanation:
def self.method_name is the correct answer to “Which of the following is a correct way to define a class method in Ruby”. This question is standard in competitive examination syllabi for Object Oriented Programming _Oop_ Concepts In Ruby.
💡Key Conceptual Anchor:Object Oriented Programming _Oop_ Concepts In Ruby
Question 13 of 35
★ FPSC
★ PPSC
★ FPSC
★ PPSC
In Ruby, what does the extend keyword do?
Correct Answer: Option A — Adds methods from a module as class methods
Detailed Academic Explanation:
Adds methods from a module as class methods is the correct answer to “In Ruby, what does the extend keyword do”. This question is standard in competitive examination syllabi for Object Oriented Programming _Oop_ Concepts In Ruby.
💡Key Conceptual Anchor:Object Oriented Programming _Oop_ Concepts In Ruby
Question 14 of 35
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What does the self keyword refer to in Ruby classes?
Correct Answer: Option C — The class itself
Detailed Academic Explanation:
The class itself is the correct answer to “What does the self keyword refer to in Ruby classes”. This question is standard in competitive examination syllabi for Object Oriented Programming _Oop_ Concepts In Ruby.
💡Key Conceptual Anchor:Object Oriented Programming _Oop_ Concepts In Ruby
Question 15 of 35
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the purpose of the attr_reader method in Ruby classes?
Correct Answer: Option A — To define getter methods for class attributes
Detailed Academic Explanation:
To define getter methods for class attributes is the correct answer to “What is the purpose of the attr_reader method in Ruby classes”. This question is standard in competitive examination syllabi for Object Oriented Programming _Oop_ Concepts In Ruby.
💡Key Conceptual Anchor:Object Oriented Programming _Oop_ Concepts In Ruby
Question 16 of 35
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which keyword is used to access methods and variables within the same class in Ruby?
Correct Answer: Option B — self
Detailed Academic Explanation:
self is the correct answer to “Which keyword is used to access methods and variables within the same class in Ruby”. This question is standard in competitive examination syllabi for Object Oriented Programming _Oop_ Concepts In Ruby.
💡Key Conceptual Anchor:Object Oriented Programming _Oop_ Concepts In Ruby
Question 17 of 35
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the purpose of the attr_writer method in Ruby classes?
Correct Answer: Option A — To define setter methods for class attributes
Detailed Academic Explanation:
To define setter methods for class attributes is the correct answer to “What is the purpose of the attr_writer method in Ruby classes”. This question is standard in competitive examination syllabi for Object Oriented Programming _Oop_ Concepts In Ruby.
💡Key Conceptual Anchor:Object Oriented Programming _Oop_ Concepts In Ruby
Question 18 of 35
★ FPSC
★ PPSC
★ FPSC
★ PPSC
In Ruby, what is a superclass?
Correct Answer: Option A — The class from which a class inherits
Detailed Academic Explanation:
The class from which a class inherits is the correct answer to “In Ruby, what is a superclass”. This question is standard in competitive examination syllabi for Object Oriented Programming _Oop_ Concepts In Ruby.
💡Key Conceptual Anchor:Object Oriented Programming _Oop_ Concepts In Ruby
Question 19 of 35
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which keyword is used to define an instance method in Ruby?
Correct Answer: Option C — def
Detailed Academic Explanation:
def is the correct answer to “Which keyword is used to define an instance method in Ruby”. This question is standard in competitive examination syllabi for Object Oriented Programming _Oop_ Concepts In Ruby.
💡Key Conceptual Anchor:Object Oriented Programming _Oop_ Concepts In Ruby
Question 20 of 35
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which method is called when an object is garbage collected in Ruby?
Correct Answer: Option D — initialize
Detailed Academic Explanation:
initialize is the correct answer to “Which method is called when an object is garbage collected in Ruby”. This question is standard in competitive examination syllabi for Object Oriented Programming _Oop_ Concepts In Ruby.
💡Key Conceptual Anchor:Object Oriented Programming _Oop_ Concepts In Ruby
Question 21 of 35
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What does the protected keyword do in Ruby classes?
Correct Answer: Option A — Allows access to methods within the class and its subclasses
Detailed Academic Explanation:
Allows access to methods within the class and its subclasses is the correct answer to “What does the protected keyword do in Ruby classes”. This question is standard in competitive examination syllabi for Object Oriented Programming _Oop_ Concepts In Ruby.
💡Key Conceptual Anchor:Object Oriented Programming _Oop_ Concepts In Ruby
Question 22 of 35
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the purpose of method overriding in Ruby?
Correct Answer: Option A — To provide a new implementation for a method in the superclass
Detailed Academic Explanation:
To provide a new implementation for a method in the superclass is the correct answer to “What is the purpose of method overriding in Ruby”. This question is standard in competitive examination syllabi for Object Oriented Programming _Oop_ Concepts In Ruby.
💡Key Conceptual Anchor:Object Oriented Programming _Oop_ Concepts In Ruby
Question 23 of 35
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which keyword is used to define a class method in Ruby?
Correct Answer: Option C — def self.method
Detailed Academic Explanation:
def self.method is the correct answer to “Which keyword is used to define a class method in Ruby”. This question is standard in competitive examination syllabi for Object Oriented Programming _Oop_ Concepts In Ruby.
💡Key Conceptual Anchor:Object Oriented Programming _Oop_ Concepts In Ruby
Question 24 of 35
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What does the super keyword do in a Ruby class method?
Correct Answer: Option A — Calls the same method in the superclass
Detailed Academic Explanation:
Calls the same method in the superclass is the correct answer to “What does the super keyword do in a Ruby class method”. This question is standard in competitive examination syllabi for Object Oriented Programming _Oop_ Concepts In Ruby.
💡Key Conceptual Anchor:Object Oriented Programming _Oop_ Concepts In Ruby
Question 25 of 35
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the purpose of the private keyword in Ruby classes?
Correct Answer: Option A — Restricts access to methods below it
Detailed Academic Explanation:
Restricts access to methods below it is the correct answer to “What is the purpose of the private keyword in Ruby classes”. This question is standard in competitive examination syllabi for Object Oriented Programming _Oop_ Concepts In Ruby.
💡Key Conceptual Anchor:Object Oriented Programming _Oop_ Concepts In Ruby
Question 26 of 35
★ FPSC
★ PPSC
★ FPSC
★ PPSC
In Ruby, what is the purpose of method overloading?
Correct Answer: Option A — To provide multiple definitions for the same method with different parameters
Detailed Academic Explanation:
To provide multiple definitions for the same method with different parameters is the correct answer to “In Ruby, what is the purpose of method overloading”. This question is standard in competitive examination syllabi for Object Oriented Programming _Oop_ Concepts In Ruby.
💡Key Conceptual Anchor:Object Oriented Programming _Oop_ Concepts In Ruby
Question 27 of 35
★ FPSC
★ PPSC
★ FPSC
★ PPSC
In Ruby, what is the purpose of the attr_reader method in a class?
Correct Answer: Option A — To define only getter methods for class attributes
Detailed Academic Explanation:
To define only getter methods for class attributes is the correct answer to “In Ruby, what is the purpose of the attr_reader method in a class”. This question is standard in competitive examination syllabi for Object Oriented Programming _Oop_ Concepts In Ruby.
💡Key Conceptual Anchor:Object Oriented Programming _Oop_ Concepts In Ruby
Question 28 of 35
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is polymorphism in Ruby?
Correct Answer: Option A — The ability for objects of different classes to be treated as objects of a common superclass
Detailed Academic Explanation:
The ability for objects of different classes to be treated as objects of a common superclass is the correct answer to “What is polymorphism in Ruby”. This question is standard in competitive examination syllabi for Object Oriented Programming _Oop_ Concepts In Ruby.
💡Key Conceptual Anchor:Object Oriented Programming _Oop_ Concepts In Ruby
Question 29 of 35
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the difference between a class method and an instance method in Ruby?
Correct Answer: Option A — Class methods are called on the class itself, while instance methods are called on instances of the class
Detailed Academic Explanation:
Class methods are called on the class itself, while instance methods are called on instances of the class is the correct answer to “What is the difference between a class method and an instance method in Ruby”. This question is standard in competitive examination syllabi for Object Oriented Programming _Oop_ Concepts In Ruby.
💡Key Conceptual Anchor:Object Oriented Programming _Oop_ Concepts In Ruby
Question 30 of 35
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which keyword is used to define a private method in a Ruby class?
Correct Answer: Option A — private
Detailed Academic Explanation:
private is the correct answer to “Which keyword is used to define a private method in a Ruby class”. This question is standard in competitive examination syllabi for Object Oriented Programming _Oop_ Concepts In Ruby.
💡Key Conceptual Anchor:Object Oriented Programming _Oop_ Concepts In Ruby
Question 31 of 35
★ FPSC
★ PPSC
★ FPSC
★ PPSC
In Ruby, what is the purpose of the `super` keyword when used in a method?
Correct Answer: Option A — Calls the same method in the superclass
Detailed Academic Explanation:
Calls the same method in the superclass is the correct answer to “In Ruby, what is the purpose of the `super` keyword when used in a method”. This question is standard in competitive examination syllabi for Object Oriented Programming _Oop_ Concepts In Ruby.
💡Key Conceptual Anchor:Object Oriented Programming _Oop_ Concepts In Ruby
Question 32 of 35
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the purpose of the `extend` keyword in Ruby classes?
Correct Answer: Option A — Adds methods from a module as class methods
Detailed Academic Explanation:
Adds methods from a module as class methods is the correct answer to “What is the purpose of the `extend` keyword in Ruby classes”. This question is standard in competitive examination syllabi for Object Oriented Programming _Oop_ Concepts In Ruby.
💡Key Conceptual Anchor:Object Oriented Programming _Oop_ Concepts In Ruby
Question 33 of 35
★ FPSC
★ PPSC
★ FPSC
★ PPSC
In Ruby, which method is used to define getter and setter methods for class attributes?
Correct Answer: Option A — attr_accessor
Detailed Academic Explanation:
attr_accessor is the correct answer to “In Ruby, which method is used to define getter and setter methods for class attributes”. This question is standard in competitive examination syllabi for Object Oriented Programming _Oop_ Concepts In Ruby.
💡Key Conceptual Anchor:Object Oriented Programming _Oop_ Concepts In Ruby
Question 34 of 35
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the purpose of encapsulation in Ruby classes?
Correct Answer: Option A — To hide the internal state of an object and restrict access to it
Detailed Academic Explanation:
To hide the internal state of an object and restrict access to it is the correct answer to “What is the purpose of encapsulation in Ruby classes”. This question is standard in competitive examination syllabi for Object Oriented Programming _Oop_ Concepts In Ruby.
💡Key Conceptual Anchor:Object Oriented Programming _Oop_ Concepts In Ruby
Question 35 of 35
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the purpose of inheritance in Ruby?
Correct Answer: Option A — To allow a class to inherit properties and behaviors from another class
Detailed Academic Explanation:
To allow a class to inherit properties and behaviors from another class is the correct answer to “What is the purpose of inheritance in Ruby”. This question is standard in competitive examination syllabi for Object Oriented Programming _Oop_ Concepts In Ruby.
💡Key Conceptual Anchor:Object Oriented Programming _Oop_ Concepts In Ruby
✓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.