PDO Offers:
a) Fast access to databases
b) Multi-database support
c) Built in security
d) All of the above
Front
d) All of the above
Back
After every PDO operation, one of two results are returned.
Front
True
Back
public function count($number) {
return $number + 2;
}
count($amount);
In the code above, $number is a parameter and $amount is an argument
Front
True
Back
To retrieve the number inserted into the auto incremented field, use the lastId() method
Front
False
Back
public function accountQuery() {
return $balance;
}
The above code will return the value of the 'balance' property
Front
False
Back
Abstract methods have a method signature but no body.
Front
True
Back
Each object of the same class has the same properties and methods
Front
True
Back
PDO has support for more than twelve databases
Front
True
Back
PDO is designed to replace MySQLi
Front
True
Back
Objects have properties also known as behaviour
Front
False
Back
The acronym PDO stands for:
a) PHP Decadal Oscillation
b) PHP Data Objects
c) PHP Designation of Origin
d) PHP Development and Operation
Front
b) PHP Data Objects
Back
All properties values of the same class are equal
Front
False
Back
A global variable can be declared however it is not recommended
Front
True
Back
PDO Supports every major database system
Front
True
Back
Single inheritance is when a subclass inherits properties and behavior from a single superclass.
Front
True
Back
PDO has been available since PHP 5.0
Front
True
Back
To get the number of row returned from a query operation use the numRows() method
Front
False
Back
public function count($number) {
return $number + 2;
}
count($amount);
In the code above, $number is an argument and $amount is a parameter
Front
False
Back
The parent keyword can be used to access properties or methods of a superclass from a subclass.
Front
True
Back
The self keyword refers to the current object.
Front
False
Back
PDO offers unified interface to access many different databases.
Front
True
Back
A parent class is also known as a superclass.
Front
True
Back
To access a static property use the Object Operator (->)
Front
False
Back
API's are used by programmers to interact with a class.
Front
True
Back
Accessor methods are used to modify values of properties
Front
False
Back
Every object of a class can access a static property of the same class.
Front
True
Back
Abstract methods must be implemented in all classes which inherit them.
Front
True
Back
Instantiation is the process of creating an object of some class
Front
True
Back
Mutator methods are used to modify values of properties
Front
True
Back
Using the private visibility modifier allows you to access methods and properties from outside the class
Front
False
Back
CRUD operations are the most common operations implemented in software
Front
True
Back
Static methods belong to the class rather than an object of a class.
Front
True
Back
To get all results into an associative array from a select SQL query use:
a) fetchAll(PDO::FETCH_ASSOC)
b) fetch_array(PDO::FETCH_ASSOC)
c) fetch(PDO::FETCH_ASSOC)
d) fetchAll_array(PDO::FETCH_ASSOC)
Front
a) fetchAll(PDO::FETCH_ASSOC)
Back
class OnlineStore {
public $inventory = $inventory + 10;
}
The above code is will produce an error
Front
True
Back
Protected access offers as much security as private so it is recommended that you use protected visibility whenever possible.
Front
False
Back
Subclasses inherit all properties and methods defined in its superclass.
Front
True
Back
PDO offers multi-database support.
Front
True
Back
The keyword 'create' is used to create an instance of a class
Front
False
Back
public function accountQuery() {
return $this->balance;
}
The above code will return the value of the 'balance' property
Front
True
Back
$sql = "SELECT * FROM movies";
$result = $dbc->query($sql)
if ($result==false) {
}
In the above statement, if $result is FALSE, then there are no records in the 'movies' table.
Front
False
Back
Abstract may have public or private visibility.
Front
False
Back
Abstract classes are meant to be extended
Front
True
Back
echo $johnsSavingsAccount->$type;
The above code will output the value stored in property 'type'
Front
False
Back
Instantiation must be performed within the class definition
Front
False
Back
If you want to track the number of objects that have be instantiated, use a static property
Front
True
Back
When extending a class with abstract methods, the actual method must be defined with the same number of arguments.
Front
True
Back
Most object oriented languages do not support inheritance.
Front
False
Back
Multilevel Inheritance is when a subclass inherits from another subclass.
Front
True
Back
PDO is short for:
a) PHP Database Oriented Programming
b) PHP Database Object
c) PHP Data Operations
d) PHP Data Object
Front
d) PHP Data Object
Back
Having a query with placeholders, you have to prepare it, using the PDO _________ method. This function will return the same PDOStatement object, but without any data attached to it.
a) pdoprepare()
b) prep()
c) prepare_statement()
d) prepare()
Front
d) prepare()
Back
Section 2
(34 cards)
To use an interface within a class, use the "implements" keyword.
Front
True
Back
The catch block must use the '$e' identifier as the catch block parameter
Front
False
Back
The following two statements are equivalant:
$array = array();
$array = [];
Front
True
Back
Only abstract classes may contain abstract methods.
Front
True
Back
A string is provided to the argument of the Exception class, which is also the error message provided when using the getMessage method.
Front
True
Back
With the PDOException class, which method is used to retrieve the reason for a thrown exception:
a) getMsg()
b) getErr()
c) getError()
d) getMessage()
Front
d) getMessage()
Back
The try block should not contain the code that throws an exception
Front
False
Back
In PHP, for every C-style cast, there is an equivalent function to perform the same task.
Front
True
Back
try () {
//Code to 'try' here
} throw {
//Code to 'throw' here
} catch (Execption $e) {
//Code to 'catch' here
}
The above code is the syntax for basic try-throw-catch exception handling.
Front
False
Back
When extending an abstract class one must add at least one property to the class.
Front
False
Back
The throw statement calls a catch block
Front
True
Back
As of PHP 7.0, there are two predefined exception classes.
Front
False
Back
The array_shift() function adds a new element to the beginning of an array
Front
False
Back
A signaled exception is called 'handling the exception'
Front
False
Back
PHP contains the following native data structures: arrays, linked lists, hash tables and B-Trees
Front
False
Back
When throwing an exception, the first argument MUST always be an object of the exception class.
Front
True
Back
The array_unshift() function removes and returns an element from the beginning of an array
Front
False
Back
To create an interface, use the interface keyword and provide the method signatures within curly braces
Front
True
Back
The is_array() function returns a boolean true if the parameter passed is an array
Front
True
Back
Any methods placed in the spl_autoload_register() queue are automatically invoked when the __autoload() method would be invoked.
Front
True
Back
Assuming you have an abstract class of Employee, and extend it to create HourlyEmployee. In order to call the parent class constructor which of the following would you use?
a) parent::__construct()
b) Employee::__construct()
c) Hourly::__construct()
d) $this->__construct()
Front
a) parent::__construct()
Back
The Exception class is designed to be extended to produce custom exception handling classes.
Front
True
Back
Fatal errors generated by incorrect parameter types can be "caught" using Exception Handling.
Front
True
Back
The array_push() function adds a new element to the end of an array
Front
True
Back
The three parts to exception handling are: execute-throw-catch
Front
False
Back
If you attempt to instantiate an abstract class it will send a warning 505 message before creating the instance.
Front
False
Back
In PHP, arrays aren't really arrays because they can grow and shrink dynamically
Front
True
Back
The array_pop() function removes and returns the last element from an array
Front
True
Back
The throw statement calls a user defined method
Front
False
Back
The try block has one parameter
Front
False
Back
When extending an abstract class with abstract methods, you do not have to extend the abstract methods.
Front
False
Back
It is required that interface names end with the word "Interface".
Front
False
Back
The explode() function will create a string by joining all elements of a provided array