PHP Web Development Quiz Questions

1)  How do you get information from a form that is submitted using the "GET" method ?
A) $_GET
B) $_POST
C) $_REQUEST
D) A&C
View Answer
 
2)  Which of the following function is used for terminate the script execution in PHP?
A) sleep()
B) stop()
C) die()
D) quit()
View Answer
 
3)  Does php support multiple inheritance?
A) Yes
B) No
C) Partially Supports
D) Supports through 3rd party tool
View Answer
 
4)  What is the correct way to create a function in PHP?
A) create myFunction()
B) function myFunction()
C) new myFunction()
D) static myFunction()
View Answer
 
5)  Which SQL statement is used to delete data from a database ?
A) DELETE
B) TRASH
C) REMOVE
D) CLEAN
View Answer
 
6)  Which of the following is correct ?
A) body{margin:0 auto:}
B) body{margin;0 auto:}
C) body:margin{0 auto}
D) body{margin:0 auto;}
View Answer
 
7)  Which of the following is used to connect with mysql database ?
A) mysqlconnect($host,$username,$password);
B) dbconnect($host,$username,$password);
C) mysql_connect($host,$username,$password);
D) mysql_db_connect($host,$username,$password);
View Answer
 
8)  Which of the following is used to check if the function already exists ?
A) func_exists(myfunction);
B) function_exists(functionname);
C) f_exists(functionname);
D) is_available(functionname);
View Answer
 
9)  What will be the output ?
FUNCTION SAYHELLO()
{
ECHO "HELLO WORLD";
}
sayhello();
?>
A) HELLO WORLD
B) function undefined error;
C) hello world
D) fatal error
View Answer
 
10)  Which property is used to change the background color ?
A) bgcolor
B) background-color
C) backgroundcolor
D) color
View Answer
 
11)  The PHP syntax is most similar to...
A) Java
B) Javascript
C) Perl and C
D) VB
View Answer
 
12)  Which of the following is NOT a valid PHP comparison operator ?
A) <=>
B) ===
C) <>
D) !=
View Answer
 
13)  Which of the following operator is error control operator ?
A) !
B) *
C) @
D) &
View Answer
 
14)  Which of the following operator is used to concatenate two strings in PHP ?
A) .
B) +
C) :
D) -
View Answer
 
15)  What is ECMA script ?
A) Perl Script
B) Python Script
C) Javascript
D) PHP script
View Answer
 
16)  Which of the following function removes duplication from an array ?
A) array_ unshift
B) array_ values
C) array_ merge
D) array_ unique
View Answer
 
17)  How many records will be given as output of the following query ?
select * from table LIMIT 25,100
A) 25
B) 100
C) 75
D) 125
View Answer
 
18)  Which of the following function can print a object content ?
A) print()
B) var_dump()
C) print_r()
D) echo
View Answer
 
19)  What will be the output ?

$var = 'false';
if ($var) {
echo 'true';
} else {
echo 'false';
}

?>
A) True
B) False
C) Error
D) No Output
View Answer
 
20)  What is the value of $xyz[2] ?

$xyz = array(
'a',
3 => 'b',
1 => 'c',
'd',
4 => 'e'
);
?>
A) a
B) d
C) e
D) Error
View Answer
 
21)  What is the output?

$arr = array(5 => 1, 12 => 2);
$arr[] = 56;
$arr["x"] = 42;
echo var_dump($arr);
);
?>
A) array(3) { [5]=> int(1) [12]=> int(2) }
B) array(3) { [5]=> int(1) [12]=> int(2) [13]=> int(56) }
C) array(4) { [5]=> int(1) [12]=> int(2) [13]=> int(56) ["x"]=> int(42) }
D) array(3) { [5]=> int(1) [12]=> int(2) ["x"]=> int(42) }
View Answer
 
22)  What will be the output?

echo substr("helloworld", -2);
echo ' , ';
echo substr("helloworld", 0, -1);

?>
A) ld , helloworl
B) he , helloarray
C) ld , elloworld
D) he , helloworl
View Answer
 
23)  What will be the output?

$str="100Rupees";
$cost=200;
$cost+=$str;
print($cost);
?>
A) 200
B) 300Rupees
C) 300
D) 100Rupees
View Answer
 
24)  What will be the output?

$x=array(1=>"paper",2=>"pen",3=>"pencil");
$y=array_keys($x);
echo $y[0];
?>
A) 1
B) paper
C) pen
D) 3
View Answer
 
25)  Which of the following was not a PHP framework?
A) Joomla
B) Jquery
C) CakePHP
D) Zend
View Answer