Sign UpLogin With Facebook
Sign UpLogin With Google

PHP Quiz: advanced level (3/3)

PHP Quiz: advanced level (3/3)

What does the function spl_autoload_register do?
It registers an SPL instance in the metadata table which is used when creating new namespaces
It registers a function that executes automatically when you instantiate an unknown class
It registers a condition that is processed every time a script loads
It registers an automatic trigger that cancels the execution of the script if the memory is exhausted
Which of the following is a correct use of traits?
static class Trait extends MyClass {
  static $serialize;
  function __construct() {
     return Trait::$serialize;
  }
}
class MyClass extends Trait {
  function MyMethod {
     Trait::Serialize();
  }
}
trait TSerializable {
  function Serialize() { ... }
}
class MyClass {
  use TSerializable;
  function MyMethod {
    $this->Serialize();
  }
}
namespace Trait;
 
function MyFunction() {
  Trait::Serialize();
}
How would you proceed if you would like to use the header() function after content has already been echo'ed by your script?
It is impossible
Nothing in particular, it should work as is
Save the output buffer with ob_get_contents, clean it with ob_clean, use header() then re-output the data
Disable notices by using ini_set(E_ALL & ~ E_NOTICE), start the session properly with session_start(), and then use the header() function
Which of the following best describes $GLOBALS ?
An array of variables that provides references to server and client information
It is actually spelled $_GLOBALS
An array of variables that provides references to all variables in global scope
An array of variables that provides references to variables contained in both $_POST and $_GET
Which of the following best describes $_REQUEST?
An array that contains the contents of $_POST, $_GET, and $_COOKIE
An array that contains the contents of $_COOKIE and $_SERVER
An array that contains the contents of $_POST and $_GET
An array that contains the contents of $_POST, $_GET, $_COOKIE, and $_SERVER
Considering the following code, what will be displayed?
 
function my_function($param1) {
  echo $param1.": ".implode(" ", func_get_args());
}
 
my_function("Test", "error", 583);
A standard PHP warning message
A standard PHP error message
Test: Test error 583
A standard PHP notice message
What does preg_match('/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/', $var) do ?
It tests whether $var is a valid web URL
It doesn't do anything, it's just garbage
It tests whether $var is a valid FTP URL
It tests whether $var is a valid email address
What is the difference between file_get_contents($file) and @file_get_contents($file) ?
There is no difference at all
The first one performs a buffered read, while the second one reads the whole file at once
The first one may display a warning message if the file does not exist, while the second won't
The first one works while the second one has a syntax error
Which of the following best describes the purpose of PDO::prepare?
It prepares a PDO statement for executing a database query
It prepares a connection to an external database
It prepares an instance of a database connection pulled from the available PDO abstraction layer drivers
It prepares an external parameter for insertion into a database query
How is the OOP concept of multiple inheritance implemented in PHP?
class Child1 extends Parent1, Parent2, Parent3 {
 
}
class Child1 extends Parent1 {
  extends Parent2;
  extends Parent3;
}
class Child1 extends Parent1 {
  extends Parent2, Parent3;
}
The other 3 answers are all invalid.
0
{"name":"PHP Quiz: advanced level (3\/3) - Take the Quiz", "url":"https://www.doquizzes.com/QWXAF7","txt":"What does the function spl_autoload_register do?, Which of the following is a correct use of traits?, output buffer$GLOBALwhat is the purpose of $_REQUEST?func_get_args (note: in PHP 5.6+ it is different)session_start \/ headers already sentwhat does preg_match('\/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,}$\/', $var) do ?@ before function namePDO: quote vs prepare","img":"http://www.doquizzes.com/3012/images/ogquiz.png"}