bitwise
What is the result of the following bitwise operation in PHP?
1 ^ 2
A. 1
B. 3
C. 2
D. 4
E. -1 |
date
Which of the following will NOT instantiate a DateTime object with the current timestamp?
A. $date = new DateTime();
B. $date = new DateTime('@' . time());
C. $date = new DateTime('now');
D. $date = new DateTime(time()); |
date
Given the following DateTime object, which sample will NOT alter the date to the value '2014-02-15'?
$date = new DateTime('2014-03-15');
A. $date->sub(new DateInterval('P1M'));
B. $date->setDate(2014, 2, 15);
C. $date->modify('-1 month');
D. $date->diff(new DateInterval('-P1M')); |
pdo
Which of these databases is NOT supported by a PDO driver?
A. Microsoft SQL Server
B. SQLite
C. Microsoft Access
D. Berkeley DB |
object
An object can be counted with count() and sizeof() if it...
A. implements ArrayAccess
B. has a public __count() method
C. was cast to an object from an array
D. None of the above |
class
Which of the following statements about PHP is false? (Choose 2)
A. A final class can be derived.
B. A final class may be instantiated.
C. A class with a final function may be derived.
D. Static functions can be final.
E. Properties can be final. |
class
When a class is defined as final it:
A. Can no longer be extended by other classes.
B. Means methods in the class are not over-loadable.
C. Cannot be defined as such, the final is only applicable to object methods.
D. Cannot be instantiated. |
arrays
Which value will be assigned to the key 0 in this example?
$foo = array(true, '0' => false, false => true); |
arrays
Which is the most efficient way to determine if a key is present in an array, assuming the array has no NULL values?
A. in_array('key', array_keys($a))
B. isset($a['key'])
C. array_key_exists('key', $a)
D. None of the above |
|
|
string
What is the length of a string returned by: md5(rand(), TRUE);
A. Depends on the value returned by rand() function
B. 32
C. 24
D. 16
E. 64 |
Namespace
When Would you use classes and when would you use namespaces>
A. Use classes to encapsulate code and represent objects, and namespaces to avoid symbol name collision
B. Use Classes for performance-sensitive code, namespaces when readability maters more
C. Use namespaces for performance-sensitive code, and classes when readability matters more
D. Always use them; namespaces are always superior to classes |
Namespace
What purpose do namespaces fulfill?
A. Encapsulation
B. Alternative to classes
C. Improved performance
D. All of the above |
Namespace
What would be the output of the following code?
namespace MyFramework\DB;
class MyClass {
static function myName() {
return __METHOD__;
print MyClass::myName();
A. MyFramework\DB\myName
B. MyFramework\DB\MyClass\myName
C. MyFramework\DB\MyClass::myName
D. MyClass::myName |
Namespace
You'd like to use the class MyDBConnection that's defined in the
MyGreatFramework\MyGreatDatabaseAbstractionLayer namespace, but you want to minimize as much as possible the length of the class name you have to type. What would you do?
A. Import the MyGreatFramework namespace
B. Import the MyGreatFramework\MyGreatDatabaseAbstractionLayer namespace
C. Alias MyGreatFramework\MyGreatDatabaseAbstractionLayer\MyDBConnection to a shorter name
D. Alias MyGreatFramework\MyGreatDatabaseAbstractionLayer to a shorter name |
Namespace
Which of these elements can be encapsulated by namespaces and made accessible from
the outside?
A. Only classes
B. Classes, functions, and constants
C. Classes, functions, constants, and variables |
Class Constants
Which of the following statements is NOT true?
A. Class constants are public
B. Class constants are being inherited
C. Class constants can omit initialization (default to NULL)
D. Class constants can be initialized by const |
conjuction
Which of the following may be used in conjunction with CASE inside a SWITCH statement?
A. A scalar
B. An expression
C. A boolean
D. All of the above |
|
|
php
Given the default PHP configuration, how can all of the parameters provided via GET be accessed in a form of a string?
A. $_GET['ALL']
B. $_SERVER['QUERY']
C. $_SERVER['QUERY_STRING']
D. $_ENV['QUERY']
E. $QUERY_STRING |
pdo
Which of these statements about PDO is NOT true?
A. PDO has built-in support for Large Objects (LOBs).
B. Placeholders within PDO prepared statements need to be named.
C. When something goes wrong, PDO can throw an instance of its own exception class.
D. PDO does not emulate missing database features. |
PHP
When retrieving data from URLs, what are valid ways to make sure all file_get_contents calls send a certain user agent string? (Choose 2)
A. $default_opts =array('http' =>array('user_agent' => "My Cool Brower"));$default= stream_context_set_default($default_opts);
B. stream_context_set_option("user_agent", "My Cool Browser");
C. ini_set('user_agent' , "My Cool Browser");
D. stream_context_set_option($context, "http", "user_agent", "My Cool Browser"); |
PHP
Which of the following PHP values may NOT be encoded to a JavaScript literal using
PHP's ext/json capabilities?
A. 'Hello, world!'
B. function(){ alert("Hello, world!"); }
C. array('Hello, world!')
D. array('message' => 'Hello, world!') |
PHP
Please provide the value of the $code variable in the following statement to set an HTTP
status code that signifies that the requested resource was not found.
http_response_code($code); |
Answer: 404, 404 Not Found
PHP
Consider the following two files. When you run test.php , what would the output look like?
test.php:
include "MyString.php";
print ",";
print strlen("Hello World");
MyString.php:
namespace MyFramework\String:
function strlen($str)
return\strlen($str) *2; // return double the string length
print strlen ("Hello World")
A. 12.12
B. 12,24
C. 24.12
D. 24,24
E. PHP Fatal error:cannot declare strlen() |
PHP
What is the benefit of using persistent database connections in PHP? (Choose two.)
A. Reduces the connection & authentication overhead of connecting to the database
B. Ensures that only a single connection is open to the database from PHP
C. Allows connection settings such as character set encoding to persist
D. Allows for a resumption of transactions across multiple requests. |
PHP
Which of the following is used to find all PHP files under a certain directory?
A. PHPIterator
B. RecursiveTreeIterator
C. RecursiveDirectoryIterator
D. SplTempFileObject |
PHP
What is the difference between "print" and "echo"?
A. There is no difference.
B. Print has a return value, echo does not
C. Echo has a return value, print does not
D. Print buffers the output, while echo does not
E. None of the above |
PHP
Which of the following statements is true?
A. All PHP database extensions support prepared statements
B. All PHP database extensions come with their own special helper functions to escape user data to be used in dynamic SQL queries
C. All PHP database extensions provide an OOP interface
D. All PHP database extensions appear in the output of php -m , if installed and enabled |
PHP
What is the pattern modifier for handling UTF-8 encoded preg_ *functionality?
A. e
B. u
C. PHP does not support UTF-8 encoded strings
D. a pattern modifier is not needed |
PHP
What is "instanceof" an example of?
A. a boolean
B. an operator
C. a function
D. a language construct
E. a class magic |
php.ini
Given a php.ini setting of
default_charset = utf-8
what will the following code print in the browser?
header('Content-Type: text/html; charset=iso-8859-1');
echo '✂✔✝';
A. Three Unicode characters, or unreadable text, depending on the browser
B. ✂✔✝
C. A blank line due to charset mismatch |
php.ini
Your supervisor wants you to disallow PHP scripts to open remote HTTP and FTP
resources using PHP's file functions. Which php.ini setting should you change accordingly? |
Answer : allow_url_fopen, allow_url_fopen=off, allow_url_fopen=Off, allow_url_fopen = off, allow_url_fopen = Off
php.ini
Which php.ini setting is usually required to use an opcode cache?
A. extension
B. zend_extension
C. optimizer
D. dl |
|