0% found this document useful (0 votes)
47 views

B) Hypertext Preprocessor

PHP stands for Hypertext Preprocessor and is a server-side scripting language used for web development. PHP code is embedded within HTML and processed by a PHP interpreter on the server to produce dynamic web pages. Key elements of PHP include using <?php ?> tags to delimit PHP code within an HTML document, and functions like echo and print to output data. Common PHP data types are strings, integers, floats, booleans, arrays, and objects. Control structures allow conditional and iterative processing, and forms can be used to collect user input for processing on the server.

Uploaded by

rekharawat56515
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views

B) Hypertext Preprocessor

PHP stands for Hypertext Preprocessor and is a server-side scripting language used for web development. PHP code is embedded within HTML and processed by a PHP interpreter on the server to produce dynamic web pages. Key elements of PHP include using <?php ?> tags to delimit PHP code within an HTML document, and functions like echo and print to output data. Common PHP data types are strings, integers, floats, booleans, arrays, and objects. Control structures allow conditional and iterative processing, and forms can be used to collect user input for processing on the server.

Uploaded by

rekharawat56515
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

PHP

1. What does PHP stand for?


a) HyperText Markup Language
b) Hypertext Preprocessor
c) Programming Hypertext Language
d) Programming Web language
2. In which version of PHP, Just-In-Time (JIT) Compiler was introduced?
a) PHP 5.0
b) PHP 7.0
c) PHP 8.0
d) PHP 9.0
3. Which of the following describes PHP?
a) Client-side scripting
b) Server-side scripting
c) Both A and B
d) None of these
4. What is the function of the PHP interpreter?
a) To connect ISP and the server
b) To process HTML and PHP files
c) To translate User language to System Language
d) All of these
5. Which of the following is used to begin a PHP script?
a) <?php
b) <php
c) ?php
d) <php?
6. PHP files have a default file extension of
a) .html
b) .xml
c) .php
d) .hphp
7. Which of the following is the correct syntax of PHP?
a) <?php >
b) <php >
c) ?php?
d) <?php?>
8. Which of the following is correct to add a PHP comment?
a) &...... &
b) //
c) /*......*/
d) Both (b) and (c)
9. Which of the following is used for displaying the output in PHP?
a) Echo
b) Write
c) Print
d) Both (a) and (c)
10. What will be the output of following PHP code?
<?php
header('Content-type: text/plain');
$year = "2025";
$str = '$year is arriving \t soon'; echo($str);
echo "\n";
$str = "$year is arriving \t soon"; echo ($str);
?>
A $year is arriving \t soon
2025 is arriving soon

B 2025 is arriving \t soon


2025 is arriving soon

C $year is arriving \t soon


$year is arriving \t soon

D None of these

a) A
b) B
c) C
d) D
11. Which of these is a compound data type in PHP?
a) array
b) struct
c) dictionary
d) integer
12. Which of the following is not a data type in PHP?
a) Resource
b) Object
c) Null
d) Void
13. How many values does Boolean data type hold?
a) 1
b) 2
c) 3
d) 4
14. Objects are specified as instances of user-defined classes that can hold
a) Lists
b) Functions
c) Constants
d) Variables, Constants, and Functions
15. Which of the following is the correct method of declaring a variable in PHP?
a. $variable name = value;
b. Şvariable_name = value;
c. $variable_name value
d. $variable name as value;
16. Which of the following is the correct use of the strcmp () function in PHP?
a. The strcmp() function is used for comparing the strings excluding case.
b. The strcmp() function is used for comparing the uppercase strings. c. The strcmp () function is
used for comparing the lowercase strings.
d. The strcmp () function is used for comparing the strings including case.
17. Which of the following is an invalid variable name?
a. $newVar
b. $new_Var
c. $new-var
d. All of these
18. String values in PHP must be enclosed within_________.
a. Double Quotes
b. Single Quotes
c. Double Quotes and Single Quotes
d. Double //
19. __________ can be used to test the type of any variable?
a. showtype ()
b. gettype ()
c. settype ()
d. type ()
20. Which loop evaluates the conditional expression before processing the loop?
A. for loop
B. while loop
C. do-while loop
D. All of these
21. What will be the output of the following PHP code?
<?php
for ($num 1; $num <= 10; $num += 2) {
echo "$num ";
}
?>
A. 13579
B. 12345
C. 97531
D. Error
22. What will be the output of the following PHP code?
<?php
$num = 20;
while ($num < 12) {
$num += 2;
echo $num, "\n";
}
?>
A. Error
B. No Output
C. infinite loop
D. Only one garbage value
23. Identify the output of the following PHP code:
<?php
foreach ($arr as $val) {
Şarr = array (10, 20, 30);
echo "$vall \n";
}
?>
A. 10 20 30
B. No Output
C. 10
D. undefined variable
24. Identify the output of the following code:
<?php
for ($a = 1; $a <= 10; $a++){
for ($b = 1; $a <= 5; $b++){
print "LFC";
}
}

?>
A. "LFC" will be printed 10 times
B. "LFC" will be printed 50 times
C. "LFC" will be printed 5 times
D. "LFC" will be printed 1 times
25. Which in-built function will add a value to the end of an array?
A. array_unshift()
B. into_array()
C. inend_array()
D. array_push ()
26. The _______ specifies the URL that will process form data and send the feedback.
a) Method
b) Form control
c) Action attribute
d) Body of the HTTP message
27. Which of the following option(s) is/are the key difference between GET and POST methods?
a) GET is used with HTTP protocol and POST is used with HTTPS.
b) GET displays the submitted data as part of the URL. However, while using POST, this
information is not shown.
c) GET is intended for changing server state and it carries more data than POST.
d) GET is more secure than POST and should be used for sensitive information.
28. Which of the following option(s) is/are used to enter text in PHP Forms?
a) input type="text"
b) input type="radio"
c) input type="textarea"
d) inputtype="null"
29. Which of the following option(s) is/are correct if a user tries to submit a form without entering
the text area or required field?
a) No error message will be displayed.
b) An error message will be displayed and the form will not get submitted.
c) An error message will display and the form is submitted.
d) The form is frozen.
30. Which of the following is the syntax for the GET method?
a) $varname = GET['variable']
b) varname = $_GET['variable']
c) $varname = $_GET['variable']
d) $varname = $GET['variable']

You might also like