200-710 Exam Questions
231 real 200-710 exam questions with expert-verified answers and explanations. Page 3 of 5.
- Question #101PHP Basics
Which php.ini setting is usually required to use an opcode cache?
php.iniopcode cachezend_extensionPHP configuration - Question #102Data Formats & Types
What is the output of the following code? var_dump (boolval (-1));
boolvaltype castingboolean conversion - Question #103Data Formats & Types
What is the output of the following code? var_dump (boolval ([]));
boolvalempty arrayboolean conversiontype casting - Question #104Data Formats & Types
What is the output of the following code? var_dump (boolval (new StdClass()));
boolvalobject truthinessboolean conversiontype casting - Question #105PHP Basics
Consider the following code: $result = $value1 ??? $value2; Which operator needs to be used instead of ??? so that $result equals $value1 if $value1 evaluates to true, and equals $...
ternary operatornull coalescingconditional operatorsPHP operators - Question #106Magic Methods and Traits
Which of the following is NOT true about PHP traits? (Choose 2)
traitstrait limitationsinterfacesconflict resolution - Question #107Magic Methods and Traits
Given the following code, what will the output be: trait MyTrait { private $abc = 1; public function increment() { $this->abc++; } public function getValue() { return $this->abc; }...
traitsprivate propertiestrait scopemethod chaining - Question #108Object-Oriented Programming
In the following code, which line should be changed so it outputs the number 2: ```php class A { protected $x = array(); /* A. */ public function getX() { /* B. */ return $this->x;...
return by referencearray referencesmethod referencespass by reference - Question #109Closures
What is the output of the following code? ```php class A { public $a = 1; public function __construct($a) { $this->a = $a; } public function mul() { return function ($x) { return $...
closures$this bindinganonymous functionsclosure scope - Question #110Closures
What is the output of the following code? ```php class Number { private $v = 0; public function __construct($v) { $this->v = $v; } public function mul() { return function ($x) { re...
closuresbindToClosure binding$this rebinding - Question #111Closures
What is the output of the following code? ```php class Number { private static $sv = 10; private $v; public function __construct($v) { $this->v = $v; } public function mul() { retu...
static closuresClosure::bindstatic scopenull binding - Question #112Closures
Which of the following statements about anonymous functions in PHP are NOT true? (Choose 2)
anonymous functionsclosure bindingobject scopeClosure methods - Question #113Arrays
What will be the result of the following operation? ```php $a = array_merge([1,2,3] + [4=>1,5,6]); echo $a[2]; ```
array union operatorarray_mergenumeric keysarray precedence - Question #114Arrays
Which of the following functions will allow identifying unique values inside an array?
array_count_valuesunique valuesarray functionsvalue frequency - Question #115Security
When using password_hash() with the PASSWORD_DEFAULT algorithm constant, which of the following is true? (Choose 2)
password_hashPASSWORD_DEFAULTpassword securityhash length - Question #116Security
Which of the following are NOT acceptable ways to create a secure password hash in PHP? (Choose 2)
password hashingmd5openssl_digestinsecure hashing - Question #117Security
What is the preferred method for preventing SQL injection?
SQL injectionprepared statementsparameterized queriesinput sanitization - Question #118Security
Is the following code vulnerable to SQL Injection ($mysqli is an instance of the MySQLi class)? ```php $age = $mysqli->real_escape_string($_GET['age']); $name = $mysqli->real_escap...
SQL injectionreal_escape_stringnumeric parametersunquoted variables - Question #119State Management
Which of the following does NOT help to protect against session hijacking and fixation attacks?
session hijackingsession fixationsession securitycookie settings - Question #120Web Features
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. ```php http_response_...
HTTP status codes404 not foundhttp_response_codeHTTP response - Question #121Web Features
Which of the following PHP functions can be used to set the HTTP response code? (Choose 2)
HTTP response codeheader()http_response_code()HTTP headers - Question #122Web Features
What is the name of the header used to require HTTP authentication?
WWW-AuthenticateHTTP authenticationHTTP headers - Question #123Security
What types of HTTP authentication are supported by PHP? (Choose 2)
HTTP Basic authHTTP Digest authauthentication types - Question #124Security
Which of the following items in the $_SERVER superglobal are important for authenticating the client when using HTTP Basic authentication? (Choose 2)
$_SERVER superglobalPHP_AUTH_USERPHP_AUTH_PWHTTP Basic auth - Question #125State Management
When tracking upload progress with sessions, the values of 2 INI settings are needed to determine the key in $_SESSION of the upload progress data. What are the INI settings? (Choo...
session upload progressINI settingssession.upload_progress.prefixsession.upload_progress.name - Question #126State Management
What is the name of the function that allows you register a set of functions that implement user- defined session handling?
session_set_save_handlercustom session handlersession storage - Question #127Databases & SQL
Which of these databases is NOT supported by a PDO driver?
PDO driversdatabase supportBerkeley DBPDO - Question #128Databases & SQL
Which of these statements about PDO is NOT true?
PDOprepared statementsplaceholdersPDO exceptions - Question #129Object-Oriented Programming
What is the output of the following code? ```php class Test { public $value = 0; function test() { $this->value = 1; } function __construct() { $this->value = 2; } } $object = new...
__constructconstructorobject initializationmethod order - Question #130Magic Methods and Traits
Which methods can be used to overload object properties? (Choose 2)
property overloading__set__get__isset - Question #131Object-Oriented Programming
What is the result of the following code? ```php class T { const A = 42 + 1; } echo T::A; ```
class constantsconstant expressionsparse errorPHP syntax - Question #132Object-Oriented Programming
Which of the following statements is NOT true?
class constantsconstant visibilityconstant initializationinheritance - Question #133Object-Oriented Programming
What is the result of the following code? ```php define('PI', 3.14); class T { const PI = PI; } class Math { const PI = T::PI; } echo Math::PI; ```
class constantsdefine()constant chaininginheritance - Question #134Functions
Given the following code, what is correct? ```php function f(stdClass &$x = NULL) { $x = 42; } $z = new stdClass; f($z); var_dump($z); ```
type hintspass by referencenullable defaultstdClass - Question #135Functions
Which of the following statements is NOT correct?
type hintsoptional typehintsreference typehintsmethods vs functions - Question #136Object-Oriented Programming
Which of the following statements is correct?
interfacesmultiple interface inheritanceextends - Question #137Error Handling
Which of the following statements about exceptions is correct? (Choose 2)
exceptionstry-catchmultiple catch blocksexception hierarchy - Question #138Error Handling
What is the output of the following code? ```php try { class MyException extends Exception {}; try { throw new MyException; } catch (Exception $e) { echo "1: "; throw $e; } catch (...
exception catch ordernested try-catchexception hierarchycatch evaluation - Question #139Object-Oriented Programming
Which of the following is NOT possible using reflection?
reflectionReflectionClassPHP reflection APIintrospection - Question #140Magic Methods and Traits
What is the name of the method that can be used to provide read access to virtual properties in a class?
__get()virtual propertiesproperty overloadingmagic methods - Question #141Object-Oriented Programming
Which of the following statements about Reflection are correct?
reflectionbuilt-in classesPHP CLIOOP introspection - Question #142Magic Methods and Traits
What is the name of the PHP function used to automatically load non-yet defined classes?
autoloadclass loadingmagic functions__autoload - Question #143Object-Oriented Programming
When a class is defined as final it:
final classinheritanceclass modifiersPHP keywords - Question #144Object-Oriented Programming
Type hinting in PHP allows the identification of the following variable types: (Choose 2)
type hintingarraysinterfacestype declarations - Question #145Object-Oriented Programming
Which of the following code snippets is correct? (Choose 2)
interfacesabstract methodsinterface inheritanceinterface syntax - Question #146Object-Oriented Programming
Which of the following statements about PHP is false? (Choose 2)
final classfinal methodspropertiesinheritance - Question #147Object-Oriented Programming
Which of the following is correct? (Choose 2)
multiple interfacesimplementsextendsinterface inheritance - Question #148Security
Which of the following functions are used to escape data within the context of HTML? (Choose 2)
htmlentitieshtmlspecialcharsXSS preventionoutput escaping - Question #149Security
In a shared hosting environment, session data can be read by PHP scripts written by any user. How can you prevent this? (Choose 2)
session securitysession.save_pathshared hostingdatabase sessions - Question #150Security
Which of the following filtering techniques prevents all cross-site scripting (XSS) vulnerabilities?
XSS preventioninput filteringmagic_quotescross-site scripting