php mcq multiple choice questions objective question set

php mcq multiple choice questions objective question set

Ganesh

Name=Ganeshmarotraokadam
Class=Bcathird-year
Subject=php
.......................................................................................................................................................
.............
1.What is PHP?
a)PHP is an open-source programming language
b)PHP is used to develop dynamic and interactive websites
c)PHP is a server-side scripting language
d)All of the mentioned
Answer....D
2.Who is the father of PHP?
a)Drek Kolkevi
b)Rasmus Lerdorf
c)Willam Makepiece
d)List Barely
Answer....B
3.What does PHP stand for?
a)PHP stands for Preprocess or HomePage
b)PHP stands for Pretext Hypertext Processor
c)PHP stands for Hypertext Preprocessor
d)PHP stands for Personal Hyper Processor
Answer....C
4.Which of the following is the correct syntax to write a PHP code?
a)<?php?>
b)<php>
c)<?php?>
d)<??>
Answer....D
5.Which of the following is the correct way to add a comment in PHP code?
a)#
b)//
c)/**/
d)All of the mentioned
Answer....D
6.How to define a function in PHP?
a)functionName(parameters){functionbody}
b)function{functionbody}
c)function functionName(parameters){functionbody}
d)datatypefunctionName(parameters){functionbody}
Answer....C
7.Which of the following is the default file extension of PHP files?
a).php
b).ph
c).xml
d).html
Answer....A
8.Which is the right way of declaring a variable in PHP?
a)$3hello
b)$_hello
c)$this
d)$5_Hello
Answer....B
9.Which of the following directive determines the maximum amount of time that a PHP
 script will spend attempting to parse in put before registering a fatal error?
a)max_take_time
b)max_intake_time
c)max_input_time
d)max_parse_time
Answer....C
10.Which version of PHP introduced the instance of keyword?
a)PHP6
b)PHP4
c)PHP5
d)PHP5.3
Answer....C
11.Which variable is used to collect form data sent with both the GET and POST
 methods?
a)$_BOTH
b)$REQUEST
c)$_REQUEST
d)$BOTH
Answer....C
12.What will be the output of the following PHP code?
<?php
function constant()
{
define("GREETING","Welcome to india",true);
echogreeting;
}
?>
a)GREETING
b)Welcome to india
c)ERROR
d)greeting
Answer....B
13.Which PHP function displays the webpage’s most recent modification date?
a)getlastmod()
b)get_last_mod()
c)lastmod()
d)last_mod()
Answer....A
14.Which one of the following is the default PHP session name?
a)PHPSESSIONID
b)PHPIDSESS
c)PHPSESSID
d)PHPSESID
Answer....C
15.Which of the following PHP function will return true if a variable is an array or false if 
it is not an array?
a)in_array()
b)do_array()
c)this_array()
d)is_array()
Answer....D
16.PHP’s numerically indexed array begin with position___________
a)0
b)3
c)-1
d)2
Answer....A
17.Which version of PHP introduced the advanced concepts of OOP?
a)PHP6
b)PHP4
c)PHP5
d)PHP5.3
Answer....C
18.Which of the following method scope is not supported by PHP?
a)private
b)friendly
c)static
d)abstract
Answer....B
19.Which PHP statement will give output as $xonthescreen?
a)echo“\$x”;
b)echo“$$x”;
c)echo“/$x”;
d)echo“$x;”;
Answer....A
20.What does PDO stand for?
a)PHPDatabaseOrientation
b)PHPDataOrientation
c)PHPDataObject
d)PHPDatabaseObject
Answer....C
21.The developers of PHP deprecated the safemode feature as of which PHP version?
a)PHP5.3.1
b)PHP5.3.0
c)PHP5.1.0
d)PHP5.2.0
Answer....B
22.PHP recognizes constructors by the name_________
a)function__construct()
b)function_construct()
c)classname()
d)_construct()
Answer....A
23.Which one of the following PHP function is used to determine a file’s last access
 time?
