1. What does PHP stand for?
a) Personal Hypertext Processor
b) Private Home Page
c) PHP: Hypertext Preprocessor
d) Professional Hosting Provider
Β
2. Which symbol is used to declare a variable in PHP?
a) @
b) $
c) #
d) %
Β
3. How do you write a comment in PHP?
a) <!– comment –>
b) // comment
c) # comment
d) Both b and c
Β
4. Which of the following is the correct way to start a PHP block?
a) <php>
b) <?php>
c) <?php
d) <script>
Β
5. Which function is used to output text in PHP?
a) echo()
b) write()
c) print()
d) Both a and c
Β
6. Which of the following is a correct array declaration in PHP?
a) $arr = array(\”one\”, \”two\”);
b) arr[] = {\”one\”, \”two\”};
c) array = [\”one\”, \”two\”];
d) $arr = [\”one\”, \”two\”]
Β
7. Which method is used to send data using forms in a secure way?
a) GET
b) POST
c) FETCH
d) SEND
Β
8. Which of the following is used to include one PHP file into another?
a) include
b) require
c) import
d) Both a and b
Β
9. What will $x = 5 == ‘5’; evaluate to?
a) true
b) false
c) error
d) null
Β
10. How do you define a function in PHP?
a) function myFunction {}
b) function myFunction() {}
c) define function myFunction() {}
d) fn myFunction() {}
Β
11. What will the following code output? echo strlen(\”Hello\”);
a) 4
b) 5
c) 6
d) Error
Β
12. What is the default file extension for PHP files?
a) .html
b) .ph
c) .php
d) .xml
Sign in to your account