1. A designer comes to you and asks you to make a level design tool for them so that they don’t have to worry about the code. This scenario is a perfect example of which OOPS concept?
2. For an NPC behaviour system, which among the following could be used as an example for runtime polymorphism?
3. Why is a Service class used for a gameObject? 1. It is responsible for the creation of gameObject. 2. To interact with other services. 3. It holds references for MVC classes to perform operations on them.
4. Which of these is true about Extension Functions. 1. Extension Functions are used to add/extend custom functionality to pre-existing classes in C#. 2. Extension methods are static methods. 3. Extension methods are not in scope when you explicitly import the namespace into your source code with a using directive.
5. Which of the following feature is not in the general definition of OOPs?
6. Which of these is correct: 1. All logic for different states should be implemented in a single class. 2. Different states should have different classes. 3. States must not inherit from any base class to make our life easier. 4. States must inherit from the same base class to make our life easier.
7. Which header file contains the declaration of cin and cout classes?
8. Which among the following feature is not in the general definition of OOPs?
9. Which of these is true about Interfaces in C# 1. It helps in achieving a functionality similar to multiple inheritances 2. It acts as a medium between user and program 3. A class can inherit from only one interface 4. A class can inherit from multiple interfaces
10. Why don't we use Model and Controller as MonoBehaviours? * 1. MonoBehaviour cannot be used in this situation. 2. MonoBehaviour is a huge class and can use up a lot of memory. 3. MonoBehaviour classes cannot be accessed if they're not attached to a gameObject. 4. We can accomplish all the intended functionality without using a MonoBehaviour.
11. Which of these is true about Interfaces in C#? 1. It helps in achieving a functionality similar to multiple inheritance 2. It acts as a medium between user and program 3. A class can inherit from only one interface 4. A class can inherit from multiple interfaces
12. How Encapsulation is achieved in C++?
13. What is the advantage of using the provided event architecture instead of directly invoking a C# event inside respective classes in a game project?
14. It seems like using the State Pattern always increases the number of classes in your designs. Look how many more classes your Enemy Controller has than the original design! So why should we use the State Pattern instead of implementing the whole logic in EnemyController itself?
15. Which of the following are correct? 1. Function overloading is an example of Runtime Polymorphism. 2. Function overriding is an example of Compile Time Polymorphism. 3. Function overloading can be achieved by changing the return type of function.
16. What is the purpose of type parameters in generic classes or methods?
17. Which of the below definitions best describes Abstraction?
18. How does the communication flow between classes occur when processing a command in game development?
19. In the UnitCommand abstract class, which methods must be implemented by concrete subclasses?
20. Which analogy accurately describes the concept of abstraction in object-oriented programming?
21. For which of the following situations is abstraction most useful?
22. What is Encapsulation?
23. How can the concept of encapsulation be achieved in the program?
24. What is abstraction in object-oriented programming?
25. Which analogy most accurately describes Encapsulation?
26. In which situation is Encapsulation needed the most?
27. How is Abstraction achieved in C++?
28. Which statement explains Encapsulation in the context of the Player Ship?
29. Abstraction vs Encapsulation - How are they different?
30. Which of the following variable violates the definition of encapsulation?
31. What is the primary reason for creating classes in object-oriented programming?
32. What is Inheritance in C++?
33. In C++, which real-life scenario correctly illustrates the concept of multiple inheritance?
34. What is the main difference between multilevel inheritance and multiple inheritance?
35. What type of inheritance is being demonstrated in the following code? public class NPC { public void speak() { Console.WriteLine("Speaking"); } } public class Villager : NPC { public void trade() { Console.WriteLine("Trading"); } } public class Monster : NPC { public void attack() { Console.WriteLine("Attacking"); } }
36. While building a class Spaceship, which member function should have been protected: (Choose wisely, as protected is only used to restrict access within the class and its subclasses) #include <iostream> class Spaceship { private: int fuelCapacity; int currentFuel; int engineTemperature; void UpdateEngineTemperature() { engineTemperature += 10; } public: Spaceship(int fuelCapacity) : fuelCapacity(fuelCapacity), currentFuel(0), engineTemperature(0) {} void AddFuel(int amount) { currentFuel += amount; } void FireWeapon() { std::cout << "Firing weapon!" << std::endl; } int CalculateRemainingDistance() { return currentFuel * 10; } void DisplayStatus() { std::cout << "Fuel Capacity: " << fuelCapacity << std::endl; std::cout << "Current Fuel: " << currentFuel << std::endl; std::cout << "Engine Temperature: " << engineTemperature << std::endl; } }; class BattleSpaceship : public Spaceship { public: BattleSpaceship(int fuelCapacity) : Spaceship(fuelCapacity) {} void EngageEnemy() { FireWeapon(); } }; int main() { BattleSpaceship myBattleSpaceship(1000); myBattleSpaceship.AddFuel(100); myBattleSpaceship.EngageEnemy(); myBattleSpaceship.DisplayStatus(); return 0; }
37. What is the purpose of Inheritance in creating separate enemies?
38. Which of the following is incorrect about polymorphism?
39. How can the concept of encapsulation be applied to UI elements in a game?
40. What is the main reason for segregation of UI Classes?
41. Choose the odd one out and explain why: Multiple Inheritance, Multilevel Inheritance, Distributed Inheritance, Hierarchial Inheritance,
42. Why do we need relationships between classes?
43. Which type of polymorphism is resolved at compile time?
44. Function overloading is an example of Runtime Polymorphism. 1. Function overloading is an example of Runtime Polymorphism. 2. Function overriding is an example of Compile Time Polymorphism. 3. Function overloading can be achieved by changing the return type of function.
45. Which of the following statements is true regarding static and dynamic polymorphism?
46. What is the difference between Enum classes and traditional Enums:
47. Why is the GameState current_state variable declared as static instead of const, after all it should be consistent for all other component classes
48. How do constructors in base and derived classes affect an object’s initialization in C++?
49. In a game developed using with C++, you have a base class Enemy and derived classes Orc and Troll. Both Orc and Troll share some methods from another class Knife. How can you design this inheritance to maintain a clean structure and avoid duplication
50. - Explain the chain of inheritance with one of the option Vehicle → Four Wheel → Car A)** Every Car object **IS-A** Four wheeler object and Every Four Wheeler **IS-A** Car B) Every Vehicle object is **not** a ****Four Wheeler object but every Four Wheeler Object **IS-A** Vehicle C) Every Car object **IS-A** Four Wheeler object and every Four Wheeler object **IS-A** Vehicle Object D) Every Four Wheeler Has-A Car and Every Vehicle IS-A Car
51. What is the primary issue caused by the diamond problem in C++ inheritance?
52. Why have we not done inheritance for Enemy View and Model?
53. Which feature of OOPS describes re-usability of code?
54. How does an interface relate to the concept of inheritance?
55. How do interfaces and abstract classes differ in defining blueprints for derived classes in C++?
56. How do interfaces enable polymorphism?
57. static_cast can perform conversions between pointers to related classes not only from the derived class to its base, but also from a base class to its derived
58. You have two classes, Glass and Frame. You need to create a new class Sunglasses. Logically which type of inheritance should you use?
59. In the following code, what is the access type for inheritance in the Sorcerer class from the Player class? class Sorcerer: Player {};
60. Which type of relationship is modelled by Inheritance?
A. Abstraction
B. Inheritance
C. Polymorphism
D. Encapsulation
A. Setting up two different Dodge functions taking different arguments in the same NPC class
B. Setting up different Dodge implementations for different NPC classes separate from the Dodge implementation of the NPC base class
C. Adding more functionalities to specific NPCs
A. 1,2
B. 2,3
C. 1,3
D. All of the above.
A. 1,2,3
B. 2,3
C. 1,2
D. 1,3
A. Code reusability
B. Modularity
C. Duplicate/Redundant data
D. Efficient Code
A. 1,3
B. 1,4
C. 2,3
D. 2,4
A. system
B. stdlib
C. iostream
D. stdio
A. Code Reusability
B. Modularity
C. Duplicate/Redundant Data
D. Efficient Code
A. 1 & 2
B. 1 & 3
C. 1, 2 & 3
D. 1 & 4
A. 1,2,3
B. 2,4
C. 2,3,4
D. 1,4
A. 1,2
B. 1,3
C. 1,2,3
D. 1,4
A. by using private members
B. by using protected Members
C. by using access specifiers
D. by using the concept of abstraction
A. Increased performance and reduced memory usage
B. Improved code organization and maintainability
C. Simpler implementation and reduced complexity
D. Easier integration with third-party libraries and frameworks
A. The State Pattern allows us to create separate classes for each state of an object, promoting modularity. This modular approach makes it easier to manage complex behaviors, update them, and add new states without affecting existing code.
B. If we implement the whole logic in EnemyController instead, we will end up with very large, monolithic conditional statements. This makes our code hard to maintain and understand.
C. By using separate classes for states, we make states explicit and reduce the effort needed to understand and maintain our code.
D. All of the Above.
A. 1, 3
B. 2, 3
C. 2
D. None of the above
A. To specify the access modifier of the class or method
B. To define the base class for the generic class or method
C. To allow the use of different types in the class or method
D. To determine the visibility of the class or method
A. Hides the important data
B. Hides the implementation and showing only the features
C. Hiding the implementation
D. Showing the important data
A. GameService -> PlayerService -> PlayerController -> UnitController -> CommandInvoker
B. UnitController -> PlayerController -> GameService -> PlayerService
C. PlayerController -> UnitController -> CommandInvoker -> GameService
D. CommandInvoker -> GameService -> PlayerService -> PlayerController
A. Execute() and PerformAction()
B. Execute() and WillHitTarget()
C. ExecuteCommand() and Execute()
D. Perform() and WillHitTarget()
A. Like a car's dashboard, which hides the complex engine parts and mechanics from the driver, only showing essential controls and information.
B. Like opening the hood of a car and examining every engine part while driving.
C. Like painting a picture where every brushstroke is visible and detailed for the viewer.
D. Like writing a book where every character's thoughts are fully exposed in every chapter.
A. When you want to expose every detail of how a system works to the end-user.
B. When you need to speed up the system by removing unnecessary features.
C. When you want all objects to interact without any access restrictions.
D. When you want to simplify the interaction with a complex system by hiding its internal processes.
A. The process of increasing the speed of execution in a program by grouping random functions together.
B. The technique of storing data in large databases to improve retrieval.
C. The practice of bundling related data or methods within a single unit or component.
D. The method of writing code directly inside the main function to ensure it runs faster.
A. By using the Access specifiers
B. By using the concept of Abstraction
C. By using only private members
D. By using the concept of Inheritance
A. A technique to ensure that all objects share the same properties and methods.
B. A design principle that hides complex details from the user, providing a simpler interface.
C. A process of creating multiple copies of the same function.
D. The conversion of real-world entities into digital form.
A. Like a toolbox where all tools are thrown in without any order.
B. Like a capsule that neatly contains all its ingredients, keeping them together and protected from the outside.
C. Like a library where books are scattered all around the place.
D. Like an open basket where items can be added or removed randomly by anyone.
A. When functions and data need to be exposed completely to ensure all parts of the program can interact without restrictions.
B. When performance is the sole concern, and code clarity or structure is not prioritized.
C. When there is no interaction between different parts of the program, and everything operates independently.
D. When you need to group related properties and methods into a coherent structure.
A. By using private members, ensuring that data is accessible only within the class itself.
B. By using access specifiers, such as private, protected, and public, to control the visibility of class members.
C. By hiding complex implementation details and exposes only essential features.
D. By creating getter and setter methods for class variables, allowing controlled access to private data.
A. Encapsulation allows the Player Ship to modify game settings and control global variables directly.
B. Encapsulation groups all properties and methods related to the Player Ship into the Player class.
C. Encapsulation requires that all code be written in a single function for the Player Ship.
D. Encapsulation ensures that all players in the game share the same attributes and methods.
A. Abstraction hides the complex implementation details from the user, while Encapsulation groups related data and functions into a single unit to prevent direct access.
B. Abstraction groups related data and functions into a single unit, while Encapsulation hides the complex implementation details from the user.
C. Abstraction and Encapsulation both involve writing all code in a single block to simplify debugging.
D. Abstraction speeds up the execution, while Encapsulation slows it down by adding more layers.
A. Array variables
B. Local variables
C. Global variables
D. Public variables
A. To improve code organization and readability
B. To implement complex algorithms
C. To increase program performance
D. To reduce the number of lines of code
A. Wrapping of data into a single class
B. Deriving new classes from existing classes
C. Overloading of classes
D. Classes with same names
A. Fish Class: A Fish class inherits from Ocean and Swimmer classes
B. Electric Car Class: A Electric Car class inherits from both Vehicle and Electronics classes.
C. Motorboat Class: A Motorboat class inherits from Boat and Water classes,
D. Library Class: A Library class inherits from Book and Patron classes
A. Multilevel inheritance allows a class to inherit from more than one base class, while multiple inheritance allows inheritance from a base class and its derived classes.
B. Multilevel inheritance allows a class to inherit from a base class and then this child class can act as a base class for another class, this creates a chain, while multiple inheritance allows a class to inherit from two or more classes simultaneously.
C. Multilevel inheritance is used only in C++, while multiple inheritance is used only in C#.
D. There is no difference; both describe the same inheritance pattern.
A. Single Inheritance
B. Multiple Inheritance
C. Multilevel Inheritance
D. Hierarchical Inheritance
A. CalculateRemainingDistance()
B. AddFuel()
C. UpdateEngineTemperature()
D. FireWeapon()
A. It allows to reuse the code for shared behaviour
B. Helps to reduce code architecture
C. Helps to keep functionality hidden from other classes
D. Doesn’t have any specific purpose, just felt cool😎
A. Polymorphism helps in redefining the same functionality
B. Polymorphism concept is the feature of object-oriented programming (OOP)
C. Polymorphism always increases the overhead of function definition
D. Code gains more flexibility
A. By exposing all UI elements directly to the game logic for easy manipulation.
B. By wrapping the internal details of UI elements within classes and providing controlled access through methods.
C. By creating global variables for each UI element to allow easy access from any part of the code.
D. By directly modifying the properties of UI elements without encapsulating them within classes.
A. It allows to add abstraction in code base
B. It helps to follow Single Responsibility so that individual class only works on individual feature
C. It helps to follow Polymorphism in the code base
D. We should have kept everything in one class
A. Multiple Inheritance, because it allows a class to inherit from more than one base class, which is not supported by some OOP languages like Java.
B. Multilevel Inheritance, because it involves creating a new class from a derived class, forming a multi-tiered hierarchy.
C. Hierarchical Inheritance, because it involves multiple classes inheriting from a single base class, unlike the others that suggest a different structure.
D. Distributed Inheritance, because there is no such standard inheritance model in object-oriented programming.
A. To use the functionality of one class into other
B. To enhance the communication between classes
C. To increase code re-usability
D. All of the mentioned
A. Dynamic Polymorphism
B. Static Polymorphism
C. Polymorphism cannot be resolved at compile time
D. Both Static and Dynamic Polymorphism are resolved at compile time
A. 1, 3
B. 2, 3
C. 2
D. None of the above
A. Static polymorphism occurs at runtime.
B. Dynamic polymorphism is implemented through method overloading.
C. Static polymorphism is resolved by the program during execution.
D. Dynamic polymorphism is achieved through inheritance and virtual functions.
A. Enum classes provide scoped access to enumerators, ensuring unique names within their respective scope, while traditional enums leak enumerators into the enclosing scope.
B. Enum classes require explicit casting for type conversion, enhancing code robustness, whereas traditional enums implicitly convert to integers, increasing the risk of unintended conversions.
C. Enum classes support forward declaration and explicit underlying types, facilitating better code organization, whereas traditional enums lack these features.
D. All of the above
A. Because static ensures there is one shared state that can be updated globally, reflecting the current phase of the game across all components.
B. Because const would prevent the game from transitioning between states, such as from MAIN_MENU to GAMEPLAY, which is necessary for dynamic game flow.
C. To enable game components to modify current_state independently, ensuring personalized game experiences for different players.
D. Because static variables are easier to initialize and manage within large-scale game architectures compared to const variables.
A. Constructors of a derived class replace constructors from the base class, erasing the base class's properties.
B. The constructor of the base class must always be called explicitly in the derived class's constructor.
C. The base class constructor is called automatically before the derived class's constructor to ensure the whole object is properly initialized.
D. Constructors are not inherited; thus, the base class's constructor is ignored.
A. A, B, C, D
B. B, C
C. A, B
D. B, C, D
A. Namespace pollution
B. Multiple copies of the base class are created in the derived class
C. Memory leaks
D. Increased compilation time
A. We should have done that, it’s a design flaw
B. It doesn’t follow OOPS Concepts
C. Because Enemy View and Model although work towards a common goal of making the Enemy, but they don’t have a Parent-Child relation with each other
D. None of the above
A. Abstraction
B. Encapsulation
C. Polymorphism
D. Inheritance
A. An interface acts as a parent class, inheriting properties and methods from its child classes.
B. Interfaces provide a mechanism for multiple inheritance, enabling a class to inherit from multiple interfaces.
C. Interfaces establish a contract for derived classes, specifying a set of methods that must be implemented.
D. Inheritance enables an interface to define the implementation details of its derived classes.
A. Interfaces specify method declarations for derived classes to implement, while abstract classes can also include method implementations.
B. Interfaces allow for multiple inheritance, whereas abstract classes are limited to single inheritance.
C. Abstract classes impose stricter requirements on derived classes, while interfaces offer more flexibility.
D. Both serve the purpose of defining blueprints for derived classes, with interfaces focusing on method declarations and abstract classes allowing method implementations.
A. By defining common behaviors through abstract methods.
B. By hiding class implementation details.
C. By establishing hierarchical class structures.
D. By supporting multiple inheritance.
A. Single Inheritance
B. Multiple Inheritance
C. Multilevel Inheritance
D. Hierarchical Inheritance
A. Private
B. Protected
C. Public
D. Decided on runtime
A. Is-A relationship
B. Has-A relationship
C. Part-Of relationship
D. Belongs-to relationship
OOPS stands for Object Oriented Programming System. OOPS is the programming language based on the concepts of objects where data and code are present. Data is present in the form of fields and code is present in the form procedures.
Here are some of the core concepts of OOPS:
Object Oriented Programming (OOP) concepts are one the essential parts of modern programming and being a master is important for creating robust, scalable, and maintainable code. OOPS mcq questions help you to apply its concepts in practical scenarios. Regular practice with oops concept mcq sharpens individual problem-solving skills and helps them to clear their technical interview rounds as well.