PHP Quiz: medium level (2/3)

If you were to create a class Student, inheriting the class Person, which of the following syntaxes would you use?
class Student {
  inherit Person;
}
class Student inherit Person {

}
class Student extends Person {

}
class Student: Person {

}
How do you call a static method?
MyClass::my_function();
$obj->my_function();
MyClass->my_function();
Static my_function();
Which of the following code is incorrect?
class MyClass {
  static $var = 0;
  public static function my_function() {
    static::$var = 1;
  }
}
class MyClass {
  function my_function() {
    $this->var = 1;
  }
}
class MyClass {
  static $var = 0;
  static function my_function() {
    self::$var = 2;
  }
}
class MyClass {
  public static function my_function() {
    $this->var = 1;
  }
}
What is the difference between "break" and "continue" in a foreach loop?
None, because "continue" is an alias for "break"
"break" stops the foreach loop, while "continue" only skips to the next iteration
"continue" stops the foreach loop, while "break" only skips to the next iteration
Actually, "continue" does not exist in PHP
What is the specific purpose of the "usort" function?
It can sort an array that contains an unlimited number of values
It can sort an array using a custom comparison function
It can sort an associative array based on the key
It can sort an array based on the value
What is the correct date format you should use if you want to generate date strings such as "2015-12-31"
Date("Y-m-d")
Date("d-m-Y")
Date("J-i-s")
Date("i-j-S")
What possible values should the comparison function of a custom sort call return?
0 or 1
An array
-1, 0, or 1
Any number between 1 and 100
What is the name of the standard library for image processing in PHP?
ImageLib
JPGProc
IPicture
GD Lib
Which of the following best describes the mechanism of serialization?
Serialization allows almost all types of variables to be stored as string, even arrays and objects
Serialization is an easy mechanism allowing developers to generate serial numbers within the code
Serialization allows developers to use the serial and USB ports of the server
Serialization creates multiple chains of objects based on integer values
Why is the following instruction unsafe? include($_GET["file"].".php");
There will be a fatal error if the specified file does not exist
There will be a fatal error if the "file" value is undefined in the $_GET array
An attacker could upload an external PHP file using this instruction
An attacker could exploit your site by including files that are not in the document root
{"name":"PHP Quiz: medium level (2\/3)", "url":"https://www.quiz-maker.com/QPREVIEW","txt":"If you were to create a class Student, inheriting the class Person, which of the following syntaxes would you use?, How do you call a static method?, Which of the following code is incorrect?","img":"https://www.quiz-maker.com/3012/images/ogquiz.png"}
Powered by: Quiz Maker