200-710 Exam Questions
231 real 200-710 exam questions with expert-verified answers and explanations. Page 2 of 5.
- Question #51Web Features
Which MIME type is always sent by a client if a JPEG file is uploaded via HTTP?
MIME typeJPEGHTTP uploadclient behavior - Question #52Web Features
Your application uses PHP to accept and process file uploads. It fails to upload a file that is 5 MB in size, although upload_max_filesize is set to "10M". Which of the following c...
upload_max_filesizepost_max_sizeMAX_FILE_SIZEfile upload configuration - Question #53Databases & SQL
Consider the following table data and PHP code. What is the outcome? Table data (table name "users" with primary key "id"): id name email --- ---- ----- 1 anna [email protected] 2...
PDObindParambindColumnprepared statements - Question #54Databases & SQL
Table data (table name "users" with primary key "id"): id name email --- ---- ----- 1 anna [email protected] 2 betty [email protected] 3 clara [email protected] 5 sue sigma@example....
PDOprimary key violationerror handlingINSERT - Question #55Databases & SQL
QUESTION 58 Consider the following table data and PHP code. What is a possible outcome? Table data (table name "users" with primary key "id"): id name email --- ---- ----- 1 anna a...
PDOfetchAllFETCH_BOTHresult sets - Question #56Databases & SQL
QUESTION 59 Consider the following table data and PHP code, and assume that the database supports transactions. What is the outcome? Table data (table name "users" with primary key...
PDOtransactionsauto-commitexec - Question #57Data Formats & Types
QUESTION 60 Given a PHP value, which sample shows how to convert the value to JSON?
json_encodeJSONdata serialization - Question #58Data Formats & Types
QUESTION 61 Given a JSON-encoded string, which code sample correctly indicates how to decode the string to native PHP values?
json_decodeJSONdata parsing - Question #59Data Formats & Types
QUESTION 62 Which of the following PHP values may NOT be encoded to a JavaScript literal using PHP's ext/json capabilities?
json_encodeJSON limitationsPHP functionsJavaScript literals - Question #60Date and Time
QUESTION 63 Which of the following will NOT instantiate a DateTime object with the current timestamp?
DateTimetimestamptime()constructor - Question #61Date and Time
QUESTION 64 Given a DateTime object that is set to the first second of the year 2014, which of the following samples will correctly return a date in the format '2014-01-01 00:00:01...
DateTimeformat()date format charactersPHP date - Question #62Date and Time
QUESTION 65 Given the following DateTime objects, what can you use to compare the two dates and indicate that $date2 is the later of the two dates? $date1 = new DateTime('2014-02-0...
DateTimeobject comparisondate comparisoncomparison operators - Question #63Date and Time
QUESTION 66 Given the following DateTime object, which sample will NOT alter the date to the value '2014-02-15'? $date = new DateTime('2014-03-15');
DateTimeDateIntervaldiff()modify() - Question #64Object-Oriented Programming
QUESTION 67 Which interfaces could class C implement in order to allow each statement in the following code to work? (Choose 2) $obj = new C(); foreach ($obj as $x => $y) { echo $x...
IteratorIteratorAggregateforeachinterface - Question #65Arrays
QUESTION 68 What is the output of the following code? class Foo implements ArrayAccess { function offsetExists($k) { return true; } function offsetGet($k) { return 'a'; } function...
ArrayAccessarray_key_existsobject interfacelimitations - Question #66Arrays
class Bar { private $a = 'b'; public $c = 'd'; } $x = (array) new Bar(); echo array_key_exists('a', $x) ? 'true' : 'false'; echo '-'; echo array_key_exists('c', $x) ? 'true' : 'fal...
object castingprivate propertiesarray conversionarray_key_exists - Question #67Arrays
QUESTION 70 What is the output of the following code? $a = array('a' => '1', 'c'); echo property_exists((object)$a, 'a') ? 'true' : 'false'; echo '-'; echo property_exists((object)...
array to object castingproperty_existsobject propertiestype juggling - Question #68Strings & Patterns
QUESTION 71 Assuming UTF-8 encoding, what is the value of $count? $data = '♥1a2'; $count = strlen($data);
strlenUTF-8byte countingmultibyte strings - Question #69Strings & Patterns
QUESTION 72 What is the output of the following code? $world = 'world'; echo <<<TEXT hello $world TEXT;
heredocvariable interpolationstring syntax - Question #70Web Features
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 '✂✔✝';
Content-Type headercharsetUTF-8encoding mismatch - Question #71Strings & Patterns
What will the following code print out? $str = '✔ one of the following'; echo str_replace('✔', 'Check', $str);
str_replaceUnicodeUTF-8string functions - Question #72Strings & Patterns
What is the pattern modifier for handling UTF-8 encoded preg_* functionality?
regex modifierUTF-8preg functionsPCRE - Question #73Strings & Patterns
What is the output of the following code? $text = 'This is text'; $text1 = <<<TEXT TEXT; $text; $text2 = <<<TEXT $text1 TEXT; echo "$text2";
heredocvariable interpolationstring parsingscope - Question #74Web Features
Your public web application needs to provide access to binary files for registered users only. How would you achieve this?
file servingheader()authenticationbinary content - Question #75Web Features
What content-type is required when sending an HTTP POST using JavaScript to ensure that PHP can access the data?
HTTP POSTContent-Typeform encodingJavaScript - Question #76Web Features
From your PHP application, how can you send the same header twice, but with different values?
header() functionHTTP headersreplace parameter - Question #77Web Features
Which class of HTTP status codes is used for server error conditions?
HTTP status codes5XXserver errors - Question #78Web Features
Which class of HTTP status codes is used for redirections?
HTTP status codes3XXredirections - Question #79Web Features
Which of the following can NOT be used to send a cookie from within a PHP application?
cookiessetcookie()$_COOKIE superglobalheader() - Question #80Web Features
Under what condition may HTTP headers be set from PHP if there is content echoed prior to the header function being used?
output bufferingHTTP headersheaders_sentob_start - Question #81Web Features
Before the headers are sent, how can you remove a previously set header?
header_removeHTTP headersheader manipulation - Question #82Web Features
How can you determine whether a PHP script has already sent cookies to the client?
headers_sentcookiesHTTP headers - Question #83Web Features
An HTML form has two submit buttons. After submitting the form, how can you determine with PHP which button was clicked?
HTML forms$_POSTform submissionsubmit buttons - Question #84Functions
What is the output of the following code? function append(&$str) { $str = $str.'append'; } function prepend(&$str) { $str = 'prepend'.$str; } $string = 'zce'; append(prepend($strin...
pass by referencefunction compositionstring concatenationnested calls - Question #85Functions
What is the output of the following code? function increment ($val) { $val = $val + 1; } $val = 1; increment ($val); echo $val;
pass by valuefunction scopevariable isolation - Question #86Functions
What is the output of the following code? function increment ($val) { $_GET['m'] = (int) $_GET['m'] + 1; } $_GET['m'] = 1; echo $_GET['m'];
superglobals$_GETfunction scopetype casting - Question #87Functions
How many times will the function counter() be executed in the following code? function counter ($start, &$stop) { if ($stop > $start) { return; } counter ($start--, ++$stop); } $st...
recursionpass by referenceexecution countpost-decrement - Question #88Functions
How do you allow the caller to submit a variable number of arguments to a function?
variadic functionsfunc_get_argsvariable arguments - Question #89Arrays
Consider the following code snippet: { $value = $value + 1; } $value = $value + 2; { $array = array (1, 2, 3); modifyArray($array);
arrayspass by referencefunction scopearray modification - Question #90Object-Oriented Programming
What is the output of the following code? class a { public $val; function renderVal (a $a) { if ($a) { echo $a->val; } } renderVal (null);
type hintingnull argumentclass type hintsstrict typing - Question #91Functions
What is the output of the following code? function fibonacci (&$x1 = 0, &$x2 = 1) { $result = $x1 + $x2; $x1 = $x2; $x2 = $result; return $result; } for ($i = 0; $i < 10; $i++) { e...
default reference parameterspass by referencefibonaccifunction state - Question #92Functions
What is the output of the following code? function ratio ($x1 = 10, $x2) { if (isset ($x2)) { return $x2 / $x1; } } echo ratio (0);
default parametersparameter orderrequired parameterswarnings - Question #93Functions
Which of the following is NOT a valid function declaration?
function declarationdefault valuestype hintssyntax - Question #94Functions
What is the output of the following code? function increment (&$val) { return $val + 1; } $a = 1; echo increment ($a); echo increment ($a);
pass by referencereturn valuefunction output - Question #95I/O
Which of the following is true about stream contexts? (Choose 2)
stream contextsstream wrapperscontext options - Question #96I/O
Consider the following code. What can be said about the call to file_get_contents? $getdata = 'foo=bar'; $opts = array('http' => array( 'method' => 'POST', 'header' => 'Content-typ...
file_get_contentsstream contextHTTP POSTstream_context_create - Question #97I/O
What function can be used to retrieve an array of current options for a stream context?
stream_context_get_optionsstream contextcontext options - Question #98I/O
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)
stream contextuser agentini_setfile_get_contents - Question #99PHP Basics
What will an opcode cache ALWAYS automatically improve?
opcode cachePHP performanceexecution speed - Question #100PHP Basics
What is cached by an opcode cache?
opcode cachecompiled PHPbytecode caching