EMT Practice Test

1. Question Content...


Question List

Question1: What is the output of the following code?

Question2: What is the output of the following code?

Question3: An HTML form has two submit buttons. After submitting the form, how can you determine with PHP which button was clicked?

Question4: Consider the following table data and PHP code. What is the outcome?
Table data (table name "users" with primary key "id"):

PHP code (assume the PDO connection is correctly established):

Question5: In a shared hosting environment, session data can be read by PHP scripts written by any user. How can you prevent this? (Choose two.)

Question6: What method can be used to find the tag <any> via the DOM extension?

Question7: Which of the following techniques ensures that a value submitted in a form can only be yesor no?

Question8: Is the following code vulnerable to SQL Injection where ($mysqliis an instance of the MySQLi class)?

Question9: Which of the following expressions will evaluate to a random value from an array below?
$array = ["Sue","Mary","John","Anna"];

Question10: What is the output of the following code?

Question11: Under what condition may HTTP headers be set from PHP if there is content echoed prior to the header function being used?

Question12: What is the output of the following code?

Question13: What is the output of the following code?

Question14: Which options do you have in PHP to set the expiry date of a session?

Question15: Which of the following functions are used to escape data within the context of HTML? (Choose two.)

Question16: Which methods can be used to overload object properties? (Choose two.)

Question17: Which of the following statements about Reflection are correct?

Question18: What function is best suited for extracting data from a formatted string into an array?

Question19: Which class of HTTP status codes is used for server error conditions?

Question20: Which of the following are valid code snippets? (Choose three.)

Question21: Which of the following is NOT possible using reflection?

Question22: What exception type will catch the error raised by the expression 2 / 0?

Question23: Which of the following is NOT true about PHP traits? (Choose two.)

Question24: What can prevent PHP from being able to open a file on the hard drive? (Choose two.)

Question25: What is the length of a string returned by: md5(rand(). TRUE);

Question26: Which of the following statements about anonymous functions in PHP are NOT true? (Choose two.)

Question27: Assuming UTF-8 encoding, what is the value of $count?
$data == '$la2';
$count = strlen('$data');

Question28: What is the output of the following code?

Question29: What function can reverse the order of values in an array so that keys are preserved?

Question30: Which of the following are NOT acceptable ways to create a secure password hash in PHP? (Choose two.)

Question31: What is the output of the following code?

Question32: What will the following function call print?

Question33: Consider 3 PHP files that are called asynchronously via XmlHttpRequest:

Which of the following statements is true? (Choose two.)

Question34: Given a DateTime object that is set to the first second of the year 2017, which of the following samples will correctly return a date in the format '2017-01-01 00:00:01'?

Question35: After performing the following operations:

What will be the value of $a?

Question36: What is the output of the following code?

Question37: One common security risk is exposing error messages directly in the browser. Which PHP configuration directive can be disabled to prevent this?

Question38: An unbuffered database query will (choose two):

Question39: What is the output of the following code?

Question40: What Content-Type HTTP header value is required when sending an HTTP POST request using JavaScript to ensure that PHP can access the data?

Question41: Which of the following can NOT be used to send a cookie from within a PHP application?

Question42: Which of these error types may be handled by a user defined error handler function? (Choose two.)

Question43: Given a php.ini setting of
default_charset = utf-8
what will the following code print in the browser?

Question44: An HTML form contains this form element:

When this form is submitted, the following PHP code gets executed:

Which of the following actions must be taken before this code may go into production? (Choose two.)

Question45: What is the output of the following code?

Question46: What is the output of the following code?