โ† All B CompE Bachelor of Computer Engineering Flashcard Decks

Bachelor of Computer Engineering Object Oriented Programming Flashcards

7 cards from real B CompE Bachelor of Computer Engineering practice questions. Tap to flip, then mark Knew It or Still Learning โ€” missed cards come back until you master them.

Read the first 7 Bachelor of Computer Engineering Object Oriented Programming flashcards as text
  1. Which design principle states that a class should have only one reason to change?

    Answer: Single Responsibility Principle

    The Single Responsibility Principle (SRP) dictates that each class should encapsulate only one concern so changes to one responsibility don't affect others.

  2. In Java, what does the 'super' keyword do when used in a constructor?

    Answer: Calls the parent class constructor

    'super()' in a constructor explicitly invokes the parent class's constructor and must be the first statement in the subclass constructor.

  3. Which UML relationship represents an 'is-a' association between classes?

    Answer: Generalization

    Generalization (shown as a solid line with a hollow arrowhead) models inheritance, expressing that a subclass 'is-a' type of the superclass.

  4. What is the output of calling a virtual method through a base class pointer pointing to a derived object in C++?

    Answer: Derived class version is called

    Virtual dispatch ensures the most-derived override is called at runtime, which is the core mechanism of polymorphism in C++.

  5. What is the purpose of an abstract class in OOP?

    Answer: To prevent any instantiation and force subclasses to implement certain methods

    Abstract classes serve as templates; they may contain abstract methods that concrete subclasses must implement, and cannot be instantiated directly.

  6. Which concept allows different classes to respond to the same message in different ways?

    Answer: Polymorphism

    Polymorphism lets objects of different types be treated uniformly through a common interface while each class provides its own specific implementation.

  7. In Python, what is a 'dunder' or magic method?

    Answer: A method whose name starts and ends with double underscores

    Dunder methods like __init__, __str__, and __len__ have special meaning to Python and are invoked automatically in specific contexts.

How this page was made: written with AI tools and published by Nathan Beja, founder of Practice Test Geeks, who is responsible for its content. We have not yet matched this exam's facts to an official source, so confirm fees, dates and rules with the exam body. Not reviewed by a subject-matter expert. Editorial policy