OOP Flashcards

1
Q

What is the difference between a class and an object

A

A class is the blueprint to make objects. Objects are an instance of a class.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are you four access modifiers

A
  1. Public
  2. Private
  3. Default
  4. Protected
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Access Modifier: Public explain

A

Access level is everywhere

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Access modifier: Private

A

Access only from within the class. Cannot be accessed outside of the class

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Access modifier: Protected

A

Access from only within the package and outside the package through the child.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Access modifier: Default

A

Access level is only within the package. It cannot be accessed from outside the package

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Abstract and Interface explained

A

Both are contracts.

Abstract class is a class that cannot be created and has at least one abstract method. Mixture of unique and generalized methods that your subclasses will inherit.

Interface: Just abstract methods, anything that implements the interface has to define the method. o You want to specify the behavior of a particular data type, but not concerned about who implements its behavior

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is a static method

A

A static method is a method that pertains to a class not an object. This allow the method to be called with an instance of an object. Can only call other static methods and static variables.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is a singleton

A

ensure that only one instance of a class is created and provide global access point to the object

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What are the main concepts of OOP

A
  1. Abstraction
  2. Encapsulation
  3. Polymorphism
  4. Inheritance
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Explain Abstraction

A

each object should only expose a high-level mechanism for using it. The internal implementation details are hidden. It only reveals operations relevant for other objects

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

When would you use a static method

A

The code in the method is not dependent on instance creation and is not using any instance variable.
A particular piece of code is to be shared by all the instance methods.
The definition of the method should not be changed or overridden.
you are writing utility classes that should not be changed.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Explain Polymorphism

A

override/overloading meaning that you can have a method with the same name as the parent with different functionality

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Explain Inheritance

A

Reuse common logic and extract the unique logic into a separate class. Child receives stuff from the parent

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Overriding

A

replaces that the function inherted from the parent does

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Overloading

A

defining multiple methods with the same name but with different parameters.

17
Q

What is MVC

A

Model view controller
Model: is the data -> so the SQL
view: is the ui
controller: is what makes changes to the other two.

18
Q

What is MVC

A

Model view controller
Model: is the data -> so the SQL
view: is the ui
controller: is what makes changes to the other two.

19
Q

What does SOLID stand for?

A
S - Single Responsibility Principle (known as SRP)
O - Open/Closed Principle
L - Liskov’s Substitution Principle
I - Interface Segregation Principle
D - Dependency Inversion Principle
20
Q

Explain S - Single Responsibility Principle (known as SRP)

A

class should be having one and only one responsibility

21
Q

O - Open/Closed Principle

A

classes should be open for extension but closed for modification”. What is means is that if the class A is written by the developer AA, and if the developer BB wants some modification on that then developer BB should be easily do that by extending class A, but not by modifying class A.

22
Q

L - Liskov’s Substitution Principle

A

parent classes should be easily substituted with their child classes without blowing up the application

23
Q

Interface Segregation Principle

A

many client specific interfaces are better than one general interface

24
Q

Dependency Inversion Principle

A

classes should depend on abstraction but not on concretion

High-level modules should not depend on low-level modules.

25
Q

What does SOAP stand for?

A

Simple Object Access Protocol

26
Q

What is SOAP

A

SOAP is an application communication protocol

SOAP is a format for sending and receiving messages

SOAP is platform independent

SOAP is based on XML

SOAP is a W3C recommendation

27
Q

What is HTTP

A

Hypertext Transfer Protocol

28
Q

What is REST

A

Representational state transfer

is a software architectural style that defines a set of constraints to be used for creating Web services.

29
Q

REST constraints

A
Client–server
Stateless
Cacheable
Uniform interface
Layered system
Code on demand
30
Q

XML

A

Extensible Markup Language