Q: Type Hinting was introduced in which version of PHP?
A.PHP 4
B.PHP 5
C.PHP 5.3
D.PHP 6
Correct Option: BExplanation: Type hinting gives you the ability to force parameters to be objects of certain class or to be arrays. PHP 5 introduced this feature.
Q: What will be the output of the following PHP code?
< ?php
echo ucwords("i love my country");
?>
A. I love my country
B. i love my Country
C.I love my Country
D.I Love My Country
Correct Option: DExplanation: The ucwords() function converts the first character of each word in a string to uppercase.
Q: What will be the output of the following PHP code?
Correct Option: CExplanation: If u want to put some variables in function that was not passed by it, you must use “global”. Inside the function type global $op2.
Q: What will be the output of the following PHP code?
< ?php
echo "chr(52)";
?>
A.1
B.2
C.3
D.4
Correct Option: DExplanation: The chr() function returns a character from the specified ASCII value. Since the ASCII value of 4 is 52, thus 4 was displayed.
Q: What will be the output of the following PHP code?
< ?php
echo lcfirst("welcome to India");
?>
A. welcome to India
B.welcome to india
C.Welcome to India
D.Welcome to india
Correct Option: AExplanation: The lcfirst() function converts the first character of a string to lowercase.
Q: Which function is useful when you want to output the executed command
A.out_cmm()
B.out_system()
C.cmm()
D. system()
Correct Option: DExplanation: system()
Q: What will be the output of the following PHP code?
< ?php
function a()
{
function b()
{
echo 'I am b';
}
echo 'I am a';
}
a();
a();
?>
A.I am b
B. I am bI am a
C.Error
D.I am a Error
Correct Option: DExplanation: This will be the output- I am a Fatal error: Cannot redeclare b()
Q: Which one of the following PHP functions can be used to find files?
A.glob()
B.file()
C.fold()
D.get_file()
Correct Option: AExplanation: glob()
Q: Which one of the following function is capable of reading a file into a string variable?