PHP Set 3 (30 mcqs)

1. Which directive determines whether PHP scripts on the server can accept file uploads?
a) file_uploads
b) file_upload
c) file_input
d) file_intake

2. Which of the following directive determines the maximum amount of time that a PHP script will spend attempting to parse input before registering a fatal error?
a) max_take_time
b) max_intake_time
c) max_input_time
d) max_parse_time

3. What is the default value of max_input_time directive?
a) 30 seconds
b) 60 seconds
c) 120 seconds
d) 1 second

4. Since which version of PHP was the directive max_file_limit available.
a) PHP 5.2.1
b) PHP 5.2.2
c) PHP 5.2.12
d) PHP 5.2.21

5. What is the default value of the directive max_file_limit?
a) 10 files
b) 15 files
c) 20 files
d) 25 files

6. Which directive sets a maximum allowable amount of memory in megabytes that a script can allow?
a) max_size
b) post_max_size
c) max_memory_limit
d) memory_limit

7. If you want to temporarily store uploaded files in the /tmp/phpuploads/ directory, which one of the following statement will you use?
a) upload_tmp_dir “/tmp/phpuploads/ directory”
b) upload_dir “/tmp/phpuploads/ directory”
c) upload_temp_dir “/tmp/phpuploads/ directory”
d) upload_temp_director “/tmp/phpuploads/ directory”

8. Which superglobal stores a variety of information pertinent to a file uploaded to the server via a PHP script?
a) $_FILE Array
b) $_FILEs Array
9. How many items are available in the $_FILES array?
a) 2
b) 3
c) 4
d) 5

10. Which function is used to determine whether a file was uploaded?
a) is_file_uploaded()
b) is_uploaded_file()
c) file_uploaded(“filename”)
d) uploaded_file(“filename”)

11. Which one of the following statements should be used to disable just the fopen(), and file() functions?
a) disable_functions = fopen(),file()
b) disable_functions = fopen,file
c) functions_disable = fopen(),file()
d) functions_disable = fopen,file

12. Which one of the following statements should be used to disable the use of two classes administrator and janitor?
a) disable_classes = “administrator, janitor”
b) disable_classes = class administrator, class janitor
c) disable_classes = class “administrator”, class “janitor”
d) disable_class = class “administrator”, class “janitor”

13. What is the default value of max_execution_time directive? This directive specifies how many seconds a script can execute before being terminated.
a) 10
b) 20
c) 30
d) 40

14. The memory_limit is only applicable if ___ is enabled when you configure PHP. Fill in the blank.
a) –enable-limit
b) -enable-memory-limit
c) –enable-memory-limit
d) -memory-limit

15. Suppose all web material is located within the directory /home/www. To prevent users from viewing and manipulating files such as /etc/password, which one of the following statements should you use?
a) open_dir = “/home/www/”
b) open_dir = /home/www/
c) open_basedir = /home/www/
d) open_basedir = “/home/www/”

16. Which Apache directive outputs Apache’s server version, server name, port and compile-in modules?
a) ServerSignature
b) ServerName
c) ServerDetails
d) ServerInfo

17. Which directive determines which degree of server details is provided if the ServerSignature directive is enabled?
a) ServerAddons
b) ServerExtra
c) ServerTokens
d) ServerDetails

18. Which directive should we disable to obscure the fact that PHP is being used on our server?
a) show_php
b) expose_php
c) print_php
d) info_php

19. Say I want to change the extension of a PHP file, which of the following statements should I edit to change from .php to .html in the httpd.conf file?
a) AddType application/x-httpd-php .php
b) AddType application/x-httpd-php .asp
c) AddType application/x-httpd-asp .php
d) AddType application/x-httpd-asp .asp

20. The developers of PHP deprecated the safe mode feature as of which PHP version.
a) PHP 5.1.0
b) PHP 5.2.0
c) PHP 5.3.0
d) PHP 5.3.1
21. Which two predefined variables are used to retrieve information from forms?
a) $GET & $SET
b) $_GET & $_SET
c) $__GET & $__SET
d) GET & SET

22. The attack which involves the insertion of malicious code into a page frequented by other users is known as..
a) basic sql injection
b) advanced sql injection
c) cross-site scripting
d) scripting

23. When you use the $_GET variable to collect data, the data is visible to..
a) none
b) only you
c) everyone
d) selected few

24. When you use the $_POST variable to collect data, the data is visible to..
a) none
b) only you
c) everyone
d) selected few

25. Which variable is used to collect form data sent with both the GET and POST methods?

26. Which one of the following should not be used while sending passwords or other sensitive information?
a) GET
27. Which function is used to remove all HTML tags from a string passed to a form?
a) remove_tags()
b) strip_tags()
c) tags_strip()
d) tags_remove()

28. What will be the value of the variable $input in the following PHP code?
2.$input = “Swapna<td>Lawrence</td>you are really<i>pretty</i>!”;
3.$input = strip_tags($input,”<i></i>”);
a) Swapna Lawrence you are really pretty!
b) Swapna <td>Lawrence</td> you are really<i>pretty</i>!
c) Swapna <td>Lawrence</td> you are really pretty!
d) Swapna Lawrence you are really<i>pretty</i>!

29. To validate an e-mail address, which flag is to be passed to the function filter_var()?

30. How many validation filters like FILTER_VALIDATE_EMAIL are currently available?
a) 5
b) 6
c) 7
d) 8


1-a 2-c 3-b 4-c 5-c
6-d 7-a 8-b 9-d 10-b
11-b 12-a 13-c 14-c 15-d
16-a 17-c 18-b 19-a 20-c
21-b 22-c 23-c 24-b 25-d
26-b 27-a 28-d 29-a 30-c

Sharing is caring!

Leave a Comment

Your email address will not be published. Required fields are marked *