Object Oriented PHP Flashcards

1
Q

What’s an abstract class?

A

A way of providing concrete base functions as well as abstract functions that must be implemented by concrete child classes

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

$black =& $white

A

make $black an alias for $white

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

=&

A

assign as alias =&

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

Abstract classes vs. interfaces

A

Abstract classes may have implemented methods, interfaces have no implementation in themselves

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

Object interface

A

A list of function names that a class must define if the class implements that interface

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

Benefits of abstract class over interface if multiple inheritance not required

A

To later add base functionality within the abstract class

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

Abstract classes feature single inheritance

A

Child classes can extend only one class at a time.

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

Abstract classes cannot be instantiated in-themselves

A

no new AbstractClassName()

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

What’s the main advantage of an interface?

A

That it allows you to define a protocol to be implemented for an object to have some behavior.

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

Singleton pattern

A

Special class that generates one and only one object instance

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

Factory method pattern

A

Building an inheritance hierarchy of creator classes

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

Abstract factory pattern

A

Grouping the creation of functionally related products

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

Prototype pattern

A

Using clone to generate objects

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

What is PDO?

A

PDO offers an API that consolidates most of the functionality that was previously spread across the major database access extensions, i.e. MySQL, PostgreSQL, SQLite, MSSQL, etc. The interface exposes high-level objects for the programmer to work with database connections, queries and result sets, and low-level drivers perform communication and resource handling with the database server.

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

What are the two parts that make up PDO?

A

PDO consists of the extension itself which exposes the interface and a low-level database-specific driver.

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