PHP: Test 2 Review
Method Overriding is not possible in PHP a) True b) False
a) False
<form method="POST" action="uploadimg.php" enctype="multipart/form-data"> <input type="file" id="imageFile" name="imgFile"> <input type="submit"></form> Based upon the above example, the MIME type can be determined by referring to the array $_FILES['imgFile']['type'] a) True b) False
a) True
<form method="POST" action="uploadimg.php" enctype="multipart/form-data"> <input type="file" id="imageFile" name="imgFile"> <input type="submit"></form> Based upon the above example, the file will be placed into the $_FILES['imgFile'] superglobal a) True b) False
a) True
A major advantage to the Heredoc syntax allows you to define your own delimiter. a) True b) False
a) True
All session handler functions must return a boolean false/true except for the read() function which must return a string. a) True b) False
a) True
Although serialization can be performed on simple types such as numbers or strings, it's mainly designed to be used with complex data types such as arrays and objects. a) True b) False
a) True
By changing the default session handlers, you can improve application security. a) True b) False
a) True
Composer can load the required package list from a composer.json file located in the root of the application. a) True b) False
a) True
Due to Heredoc's "what you see is what you get" property, the Heredoc syntax is usually used to format emails a) True b) False
a) True
For method overriding to function correctly in PHP, the overriding method must have the same method signature as the method being overriden. a) True b) False
a) True
If an argument passed to a function is not of the declared type, PHP will throw a fatal error. a) True b) False
a) True
In a PHP serialized string, the datatype specifier for an array is "a". a) True b) False
a) True
In a PHPUnit test, the setUp() method will automatically be called before each test is run. a) True b) False
a) True
In a serialized string, protected properties have two NUL bytes surrounded by an asterisk (*) before the property name a) True b) False
a) True
Late Static Binding allows PHP to use run-time information in method resolution a) True b) False
a) True
Lazy Loading aids in program efficiency by reducing CPU loading time and memory usage a) True b) False
a) True
Lazy Loading is used to defer initialization of an object until the point at which it is needed a) True b) False
a) True
Method Overloading is not possible in PHP a) True b) False
a) True
Objects of abstract classes cannot be instantiated a) True b) False
a) True
PHP 7.0 has support for return types. a) True b) False
a) True
PHP has a built-in function to conveniently send email a) True b) False
a) True
PHP's built in function session_set_save_handler() is used to define the session handler functions to use. a) True b) False
a) True
Salts should always be applied to passwords. a) True b) False
a) True
TDD is the practice of defining your tests, then writing code that passes those tests. a) True b) False
a) True
The Heredoc syntax begins with <<< followed by an identifier. a) True b) False
a) True
The Reflection API allows you manipulate properties, methods at runtime. a) True b) False
a) True
The Reflection API can allow you access otherwise inaccessible properties. a) True b) False
a) True
The basic premise of 'Pass By Value' is that a copy of the argument is made when passed to a variable a) True b) False
a) True
The following code will move an uploaded file from its temporary name to its uploaded name: move_uploaded_file( $_FILES['imgFile']['tmp_name'], $_FILES['imgFile']['name'] ); a) True b) False
a) True
The general principle behind serialization is to convert a complex data type to a simple data type. a) True b) False
a) True
The password_hash() function returns information about the type of algorithm used as well as the salt and hashed password. a) True b) False
a) True
The primary purpose of the session handler gc() function is to clear expired session data from the table. a) True b) False
a) True
The process of associating a method definition with a method invocation is called binding a) True b) False
a) True
To include the methods/properties from a Trait, include the keyword 'use' followed by the trait name within the class. a) True b) False
a) True
Two identically hashed values is called a hash collision. a) True b) False
a) True
Type hinting allows you to indicate what type of value is expected in a parameter of a function or method. a) True b) False
a) True
Unit tests are defined using assertions. a) True b) False
a) True
When the function session_start() is invoked, PHP will execute the open() then read() function a) True b) False
a) True
When you assign an object to a variable, PHP's default behaviour is to create a new reference to the existing object a) True b) False
a) True
As of PHP 7.0, PHP implements a method of code reuse called Traits. a) True b) False
b) False
Composer is a package manager for JavaScript. a) True b) False
b) False
Composer is the second most popular PHP package manager (behind PEAR). a) True b) False
b) False
Fast hashing algorithms are preferred so that the servers can verify passwords quickly. a) True b) False
b) False
In a PHP serialized string, the datatype specifier for an integer is "d". a) True b) False
b) False
In a PHPUnit test, the setUp() method will automatically be called before the entire test suite is run. a) True b) False
b) False
It is recommended that you use md5() as the hashing algorithm when storing passwords. a) True b) False
b) False
It is recommended that you use sha1() as the hashing algorithm when storing passwords. a) True b) False
b) False
Late Static Binding is limited to static method calls a) True b) False
b) False
Namespaces only work with Classes, Variables, Interfaces, Functions and Constants a) True b) False
b) False
One of the properties of md5 is that no two strings may generate the same hashed value a) True b) False
b) False
PHP 5.4 supports type hinting for objects, interfaces, callables, arrays or any of the native types. a) True b) False
b) False
PHP's default implementation of session handlers is fully secure. a) True b) False
b) False
The Heredoc approach works like single quotes in that values of variables are not resolved. a) True b) False
b) False
The md5() function generates a hash which can be used to securely store passwords. a) True b) False
b) False
There is usually a one-to-one correlation between the number of test methods defined and the number of methods in the class being tested. a) True b) False
b) False
To delete a file, use the PHP built-in function delete() a) True b) False
b) False
Unit Tests should encompass an entire feature. a) True b) False
b) False
Until PHP 5.6, there hasn't been an easy solution to the Late Static Binding problem a) True b) False
b) False
Using the move_uploaded_file function, if a file with the same name exists in the directory during the move operation, the file transfer will fail and PHP will display a fatal error. a) True b) False
b) False
When PHP closes a script (?>), PHP will execute the destroy() then close() function a) True b) False
b) False