1. missing
==
2.What is the best way to test if $param is an anonymous function in a method?
Use method_exists($param, ‘__invoke’);
Use is_callable($param);
Use the type-hint Closure on the signature.
Use is_executable($param);
==
3. Reflection functions cannot?
Instantiate objects
Modify static properties of the class
Get the namespace of a class
Modify static variables in functions
None of the above.
==
4. What’s the difference between accessing a class method via -> and via ::?
:: is allowed to access methods that can perform private and public operations, i.e. those, which do not require object initialization.
:: is allowed to access methods that can perform static operations, i.e. those, which do not require object initialization.
:: is allowed to access methods that can perform public operations, i.e. those, which do not require object initialization.
:: is allowed to access methods that can perform public and static operations, i.e. those, which do not require object initialization.
==
5. Which Sql statement will give an error?
SELECT c.Name, COUNT(*) CityCnt FROM Country c JOIN City ON Code = CountryCode WHERE Continent = 'Brazil' AND CityCnt >20 GROUP BY c.Name ORDER BY CityCnt DESC
SELECT c.Name, COUNT(*) CityCnt FROM Country c JOIN City ON Code = CountryCode AND Continent = 'Brazil' AND CityCnt >20 GROUP BY c.Name ORDER BY CityCnt DESC
SELECT c.Name, COUNT(*) CityCnt FROM Country c JOIN City ON Code = CountryCode AND Continent = 'Brazil' GROUP BY c.Name ORDER BY CityCnt DESC
SELECT c.Name, COUNT(*) CityCnt FROM Country c JOIN City ON Code = CountryCode WHERE Continent = 'Brazil' GROUP BY c.Name ORDER BY CityCnt DESC
SELECT c.Name, COUNT(*) CityCnt FROM Country c JOIN City ON Code = CountryCode AND Continent = 'Brazil' GROUP BY c.Name HAVING CityCnt >20 ORDER BY CityCnt DESC
==
6. What is the output of the following code?
Interface mybclass1{
public function doA();
public function specialfunction1();
}
Interface mybclass2{
public function doA();
public function specialfunction2();
}
Class myC implements mybclass1, mybclass2{
public function doA(){
echo ‘a’;
}
public function myspecialfunction1 (){
echo ‘a’;
}
public function myspecialfunction2 (){
echo ‘a’;
}
$a = new myC();
$a->daA();
}
1. a
2. PHP Fatal Error
3. PHP Parser Error
4. None of the above
==
7. What’s the difference between htmlentities() and htmlspecialchars()?
htmlspecialchars only takes care of <, >, single quote, double quote and ampersand. htmlentities translates all occurrences of character sequences that have different meaning in HTML.
htmlentities only takes care of <, >, single quote, double quote and ampersand. htmlspecialchars translates all occurrences of character sequences that have different meaning in HTML.
I don't know
I do know and it is none of the above.
==
8. If I have password encrypted in md5 in the db which of the following will be the best way to compare between user login password to the password in the db?
$password = md5($_POST['user_password']) 'SELECT * FROM USERS WHERE password = $password'
$password = $_POST[md5('user_password')] 'SELECT * FROM USERS WHERE password = $password'
$password = $_POST['user_password'] 'SELECT * FROM USERS WHERE password = md5($password)'
All of the above.
Two of the above.
None of the above.
==
9. $x = 199=='199' ? 'yes' : 'no';
echo $x;
The output of this script will be:
no
yes
None of the above.
==
11. Which syntax is correct use of closure?
function x(){$a = 5;return function()($a){print $a;$a= 6;}}
function x(){$a = 5;return function() use ($a){print $a;$a= 6;}}
function x(){$a = 5;return function($a){print $a;$a= 6;}}
none of above
==
12. How would you create an object, which is an instance of “myclass”?
$obj = new myclass();
$obj = myclass();
$obj::myclass(); - only if the class is static
$obj = myclass instance();
None of the above.
==
13. How to access a static variable name description outside of its class Person?
parent::description
person::$description
person->description
person::description
self::$description
==
14. http response header consist of?
Http-Version, Reason-Phrase, Date.
Content-Length, Content-Type, Status-Code, Reason-Phrase.
Http-Version, Status-Code, Date, Reason-Phrase.
Http-Version, Status-code, Reason-Phrase.
Http-Version, Content-Type, Content-Length, Status-Code
=
15. Which join will preserve all the row in one table in the result set, whether or not there are corresponding row in the other table?
join
matrix join
left join
natural join
none of above
==
16. What are lambdas?
anonymous function, cannot be dynamically generated, assigned to a variable, may be function parameter, may be returned value left join
anonymous function, dynamically generated, cannot be assigned to a variable, cannot have function parameter, may be returned value
anonymous function, dynamically generated, assigned to a variable, cannot have function parameter, may be returned value
anonymous function, dynamically generated, assigned to a variable, may be function parameter, cannot have a returned value
is not a anonymous function, dynamically generated, assigned to a variable, may be function parameter, may be returned value
None of above
==
17. Which of the following is part of magic methods?
toString,__constructor, __destructor
__get, __set, destructor
__tostring, __set, constructor
__set, __get, __toString
None of the above
==
18. How do you get information from a form that is submitted using the "get" method?
Request.QuertString;
Request.Form;
$_GET[];
$GET[];
I don't know.
None of the above.
==
20. What is the output of the following code?
$f= function($a=0,$b=1) use(&$f){
static $arr = array(0,1);
$next = ($a +$b);
if($next >55){
return implode(',', $arr);
}else{
$arr[] = $next;
list($a, $b) = array($b,$next);
return $f($a,$b);
}
);
0,1,1,2,3,5,8,13,21,34,55,89
1,1,1,1,1,1,1,1,1,1,1
0,1,1,2,3,5,8,13,21,34,55
1,2,3,4,4,5,6,7,8,9,11
None of the above
==
==
2.What is the best way to test if $param is an anonymous function in a method?
Use method_exists($param, ‘__invoke’);
Use is_callable($param);
Use the type-hint Closure on the signature.
Use is_executable($param);
==
3. Reflection functions cannot?
Instantiate objects
Modify static properties of the class
Get the namespace of a class
Modify static variables in functions
None of the above.
==
4. What’s the difference between accessing a class method via -> and via ::?
:: is allowed to access methods that can perform private and public operations, i.e. those, which do not require object initialization.
:: is allowed to access methods that can perform static operations, i.e. those, which do not require object initialization.
:: is allowed to access methods that can perform public operations, i.e. those, which do not require object initialization.
:: is allowed to access methods that can perform public and static operations, i.e. those, which do not require object initialization.
==
5. Which Sql statement will give an error?
SELECT c.Name, COUNT(*) CityCnt FROM Country c JOIN City ON Code = CountryCode WHERE Continent = 'Brazil' AND CityCnt >20 GROUP BY c.Name ORDER BY CityCnt DESC
SELECT c.Name, COUNT(*) CityCnt FROM Country c JOIN City ON Code = CountryCode AND Continent = 'Brazil' AND CityCnt >20 GROUP BY c.Name ORDER BY CityCnt DESC
SELECT c.Name, COUNT(*) CityCnt FROM Country c JOIN City ON Code = CountryCode AND Continent = 'Brazil' GROUP BY c.Name ORDER BY CityCnt DESC
SELECT c.Name, COUNT(*) CityCnt FROM Country c JOIN City ON Code = CountryCode WHERE Continent = 'Brazil' GROUP BY c.Name ORDER BY CityCnt DESC
SELECT c.Name, COUNT(*) CityCnt FROM Country c JOIN City ON Code = CountryCode AND Continent = 'Brazil' GROUP BY c.Name HAVING CityCnt >20 ORDER BY CityCnt DESC
==
6. What is the output of the following code?
Interface mybclass1{
public function doA();
public function specialfunction1();
}
Interface mybclass2{
public function doA();
public function specialfunction2();
}
Class myC implements mybclass1, mybclass2{
public function doA(){
echo ‘a’;
}
public function myspecialfunction1 (){
echo ‘a’;
}
public function myspecialfunction2 (){
echo ‘a’;
}
$a = new myC();
$a->daA();
}
1. a
2. PHP Fatal Error
3. PHP Parser Error
4. None of the above
==
7. What’s the difference between htmlentities() and htmlspecialchars()?
htmlspecialchars only takes care of <, >, single quote, double quote and ampersand. htmlentities translates all occurrences of character sequences that have different meaning in HTML.
htmlentities only takes care of <, >, single quote, double quote and ampersand. htmlspecialchars translates all occurrences of character sequences that have different meaning in HTML.
I don't know
I do know and it is none of the above.
==
8. If I have password encrypted in md5 in the db which of the following will be the best way to compare between user login password to the password in the db?
$password = md5($_POST['user_password']) 'SELECT * FROM USERS WHERE password = $password'
$password = $_POST[md5('user_password')] 'SELECT * FROM USERS WHERE password = $password'
$password = $_POST['user_password'] 'SELECT * FROM USERS WHERE password = md5($password)'
All of the above.
Two of the above.
None of the above.
==
9. $x = 199=='199' ? 'yes' : 'no';
echo $x;
The output of this script will be:
no
yes
None of the above.
==
11. Which syntax is correct use of closure?
function x(){$a = 5;return function()($a){print $a;$a= 6;}}
function x(){$a = 5;return function() use ($a){print $a;$a= 6;}}
function x(){$a = 5;return function($a){print $a;$a= 6;}}
none of above
==
12. How would you create an object, which is an instance of “myclass”?
$obj = new myclass();
$obj = myclass();
$obj::myclass(); - only if the class is static
$obj = myclass instance();
None of the above.
==
13. How to access a static variable name description outside of its class Person?
parent::description
person::$description
person->description
person::description
self::$description
==
14. http response header consist of?
Http-Version, Reason-Phrase, Date.
Content-Length, Content-Type, Status-Code, Reason-Phrase.
Http-Version, Status-Code, Date, Reason-Phrase.
Http-Version, Status-code, Reason-Phrase.
Http-Version, Content-Type, Content-Length, Status-Code
=
15. Which join will preserve all the row in one table in the result set, whether or not there are corresponding row in the other table?
join
matrix join
left join
natural join
none of above
==
16. What are lambdas?
anonymous function, cannot be dynamically generated, assigned to a variable, may be function parameter, may be returned value left join
anonymous function, dynamically generated, cannot be assigned to a variable, cannot have function parameter, may be returned value
anonymous function, dynamically generated, assigned to a variable, cannot have function parameter, may be returned value
anonymous function, dynamically generated, assigned to a variable, may be function parameter, cannot have a returned value
is not a anonymous function, dynamically generated, assigned to a variable, may be function parameter, may be returned value
None of above
==
17. Which of the following is part of magic methods?
toString,__constructor, __destructor
__get, __set, destructor
__tostring, __set, constructor
__set, __get, __toString
None of the above
==
18. How do you get information from a form that is submitted using the "get" method?
Request.QuertString;
Request.Form;
$_GET[];
$GET[];
I don't know.
None of the above.
==
20. What is the output of the following code?
$f= function($a=0,$b=1) use(&$f){
static $arr = array(0,1);
$next = ($a +$b);
if($next >55){
return implode(',', $arr);
}else{
$arr[] = $next;
list($a, $b) = array($b,$next);
return $f($a,$b);
}
);
0,1,1,2,3,5,8,13,21,34,55,89
1,1,1,1,1,1,1,1,1,1,1
0,1,1,2,3,5,8,13,21,34,55
1,2,3,4,4,5,6,7,8,9,11
None of the above
==