Concepts of OOP 1
Concepts of OOP 2
Class Diagram
Access Modifiers
Fill in the Blanks
100

This is the bundling of data and the methods that operate on the data into a single unit called class.

Encapsulation
100

Can be thought of as a template, a prototype or a blueprint of an object

Class

100

This indicates the access level of attributes and methods. Example: +, -, #

Visibility Notations

100

Access modifier which restricts access to the same class only.

Private

100

Complete the object instantiation statement.

Animal dog = new _________();

Animal dog = new Animal();

200

This represents a group of constants.

enums

200

This is a type of variable that has the same value for all the objects based from one class.

Class Variables

200

A whole-part relationship where parts cannot exist independently.

Composition

200

Access modifier which grants unrestricted access from any parts of the program and referencing programs.

Public

200

Declare a static modifier for attribute “maxSpeed”.

______ int maxSpeed;

static int maxSpeed;

300

Which pillar of OOP involves focusing on what an object does rather than how it achieves it?

Abstraction

300

This is used to initialize values of your class variables.

Constructor Method

300

A whole-part relationship where parts can exist independently of the whole.

Aggregation

300

Access modifier which restricts access within the same class and subclasses.

Protected

300

Insert the correct return type for the setID method.

________ setID(int ID){
  this.ID = ID;
}

void setID(int ID){
  this.ID = ID;
}

400

Which pillar of OOP promotes code reuse and establishes a hierarchical relationship between classes?

Inheritance

400

If I have a Car class, what should be the name of my constructor method?

Car

400

The “is-a” relationship between classes where one class derives from another.

Generalization/Inheritance

400

True or False.

Static Classes can be instantiated.

False

400

Complete the constructor.

public Car (______ ______, _____ _____){
  this.brand = brand;
  this.speed = speed;
}

public Car (String brand, int speed){
  this.brand = brand;
  this.speed = speed;
}

500

This pillar of OOP enables objects of different types to be treated as objects of a common type.

Polymorphism

500

These are immutable values which are known at compile time and do not change for the life of the program.

final

500

This relationship is often used in cases where a class realizes the operations defined by an interface.

Realization

500

What is the default access modifier in Java?

Package-Private

500

public class Main{ 

    public static void main(String[] args) { 

       Example.revealSecretCode(); 

    }

}

class Example {   

    ______ String secretCode = "tama na ma'am!";         

    static void revealSecretCode() {       

       System.out.println(secretCode);   

    }

}

static String secretCode = "tama na ma'am!";