B) Hypertext Preprocessor
B) Hypertext Preprocessor
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']