Olete.in
Articles
Mock Tests
🧪 PHP MCQ Quiz Hub
PHP Mcq Set 3
Choose a topic to test your knowledge and improve your PHP skills
1. Which superglobal stores a variety of information pertinent to a file uploaded to the server via a PHP script?
$_FILE Array
$_FILES Array
$_FILES_UPLOADED Array
$_FILE_UPLOADED Array
2. How many items are available in the $_FILES array?
2
3
4
5
3. Which function is used to determine whether a file was uploaded?
is_file_uploaded()
is_uploaded_file()
file_uploaded("filename")
uploaded_file("filename")
4. What is the full form of DNS?
Digital Network System
Domain Network System
Digital Name Systmem
Domain Name System
5. Which one of the following function checks for the existence of DNS records?
checkdns()
checkdnsr()
checkdnsrr()
checkdnsa()
6. Which one of the following function is used to return an array consisting of various DNS resource records pertinent to a specific domain?
dns_get_record()
dns_record()
dnsrr_get_record()
dnsrr_record()
7. Which one of the following function is used to retrieve the MX records for the domain specified by hostname?
getmx()
retrieve_mx()
getmxrr()
retrieve_mxrr()
8. What is the default port number of HTTPs?
70
80
90
100
9. Which one of the following function returns the port number of a specified service?
getportname()
getservername()
getserverbyname()
getservbyname()
10. Which one of the following statements can be used to establish port 80 connection with www.nachi.com?
fsockopen("www.nachi.com", 80);
sockopen(80,"www.nachi.com");
fsockopen(80,"www.nachi.com");
sockopen("www.nachi.com", 80);
11. Which one of the following function is used to send an email using PHP script?
mail_send()
send_mail()
mailrr()
mail()
12. How many configuration directives pertinent to PHPs mail function are available?
4
5
6
7
13. Which of the following statements is used to add an attachment to the mail?
$mimemail->attachment(‘attachment.pdf’);
$mimemail=>attachment(‘attachment.pdf’);
$mimemail->addAttachment(‘attachment.pdf’);
$mimemail=>addAttachment(‘attachment.pdf’);
14. Which one of the following is the very first task executed by a session enabled page?
Delete the previous session
Start a new session
Check whether a valid session exists
Handle the session
15. How many ways can a session data be stored?
3
4
5
6
16. Which directive determines how the session information will be stored?
save_data
session.save
session.save_data
session.save_handler
17. Which one of the following is the default PHP session name?
PHPSESSID
PHPSESID
PHPSESSIONID
PHPIDSESS
18. If session.use_cookie is set to 0, this results in use of _____________
Session
Cookie
URL rewriting
Nothing happens
19. If the directive session.cookie_lifetime is set to 3600, the cookie will live until ____________
3600 sec
3600 min
3600 hrs
the browser is restarted
20. Neglecting to set which of the following cookie will result in the cookies domain being set to the host name of the server which generated it.
session.domain
session.path
session.cookie_path
session.cookie_domain
21. What is the default number of seconds that cached session pages are made available before the new pages are created?
360
180
3600
1800
22. What is the default time(in seconds) for which session data is considered valid?
1800
3600
1440
1540
23. Which one of the following function is used to start a session?
start_session()
session_start()
session_begin()
begin_session()
24. Which function is used to erase all session variables stored in the current session?
session_destroy()
session_change()
session_remove()
session_unset()
25. What will the function session_id() return is no parameter is passed?
Current Session Identification Number
Previous Session Identification Number
Last Session Identification Number
Error
26. Which one of the following statements should you use to set the session username to Nachi?
$SESSION[‘username’] = “Nachi”;
$_SESSION[‘username’] = “Nachi”;
session_start(“nachi”);
$SESSION_START[“username”] = “Nachi”;
27. An attacker somehow obtains an unsuspecting users SID and then using it to impersonate the user in order to gain potentially sensitive information. This attack is known as __________
session-fixation
session-fixing
session-hijack
session-copy
28. Which parameter determines whether the old session file will also be deleted when the session ID is regenerated?
delete_old_file
delete_old_session
delete_old_session_file
delete_session_file
29. Which function effectively deletes all sessions that have expired?
session_delete()
session_destroy()
session_garbage_collect()
SessionHandler::gc
30. Which function is used to transform PHPs session-handler behavior into that defined by your custom handler?
session_set_save()
session_set_save_handler()
Session_handler()
session_save_handler()
31. The session_start() function must appear _________
after the html tag
after the body tag
before the body tag
before the html tag
32. What is the return type of session_set_save_handler() function?
boolean
integer
float
character
33. Which one of the following statements should be used to disable just the fopen(), and file() functions?
disable_functions = fopen(), file()
disable_functions = fopen, file
functions_disable = fopen(), file()
functions_disable = fopen, file
34. Which one of the following statements should be used to disable the use of two classes administrator and janitor?
disable_classes = “administrator, janitor”
disable_classes = class administrator, class janitor
disable_classes = class “administrator”, class “janitor”
disable_classes = class “administrator”, class “janitor”
35. What is the default value of max_execution_time directive? This directive specifies how many seconds a script can execute before being terminated.
10
20
30
40
36. The memory_limit is only applicable if ________ is enabled when you configure PHP.
enable-limit
-enable-memory-limit
enable-memory-limit
memory-limit
37. 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?
open_dir = “/home/www/”
open_dir = /home/www/
open_basedir = /home/www/
open_basedir = “/home/www/”
38. Which Apache directive outputs Apaches server version, server name, port and compile-in modules?
ServerSignature
ServerName
ServerDetails
ServerInfo
39. Which directive determines which degree of server details is provided if the ServerSignature directive is enabled?
ServerAddons
ServerExtra
ServerTokens
ServerDetails
40. Which directive should we disable to obscure the fact that PHP is being used on our server?
show_php
expose_php
print_php
info_php
41. 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?
AddType application/x-httpd-php .php
AddType application/x-httpd-php .asp
AddType application/x-httpd-asp .php
AddType application/x-httpd-asp .asp
42. AddType application/x-httpd-asp .asp
PHP 5.1.0
PHP 5.2.0
PHP 5.3.0
PHP 5.3.1
43. What will be the output if we replace the line $num = preg_grep(“/[0-5]/”, $number); with $num = preg_grep(“/[0-5]/”, $number, PREG_GREP_INVERT);?
Array([0]=>0 [1]=>1 [2]=>two [3]=>three [4]=>four [5]=>5)
Array([2]=>two [3]=>three [4]=>four)
Array([1]=> 1)
Array([0]=>0 [5]=>5)
44. Which one of the following functions are used to search a string?
preg_match
preg_search
preg_find
preg_found
45. Which one of the following preg PHP function is used to do a find and replace on a string or an array?
preg_replace()
preg_find()
preg_find_replace()
preg_findre()
46. Which one of the following preg PHP functions is used to take a string, and put it in an array?
preg_destroy()
preg_split()
preg_unchain()
preg_divide()
47. Which one of the following is not a preg PHP function?
preg_match
preg_match_all
preg_matchall
preg_split
48. Parameter flags was added in which version of PHP?
PHP 4.0
PHP 4.1
PHP 4.2
PHP 4.3
49. Which one of the following databases has PHP supported almost since the beginning?
Oracle Database
SQL
SQL+
MySQL
50. The updated MySQL extension released with PHP 5 is typically referred to as _____
MySQL
mysql
mysqli
mysqly
Submit