R4RIN
Articles
Java 8
MCQS
PHP MCQ Quiz Hub
Current affairs mcq php
Choose a topic to test your knowledge and improve your PHP skills
1. PHP Stands for
Php Hypertext Processor
Php Hypertext Preprocessor
Php Hypermarkup Preprocessor
Php Hypermarkup Processor
2. PHP is _______ scripting language.
Server-side
Clint-side
Middle-side
Out-side
3. PHP scripts are executed on _________
ISP Computer
Client Computer
Server Computer
It depends on PHP scripts
4. PHP Scripts starts with ________
<php> … </php>
<?php … ?>
?php … ?php
<p> … </p>
5. Which of the following statements prints in PHP?
Out
Write
Echo
Display
6. In PHP, each statement must be end with ______
(dot)
(semicolon)
(slash)
(colon)
7. In PHP Language variables name starts with _____
! (Exclamation)
& (Ampersand)
* (Asterisk)
$ (Dollar)
8. In PHP Language variables are case sensitive
TRUE
FALSE
Depends on website
Depends on server
9. In PHP a variable needs to be declare before assign
TRUE
FALSE
Depends on website
Depends on server
10. Which of the following is not the scope of Variable in PHP?
Local
Global
Static
Extern
11. What is the use of strlen( ) function in PHP?
It returns the type of a string
It returns the value of a string
It returns the length of a string
It returns the subset value of a string
12. Which of the following is the Concatenation Operator in PHP?
+ (Plus)
. (dot)
& (Ampersand)
% (Percentage)
13. Which of the following is not PHP Loops?
while
do while
for
do for
14. What is the use of strpos( ) function in PHP?
Search for a number within a string
Search for a Spaces within a string
Search for a character/text within a string
Search for a Capitalized string/text with in a string
15. Where setcookie( ) function must appear in PHP?
Before tag
After tag
In tag
Anywhere
16. What does the hash (#) sign mean in PHP?
It indicates lines that are commented out.
It indicates variable declaration.
It indicates function declaration.
No uses in PHP.
17. How to define a variable in PHP?
$variable_name = value
$variable_name = value;
$variable_name == value
$variable_name as value;
18. The uses of strcmp( ) function in PHP?
It compare strings including case
It compare strings excluding case
It compare strings only Uppercase
It compare strings only lowercase
19. What will be the result of combining a string with another data type in PHP?
int
float
string
double
20. Data for a cookie stored in _________ in PHP?
In ISP Computer
In Users Computer
In Server Computer
It depends on PHP Coding
21. PHP is a ______ typed language.
User
Loosely
Server
System
22. What does fopen() function do in PHP?
It used to open files in PHP
It used to open Remote Server
It used to open folders in PHP
It used to open Remote Computer
23. Where session_start() function must appear in PHP?
Anywhere
With <html> tag
After <html>tag
Before <html> tag
24. What does the PHP Interpreter do?
It translates User Language to System Language
It creates connection between ISP & Server
It processes the HTML and PHP files
All of these
25. Which of the following is used to add comments in PHP?
//
/* … */
& … &
Only A & B
26. What does sprintf() function do in PHP?
it sends output to a variable
it prints the output of program
it sends output to a variable converting into string
it prints the output of program converting into string
27. Which function displays the information about PHP?
info()
sysinfo()
phpinfo()
php_info()
28. What does isset() function do in PHP?
There is no such function in PHP
It checks whether variable is set or not
It checks whether variable is free or not
It checks whether variable is string or integer
29. How PHP files can be accessed?
Through Web Browser
Through HTML files
Through Web Server
All of Above
30. A script is a
Program or sequence of instructions that is interpreted or carried out by processor directly
Program or sequence of instruction that is interpreted or carried out by another program
Program or sequence of instruction that is interpreted or carried out by web server only
None of above
31. When compared to the compiled program, scripts run
Faster
Slower
The execution speed is similar
All of above
32. PHP is a widely used ... scripting language that is especially suited for web development and can be embedded into html
Open source general purpose
Proprietary general purpose
Open source special purpose
Proprietary special purpose
33. Which of the following is not true?
PHP can be used to develop web applications.
PHP makes a website dynamic.
PHP applications can not be compiled.
PHP can not be embedded into html.
34. Which of the following variables is not a predefined variable?
$get
$ask
$request
$post
35. You can define a constant by using the define() function. Once a constant is defined
It can never be changed or undefined
It can never be changed but can be undefined
It can be changed but can not be undefined
It can be changed and can be undefined
36. Which of the following function returns the number of characters in a string variable?
count($variable)
len($variable)
strcount($variable)
strlen($variable)
37. When you need to obtain the ASCII value of a character which of the following function you apply in PHP?
chr( );
asc( );
ord( );
val( );
38. A variable $word is set to HELLO WORLD, which of the following script returns in title case?
echo ucwords($word)
echo ucwords(strtolower($word)
echo ucfirst($word)
echo ucfirst(strtolower($word)
39. The difference between include() and require()
are different how they handle failure
both are same in every aspects
is include() produced a Fatal Error while require results in a Warning
none of above
40. When a file is included the code it contains, behave for variable scope of the line on which the include occurs
Any variable available at that line in the calling file will be available within the called file from that point
Any variable available at that line in the calling file will not be available within thecalled file
Variables are local in both called and calling files
None of above
41. Which of the following method sends input to a script via a URL?
Get
Post
Both
None
42. Which of the following method is suitable when you need to send larger form submissions?
Get
Post
Both Get and Post
There is no direct way for larger form. You need to store them in a file and retrieve
43. 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.
W
W+
A
A+
44. The function setcookie( ) is used to
Enable or disable cookie support
Declare cookie variables
Store data in cookie variable
All of above
45. To work with remote files in PHP you need to enable
allow_url_fopen
allow_remote_files
both of above
none of above
46. fopen($file_doc,r+&rdquo opens a file for
reading
writing
none of above
both of above
47. In mail($param2, $param2, $param3, $param4), the $param2 contains:
The message
The recipient
The header
The subject
48. mysql_connect( ) does not take following parameter
database host
user ID
password
database name
49. Which of the following is not a session function?
sssion_decode
session_destroy
session_destroy
session_pw
50. When uploading a file if the UPLOAD_ERR-OK contains value 0 it means
Uplaod is not successful, error occurred
The file uploaded with success
Uploaded file size is 0
File upload progress is 0% completed
Submit