a)filetime()
b)fileatime()
c)fileltime()
d)filectime()
Answer....B
24.Which of the following PHP functions can be used to get the current memory usage?
a)memory_get_usage()
b)memory_get_peak_usage()
c)get_peak_usage()
d)get_usage()
Answer....A
25.Which of the following web servers are required to run the PHP script?
a)ApacheandPHP
b)IIS
c)XAMPP
d)Any of the mentioned
Answer....B
26.How many functions does PHP offer for searching and modifying strings using Perl-
compatible regulare xpressions.
a)10
b)7
c)8
d)9
Answer....C
27.A function in PHP which starts with__(double underscore)is known as__________
a)DefaultFunction
b)UserDefinedFunction
c)InbuiltFunction
d)MagicFunction
Answer....D
28.Which of the following PHP functions can be used for generating unique ids?
a)md5()
b)uniqueid()
c)mdid()
d)id()
Answer....B
29.Variable name in PHP starts with-
a)!(Exclamation)
b)$(Dollar)
c)&(Ampersand)
d)#(Hash)
Answer....B
30.Which of the following is not a variable scope in PHP?
a)Extern
b)Local
c)Static
d)Global
Answer....A
31.What will be the output of the following program?
<?php
echo ucwords("welcome to india");
?>
a)Welcome To India
b)to india
c)Welcome india
d)Welcome to an india 
Answer....at
32.Which of the following function is used to compute the difference between two 
arrays in PHP?
a)diff_array
b)array_diff
c)arrays_diff
d)diff_arrays
Answer....B
33.Which PHP function converts an English text date time into a Unix time stamp?
a)str_to_time()
b)strtodate()
c)strtotime()
d)None of the above
Answer....C
34.Which of the following function in PHP returns the time of sun rise of a particular day and location?
a)date_sunrise()
b)date-sunrise()
c)sunrise()
d)Noneoftheabove
Answer....A
35.Which PHP function is capable to read specific number of characters from a file?
a)filegets()
b)fget()
c)fgets()
d)Noneoftheabove
Answer....C
36.Which PHP function determines the last access time of a file?
a)filetime()
b)fileatime()
c)filectime()
d)Noneoftheabove
Answer....B
37.The function in PHP that can be used to concatenate array element to form a
 single delimited string is-
a)implode()
b)concat()
c)explode()
d)concatenate()
Answer....A
38.What does SPL stands for in PHP?
a)StandardPHPLibrary
b)SimplePHPLibrary
c)SimplePHPList
d)Noneoftheabove
Answer....A
39.Which of the following function is used to compress a string in PHP?
a)compress()
b)zip_compress()
c)gzcompress()
d)zip()
Answer....C
40.Which of the following is the correct way to print "HelloWorld" in PHP?
a)printf"HelloWorld";
b)write("HelloWorld");
c)echo"HelloWorld";
d)None of the above
Answer....C
41.Which of the following is a built-in function in PHP that adds a value to the end of an 
array?
a)array_push()
b)inend_array()
c)into_array()
d)Noneoftheabove
Answer....A
42.String values in PHP must been closed within-
a)DoubleQuotes
b)SingleQuotes
c)Both(a)and(b)
d)Noneoftheabove
Answer....C
43.Which of the following function in PHP can be used to test the type of any variable?
a)showtype()
b)gettype()
c)settype()
d)Noneoftheabove
Answer....B
44.Which of the following is/are the code editors in PHP?
a)Notepad++
b)Notepad
c)AdobeDreamweaver
d)Alloftheabove
Answer....D
45.Which of the following function is used to sort an array in descending order?
a)sort()
b)asrot()
c)dsort()
d)rsort()
Answer....D
46.Which of the following function is used to unset a variable in PHP?
a)delete()
b)unset()
c)unlink()
d)Noneoftheabove
Answer....B
47.Which of the following function displays the information about PHP and its 
configuration?
a)php_info()
b)phpinfo()
c)info()
d)Noneoftheabove
Answer....B
48.Which of the following is used to display the output in PHP?
a)echo
b)write
c)print
d)Both(a)and(c)
Answer....D
49.Which of the following is used to end a statement in PHP?
a).(dot)
b);(semicolon)
c)!(exclamation)
d)/(slash)
Answer....B
50.Which of the following variable name is invalid?
a)$newVar
b)$new_Var
c)$new-var
d)Alloftheabove
Answer....C



Comments

Popular posts from this blog