Search This Blog
Network security mobile application development and enterpreneur development management system MCQ question available on this platform.Asked MCQ Question| Asked Theoretical Questions. Multiple choice Questions from Examdeva
Recent Posts
PHP multiple choice Questions and Answers
php multiple choice questions and answers
PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages. PHP is a widely-used, free .The Hypertext Preprocessor (PHP) is a programming language that allows web developers to create dynamic content that interacts with databases
1. PHP Stands for
A. Php Hypertext Processor
B. Php Hypertext Preprocessor
C. Php Hypermarkup Preprocessor
D. Php Hypermarkup Processor
2. PHP is _______ scripting language.
A. Server-side
B. Clint-side
C. Middle-side
D. Out-side
3. PHP scripts are executed on _________
A. ISP Computer
B. Client Computer
C. Server Computer
D. It depends on PHP scripts
4. PHP Scripts starts with ________
A. <php> … </php>
B. <?php …. ?>
C. ?php … ?php
D. <p> … </p>
5. Which of the following statements prints in PHP?
A. Out
B. Write
C. Echo
D. Display
6. In PHP, each statement must be end with ______
A. . (dot)
B. ; (semicolon)
C. / (slash)
D. : (colon)
7. In PHP Language variables name starts with _____
A. ! (Exclamation)
B. & (Ampersand)
C. * (Asterisk)
D. $ (Dollar)
8. In PHP Language variables are case sensitive
A. True
B. False
C. Depends on website
D. Depends on server
9. In PHP a variable needs to be declare before assign
A. True
B. False
C. Depends on website
D. Depends on server
10. Which of the following is not the scope of Variable in PHP?
A. Local
B. Global
C. Static
D. Extern
11. What is the use of strlen( ) function in PHP?
A. It returns the type of a string
B. It returns the value of a string
C. It returns the length of a string
D. It returns the subset value of a string
12. Which of the following is the Concatenation Operator in PHP?
A. + (Plus)
B. . (dot)
C. & (Ampersand)
D. % (Percentage)
13. Which of the following is not PHP Loops?
A. while
B. do while
C. for
D. do for
14. What is the use of strpos( ) function in PHP?
A. Search for a number within a string
B. Search for a Spaces within a string
C. Search for a character/text within a string
D. Search for a Capitalized string/text with in a string
15. Where setcookie( ) function must appear in PHP?
A. Before tag
B. After tag
C. In tag
D. Anywhere
16. What does the hash (#) sign mean in PHP?
A. It indicates lines that are commented out.
B. It indicates variable declaration.
C. It indicates function declaration.
D. No uses in PHP.
17. How to define a variable in PHP?
A. $variable_name = value
B. $variable_name = value;
C. $variable_name == value;
D. $variable_name as value;
18. The uses of strcmp( ) function in PHP?
A. It compare strings including case
B. It compare strings excluding case
C. It compare strings only Uppercase
D. It compare strings only lowercase
19. What will be the result of combining a string with another data type in PHP?
A. int
B. float
C. string
D. double
20. Data for a cookie stored in _________ in PHP?
A. In ISP Computer
B. In User’s Computer
C. In Server Computer
D. It depends on PHP Coding
21. PHP is a ______ typed language.
A. User
B. Loosely
C. Server
D. System
22. What does fopen() function do in PHP?
A. It used to open files in PHP
B. It used to open Remote Server
C. It used to open folders in PHP
D. It used to open Remote Computer
23. Where session_start() function must appear in PHP?
A. Anywhere
B. With <html> tag
C. After <html>tag
D. Before <html> tag
24. What does the PHP Interpreter do?
A. It translates User Language to System Language
B. It creates connection between ISP & Server
C. It processes the HTML and PHP files
D. All of these
25. Which of the following is used to add comments in PHP?
A. //
B. /* … */
C. & … &
D. Only A & B
26. What does sprintf() function do in PHP?
A. it sends output to a variable
B. it prints the output of program
C. it sends output to a variable converting into string
D. it prints the output of program converting into string
27. Variables are case-sensitive in PHP?
A. True
B. False
28. Which function displays the information about PHP?
A. info()
B. sysinfo()
C. phpinfo()
D. php_info()
29. What does isset() function do in PHP?
A. There is no such function in PHP
B. It checks whether variable is set or not
C. It checks whether variable is free or not
D. It checks whether variable is string or integer
30. How PHP files can be accessed?
A. Through Web Browser
B. Through HTML files
C. Through Web Server
D. All of Above
31. A script is a
A. Program or sequence of instructions that is interpreted or carried out by processor directly
b. Program or sequence of instruction that is interpreted or carried out by another
program
c. Program or sequence of instruction that is interpreted or carried out by web
server only
d. None of above
32. When compared to the compiled program, scripts run
a. Faster
b. Slower
c. The execution speed is similar
d. All of above
33. PHP is a widely used ……………. scripting language that is especially suited for
web development and can be embedded into html
a. Open source general purpose
b. Proprietary general purpose
c. Open source special purpose
d. Proprietary special purpose
24. Which of the following is not true?
a. PHP can be used to develop web applications.
b. PHP makes a website dynamic.
c. PHP applications can not be compiled.
d. PHP can not be embedded into html.
25. The most portable version of PHP tag that is compatible to embed in XML or
XHTML too is:
a. <? ?>
b. <script language=”php”> </script>
c. <% %>
d.
26. Which of the following variables is not a predefined variable?
a. $get
b. $ask
c. $request
d. $post
27. You can define a constant by using the define() function. Once a constant is
defined
a. It can never be changed or undefined
b. It can never be changed but can be undefined
c. It can be changed but can not be undefined
d. It can be changed and can be undefined
28. The following piece of script will output:
<?
$email=’admin@psexam.com’;
$new=strstr($email, ‘@&rsquo ;
print $new;
?>
a. admin
b. admin@psexam
c. @psexam.com
d. psexam.com
29. Which of the following function returns the number of characters in a string
variable?
a. count($variable)
b. len($variable)
c. strcount($variable)
d. strlen($variable)
40. When you need to obtain the ASCII value of a character which of the following
function you apply in PHP?
a. chr( );
b. asc( );
c. ord( );
d. val( );
41. A variable $word is set to “HELLO WORLD”, which of the following script returns in
title case?
a. echo ucwords($word)
b. echo ucwords(strtolower($word)
c. echo ucfirst($word)
d. echo ucfirst(strtolower($word)
42. The difference between include() and require()
a. are different how they handle failure
b. both are same in every aspects
c. is include() produced a Fatal Error while require results in a Warning
d. none of above
43. When a file is included the code it contains, behave for variable scope of the line
on which the include occurs
a. Any variable available at that line in the calling file will be available within the
called file from that point
b. Any variable available at that line in the calling file will not be available within the
called file
c. Variables are local in both called and calling files
d. None of above
44. Which of the following method sends input to a script via a URL?
a. Get
b. Post
c. Both
d. None
45. Which of the following method is suitable when you need to send larger form
submissions?
a. Get
b. Post
c. Both Get and Post
d. There is no direct way for larger form. You need to store them in a file and
retrieve
46. Which of the following mode of fopen() function opens a file only for writing. If a file
with that name does not exist, attempts to create anew file. If the file exist, place the file
pointer at the end of the file after all other data.
a. W
b. W+
c. A
d. A+
47. The function setcookie( ) is used to
a. Enable or disable cookie support
b. Declare cookie variables
c. Store data in cookie variable
d. All of above
48. To work with remote files in PHP you need to enable
a. allow_url_fopen
b. allow_remote_files
c. both of above
d. none of above
49. fopen($file_doc,”r+&rdquo opens a file for
a. reading
b. writing
c. none of above
d. both of above
50. In mail($param2, $param2, $param3, $param4), the $param2 contains:
a. The message
b. The recipient
c. The header
d. The subject
51. mysql_connect( ) does not take following parameter
a. database host
b. user ID
c. password
d. database name
52. Study following steps and determine the correct order
(1) Open a connection to MySql server
(2) Execute the SQL query
(3) Fetch the data from query
(4) Select database
(5) Close Connection
a. 1, 4, 2, 3, 5
b. 4, 1, 2, 3, 5
c. 1, 5, 4, 2, 1
d. 4, 1, 3, 2, 5
53. Which of the following is not a session function?
a. sssion_decode
b. session_destroy
c. session_id
d. session_pw
54. When uploading a file if the UPLOAD_ERR-OK contains value 0 it means
a. Uplaod is not successful, error occurred
b. The file uploaded with success
c. Uploaded file size is 0
d. File upload progress is 0% completed
55. Which of the following delimiter syntax is PHP's default delimiter syntax
a. <? php ?>
b. <% %>
c. <? ?>
d. <script language="php"> </script>
56. Which of the following statement produce different output
a. <?echo "This is php example"; ?>
b. <P="This is php example"; ?>
c. <?PHP echo "This is php example"; php?>
d. <script language="php"> print "This is php example";</script>
57. Which of the following delimiter is ASP style?
a.
b. <% %>
c. <? ?>
d. <script language="php"> </script>
58. Php supports all four different ways of delimiting. In this context identify the false
statement
a. You can use any of the delimiting style
b. You can use different delimiting styles in same page
c. You can use any delimiting style but must use a single style consistently for a
page
d. Variables declared in previous blocks are remenbered on later blocks too!
59. Which of following commenting is supported by Php
a. Single line c++ syntax - //
b. Shell syntax - #
c. Both of above
d. None of above
60. To produce the output6 I love the summer time, Which of the ofllowing statement
should be used?
a. <? Php print ("<P> I love the summer time</p>" ;?>
b. <? Php $ season="summer time"; print"<p> I love the $ season</p>"; ?>
c. <?Php $ message="<p> I love the summer time </p>; ecdho $ message; ?>
d. All of above
61. Which of following function return 1 when output is successful?
a. echo ( )
b. print ( )
80. Identify the variable scope that is not supported by PHP
81. The output of ofllowing script would be
82. Variable scope on which a variable does not loose its value when the function
a. multiplication
b. Because the included code will be embedded in a PHP execution block, the PHP execution block, the PHP escape tags (<?php?> aren't required on the file to be included
c. For the inclusion of remote files the allow-url-pope must be enabled ad URL wrapper must be supported
d. Including a file produces the same result as copying the data from the file specified
into the location in which the statement appears.
86. Which of the following functions require the allow-url-fopen must be enabled?
a. include()
b. require()
c. both of above
d. None of above
87. Which function includes the specified file even the statement evaluates to false in
which block the function is placed.
a. include ()
b. require ()
c. both of above
d. None of above
88. On failure of which statement the script execution stops displaying error/warning
message?
a. rinclude ()
b. require ()
c. both of above
d. None of above
89. Trace the function that does continue the script execution even if the file inclusion
fails
a. include ()
b. require ()
c. both of above
d. None of above

Comments
Post a Comment