What does the PHP array_merge() function do?

  • Combines two or more arrays into one
  • Multiplies elements of two arrays
  • Checks if an array is empty
  • Sorts the elements of an array
The array_merge() function in PHP combines two or more arrays into a single array, preserving the keys and their corresponding values from all input arrays.

In PHP, to ensure that a method in a child class has the same name, number, and type of arguments as a method in its parent class, you use the ________ keyword.

  • 'new'
  • 'extends'
  • 'this'
  • 'private'
In PHP, the 'extends' keyword is used to create a child class that inherits properties and methods from its parent class. It enforces method signature conformity.

How can you specify a default value for a function argument in PHP?

  • By using the = default syntax.
  • By using the : syntax.
  • By using the ? syntax.
  • By using the ?? syntax.
In PHP, you can specify a default value for a function argument by using the ? syntax before the argument name. This allows the argument to have a default value of null if not provided.

Which of the following is NOT a benefit of using bound parameters with prepared statements?

  • SQL injection is prevented
  • Improved performance
  • Code readability is enhanced
  • Data integrity is compromised
Using bound parameters with prepared statements helps prevent SQL injection, improves performance, and enhances code readability. It does not compromise data integrity.

How can you prevent the inheritance of an exception class in PHP?

  • Declare the exception class as 'final'
  • Use 'private' inheritance
  • Implement 'protected' inheritance
  • Use 'static' keyword inheritance
In PHP, you can prevent inheritance of a class by declaring it as 'final.' This ensures that no other class can extend it. Exception classes are often made final to prevent further customization or accidental overriding of their behavior.

What is the significance of the E_ALL constant in PHP error reporting?

  • Report all error types
  • Ignore all errors
  • Log errors to a file
  • Display errors on the webpage
The E_ALL constant in PHP error reporting is significant because it represents a bitmask that includes all error types. When used, it tells PHP to report and handle all types of errors in your code.

Once a constant is defined in PHP, can its value be changed later in the script?

  • Yes
  • No
  • Only within functions
  • Only within classes
In PHP, once a constant is defined, its value cannot be changed later in the script. Constants are intended to hold values that do not change during the script's execution.

Imagine you are creating a login system for a web application. To ensure the security of user credentials, which of the following methods would be the best practice?

  • Use HTTPS with Secure Cookies
  • Store Passwords in Plain Text Files
  • Apply Weak Encryption
  • Implementing User-Friendly Passwords
Using HTTPS with secure cookies ensures data transmission security, protecting user credentials. Storing passwords in plain text files is highly insecure. Weak encryption is also insufficient. User-friendly passwords, while a good practice, do not directly ensure security; the infrastructure does.

If a transaction encounters an issue and needs to be terminated without saving the changes, it should be ________.

  • Rolled Back
  • Committed
  • Saved
  • Isolated
To terminate a transaction without saving any changes, you should use the 'Rollback' operation. This undoes all changes made within the transaction, ensuring data consistency and integrity. 'Committed' is the opposite, indicating that the changes should be saved.

When uploading a file in PHP, which array key of the $_FILES superglobal gives the temporary location of the uploaded file?

  • tmp_name
  • name
  • temp_location
  • uploaded_file
The 'tmp_name' key in the $_FILES superglobal array contains the temporary location of the uploaded file on the server. This is important for processing and moving the file.