Skip to main content

Object Oriented Concept — Part 1 MCQs with Explanations

Practice high-yield Programming & Software Development MCQs on Object Oriented Concept — 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
Question 1 of 40
★ FPSC ★ PPSC

Which one of the following is not a valid class name?

Question 2 of 40
★ FPSC ★ PPSC

Fill in the blank with the best option. An Object is a/an ________ of a class.

Question 3 of 40
★ FPSC ★ PPSC

Which version of PHP introduced the visibility keywords i.e public, private, and protected?

Question 4 of 40
★ FPSC ★ PPSC

Which characters is used to access property variables on an object-by-object basis?

Question 5 of 40
★ FPSC ★ PPSC

Code that uses a class, function, or method is often described as the.

Question 6 of 40
★ FPSC ★ PPSC

Which keyword precedes a method name?

Question 7 of 40
★ FPSC ★ PPSC

If you omit the visibility keyword in your method declaration, by default the method will be declared as.

Question 8 of 40
★ FPSC ★ PPSC

Inheritance is the means by which one or more classes can be derived from a/an ___ class.

Question 9 of 40
★ FPSC ★ PPSC

What will be the output of the following PHP code? <?php class MyClass { } $a = new MyClass; var_dump(!( $a instanceof stdClass )) ; ?>

Question 10 of 40
★ FPSC ★ PPSC

What should be used to refer to a method in the context of a class rather than an object you use?

Question 11 of 40
★ FPSC ★ PPSC

Prior to which version of PHP did constructors took the name of the enclosing class.

Question 12 of 40
★ FPSC ★ PPSC

A mutator method is also called as.

Question 13 of 40
★ FPSC ★ PPSC

Which version of PHP introduced the static keyword?

Question 14 of 40
★ FPSC ★ PPSC

Which keyword is used to access a static method or property from within the same class(rather than from child)?

Question 15 of 40
★ FPSC ★ PPSC

In which of the following circumstance should you use a static reference to a non static method?

Question 16 of 40
★ FPSC ★ PPSC

Which one of the following variable cannot be used inside a static method?

Question 17 of 40
★ FPSC ★ PPSC

What does PDO stand for?

Question 18 of 40
★ FPSC ★ PPSC

Which keyword is used to declare a constant property?

Question 19 of 40
★ FPSC ★ PPSC

Which one of the following is a constant variable?

Question 20 of 40
★ FPSC ★ PPSC

What will happen if you try to set a value to a constant once it has been declared?

Question 21 of 40
★ FPSC ★ PPSC

How many of the following can be contained in constants? 1. boolean 2. integer 3. float 4. string

Question 22 of 40
★ FPSC ★ PPSC

Which one of the following class can not be instantiated?

Question 23 of 40
★ FPSC ★ PPSC

Which one of the following keywords is used to define an abstract class?

Question 24 of 40
★ FPSC ★ PPSC

Which one of the following is the correct abstract method?

Question 25 of 40
★ FPSC ★ PPSC

Atleast how many abstract methods must an abstract class contain?

Question 26 of 40
★ FPSC ★ PPSC

Which one of the following keyword is used to implement an interface?

Question 27 of 40
★ FPSC ★ PPSC

Which one of the following methods in the exception class, is used to get a nested exception object?

Question 28 of 40
★ FPSC ★ PPSC

Which one of the following keyword is used in conjunction with an Exception object?

Question 29 of 40
★ FPSC ★ PPSC

Which keyword is used to put a stop on inheritance?

Question 30 of 40
★ FPSC ★ PPSC

Which one of the following method is invoked when a value is assigned to an undefined property?

Question 31 of 40
★ FPSC ★ PPSC

Which one of the following method is invoked when an undefined method is called by client code?

Question 32 of 40
★ FPSC ★ PPSC

Which method introduced in PHP 5, is invoked just before an object is garbage collected?

Question 33 of 40
★ FPSC ★ PPSC

Which keyword must be added before $first variable on the third line of the above question to make $second and $first as distinct objects in PHP 5?

Question 34 of 40
★ FPSC ★ PPSC

What will be the output of the following PHP code class Person { function getName () { return "Bob" ; } function getAge () { return 44 ; } function __toString () { $desc = $this-> getName(); $desc . = " ( age ". $this-> getAge () .")"; return $desc; } } $person = new Person () ; print $person;

Question 35 of 40
★ FPSC ★ PPSC

______clone() is run on the _______ object.

Question 36 of 40
★ FPSC ★ PPSC

What will be the output of the following PHP code? class Checkout { final function totalize () { // calculate bill } } class IllegalCheckout extends Checkout { final function totalize () { // change bill calculation } }

Question 37 of 40
★ FPSC ★ PPSC

Which one of the following property scopes is not supported by PHP?

Question 38 of 40
★ FPSC ★ PPSC

Which one of the following is the right way to define a constant?

Question 39 of 40
★ FPSC ★ PPSC

Which of the following is/are the right way to declare a method? 1. function functionName() { function body } 2. scope function functionName() { function body } 3. method methodName() { method body } 4. scope method methodName() { method body }

Question 40 of 40
★ FPSC ★ PPSC

Which of the following method scopes is/are not supported by PHP? 1. private 2. final 3. static 4 abstract

✓ 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 →