Html Forms Handling — Part 2 MCQs with Explanations
Practice high-yield Programming & Software Development MCQs on Html Forms Handling — Part 2 with worked academic solutions for FPSC, PPSC, NTS, NITB, PTS.
Questions
30
Difficulty Level
Exam-Level
Target Exams
FPSC, PPSC, NTS...
Estimated Time
36 mins
Exam-Level FPSC PPSC NTS NITB PTS
Verified for Commission Syllabus • Oct 14, 2026
30
Verified Practice Questions
Interactive test mode with detailed academic worked solutions
Live Progress|0/30 answered
✓0 correct
✗0 wrong
0% score
🎉 Set complete! All 30 questions answered.
Question 1 of 30
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which two predefined variables are used to retrieve information from forms?
Correct Answer: Option B — $_GET & $_POST
Detailed Academic Explanation:
$_GET & $_POST is the correct answer to “Which two predefined variables are used to retrieve information from forms”. This question is standard in competitive examination syllabi for Html Forms Handling.
💡Key Conceptual Anchor:Html Forms Handling
Question 2 of 30
★ FPSC
★ PPSC
★ FPSC
★ PPSC
The attack which involves the insertion of malicious code into a page frequented by other users is known as.
Correct Answer: Option C — cross-site scripting
Detailed Academic Explanation:
cross-site scripting is the correct answer to “The attack which involves the insertion of malicious code into a page frequented by other users is known as.”. This question is standard in competitive examination syllabi for Html Forms Handling.
💡Key Conceptual Anchor:Html Forms Handling
Question 3 of 30
★ FPSC
★ PPSC
★ FPSC
★ PPSC
When you use the $_GET variable to collect data, the data is visible to.
Correct Answer: Option C — everyone
Detailed Academic Explanation:
everyone is the correct answer to “When you use the $_GET variable to collect data, the data is visible to.”. This question is standard in competitive examination syllabi for Html Forms Handling.
💡Key Conceptual Anchor:Html Forms Handling
Question 4 of 30
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which variable is used to collect form data sent with both the GET and POST methods?
Correct Answer: Option D — $_REQUEST
Detailed Academic Explanation:
$_REQUEST is the correct answer to “Which variable is used to collect form data sent with both the GET and POST methods”. This question is standard in competitive examination syllabi for Html Forms Handling.
💡Key Conceptual Anchor:Html Forms Handling
Question 5 of 30
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which function is used to remove all HTML tags from a string passed to a form?
Correct Answer: Option B — strip_tags()
Detailed Academic Explanation:
strip_tags() is the correct answer to “Which function is used to remove all HTML tags from a string passed to a form”. This question is standard in competitive examination syllabi for Html Forms Handling.
💡Key Conceptual Anchor:Html Forms Handling
Question 6 of 30
★ FPSC
★ PPSC
★ FPSC
★ PPSC
To validate an e-mail address, which flag is to be passed to the function filter_var()?
Correct Answer: Option A — FILTER_VALIDATE_EMAIL
Detailed Academic Explanation:
FILTER_VALIDATE_EMAIL is the correct answer to “To validate an e-mail address, which flag is to be passed to the function filter_var()”. This question is standard in competitive examination syllabi for Html Forms Handling.
💡Key Conceptual Anchor:Html Forms Handling
Question 7 of 30
★ FPSC
★ PPSC
★ FPSC
★ PPSC
How many predefined variables does PHP use to authenticate a user?
Correct Answer: Option B — 2
Detailed Academic Explanation:
2 is the correct answer to “How many predefined variables does PHP use to authenticate a user”. This question is standard in competitive examination syllabi for Html Forms Handling.
💡Key Conceptual Anchor:Html Forms Handling
Question 8 of 30
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the following PHP function is commonly used when handling authentication via PHP? 1. header() 2. footer() 3. inset() 4. isset()
Correct Answer: Option A — 1 and 4
Detailed Academic Explanation:
1 and 4 is the correct answer to “Which of the following PHP function is commonly used when handling authentication via PHP? 1. header() 2. footer() 3. inset() 4. isset()”. This question is standard in competitive examination syllabi for Html Forms Handling.
💡Key Conceptual Anchor:Html Forms Handling
Question 9 of 30
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the following are types of PHP authentication implementation methodologies? 1. Hard-coding a login pair directly into the script 2. File-based authentication 3. Data-based authentication 4. PEAR’S HTTP authentication
Correct Answer: Option D — All of the mentioned
Detailed Academic Explanation:
All of the mentioned is the correct answer to “Which of the following are types of PHP authentication implementation methodologies? 1. Hard-coding a login pair directly into the script 2. File-based authentication 3. Data-based authentication 4. PEAR’S HTTP authentication”. This question is standard in competitive examination syllabi for Html Forms Handling.
💡Key Conceptual Anchor:Html Forms Handling
Question 10 of 30
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the default value of max_input_time directive?
Correct Answer: Option B — 60 seconds
Detailed Academic Explanation:
60 seconds is the correct answer to “What is the default value of max_input_time directive”. This question is standard in competitive examination syllabi for Html Forms Handling.
💡Key Conceptual Anchor:Html Forms Handling
Question 11 of 30
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the default value of the directive max_file_limit?
Correct Answer: Option C — 20 files
Detailed Academic Explanation:
20 files is the correct answer to “What is the default value of the directive max_file_limit”. This question is standard in competitive examination syllabi for Html Forms Handling.
💡Key Conceptual Anchor:Html Forms Handling
Question 12 of 30
★ FPSC
★ PPSC
★ FPSC
★ PPSC
If you want to temporarily store uploaded files in the /tmp/phpuploads/ directory, which one of the following statement will you use?
Correct Answer: Option A — upload_tmp_dir “/tmp/phpuploads/ directory”
Detailed Academic Explanation:
upload_tmp_dir “/tmp/phpuploads/ directory” is the correct answer to “If you want to temporarily store uploaded files in the /tmp/phpuploads/ directory, which one of the following statement will you use”. This question is standard in competitive examination syllabi for Html Forms Handling.
💡Key Conceptual Anchor:Html Forms Handling
Question 13 of 30
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which superglobal stores a variety of information pertinent to a file uploaded to the server via a PHP script?
Correct Answer: Option B — $_FILEs Array
Detailed Academic Explanation:
$_FILEs Array is the correct answer to “Which superglobal stores a variety of information pertinent to a file uploaded to the server via a PHP script”. This question is standard in competitive examination syllabi for Html Forms Handling.
💡Key Conceptual Anchor:Html Forms Handling
Question 14 of 30
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which function is used to determine whether a file was uploaded?
Correct Answer: Option B — is_uploaded_file()
Detailed Academic Explanation:
is_uploaded_file() is the correct answer to “Which function is used to determine whether a file was uploaded”. This question is standard in competitive examination syllabi for Html Forms Handling.
💡Key Conceptual Anchor:Html Forms Handling
Question 15 of 30
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which one of the following is the very first task executed by a session enabled page?
Correct Answer: Option C — Check whether a valid session exists
Detailed Academic Explanation:
Check whether a valid session exists is the correct answer to “Which one of the following is the very first task executed by a session enabled page”. This question is standard in competitive examination syllabi for Html Forms Handling.
💡Key Conceptual Anchor:Html Forms Handling
Question 16 of 30
★ FPSC
★ PPSC
★ FPSC
★ PPSC
If session.use_cookie is set to 0, this results in use of.
Correct Answer: Option C — URL rewriting
Detailed Academic Explanation:
URL rewriting is the correct answer to “If session.use_cookie is set to 0, this results in use of.”. This question is standard in competitive examination syllabi for Html Forms Handling.
💡Key Conceptual Anchor:Html Forms Handling
Question 17 of 30
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which one of the following function is used to start a session?
Correct Answer: Option B — session_start()
Detailed Academic Explanation:
session_start() is the correct answer to “Which one of the following function is used to start a session”. This question is standard in competitive examination syllabi for Html Forms Handling.
💡Key Conceptual Anchor:Html Forms Handling
Question 18 of 30
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will the function session_id() return is no parameter is passed?
Correct Answer: Option A — Current Session Identification Number
Detailed Academic Explanation:
Current Session Identification Number is the correct answer to “What will the function session_id() return is no parameter is passed”. This question is standard in competitive examination syllabi for Html Forms Handling.
💡Key Conceptual Anchor:Html Forms Handling
Question 19 of 30
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which function effectively deletes all sessions that have expired?
Correct Answer: Option C — session_garbage_collect()
Detailed Academic Explanation:
session_garbage_collect() is the correct answer to “Which function effectively deletes all sessions that have expired”. This question is standard in competitive examination syllabi for Html Forms Handling.
💡Key Conceptual Anchor:Html Forms Handling
Question 20 of 30
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which function is used to transform PHP’s session-handler behavior into that defined by your custom handler?
Correct Answer: Option B — session_set_save_handler()
Detailed Academic Explanation:
session_set_save_handler() is the correct answer to “Which function is used to transform PHP’s session-handler behavior into that defined by your custom handler”. This question is standard in competitive examination syllabi for Html Forms Handling.
💡Key Conceptual Anchor:Html Forms Handling
Question 21 of 30
★ FPSC
★ PPSC
★ FPSC
★ PPSC
PHP sessions are created using the . . . . . function.
Correct Answer: Option C — session_start()
Detailed Academic Explanation:
session_start() is the correct answer to “PHP sessions are created using the . . . . . function.”. This question is standard in competitive examination syllabi for Html Forms Handling.
💡Key Conceptual Anchor:Html Forms Handling
Question 22 of 30
★ FPSC
★ PPSC
★ FPSC
★ PPSC
When you want to store user data in a session use the . . . . array.
Correct Answer: Option A — $_SESSION
Detailed Academic Explanation:
$_SESSION is the correct answer to “When you want to store user data in a session use the . . . . array.”. This question is standard in competitive examination syllabi for Html Forms Handling.
💡Key Conceptual Anchor:Html Forms Handling
Question 23 of 30
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Sessions allow you to.
Correct Answer: Option D — all of above
Detailed Academic Explanation:
all of above is the correct answer to “Sessions allow you to.”. This question is standard in competitive examination syllabi for Html Forms Handling.
💡Key Conceptual Anchor:Html Forms Handling
Question 24 of 30
★ FPSC
★ PPSC
★ FPSC
★ PPSC
A snapshot of the session data can be taken at any time and written out to a file.
Correct Answer: Option A — True
Detailed Academic Explanation:
True is the correct answer to “A snapshot of the session data can be taken at any time and written out to a file.”. This question is standard in competitive examination syllabi for Html Forms Handling.
💡Key Conceptual Anchor:Html Forms Handling
Question 25 of 30
★ FPSC
★ PPSC
★ FPSC
★ PPSC
When the session data is written to a file, it can be read back, decoded and applied to the current session using the . . . . function.
Correct Answer: Option D — session_decode()
Detailed Academic Explanation:
session_decode() is the correct answer to “When the session data is written to a file, it can be read back, decoded and applied to the current session using the . . . . function.”. This question is standard in competitive examination syllabi for Html Forms Handling.
💡Key Conceptual Anchor:Html Forms Handling
Question 26 of 30
★ FPSC
★ PPSC
★ FPSC
★ PPSC
session_destroy() instantly destroy elements of the $_SESSION array.
Correct Answer: Option B — False
Detailed Academic Explanation:
False is the correct answer to “session_destroy() instantly destroy elements of the $_SESSION array.”. This question is standard in competitive examination syllabi for Html Forms Handling.
💡Key Conceptual Anchor:Html Forms Handling
Question 27 of 30
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Appending session data to an absolute URL does not represent a security risk.
Correct Answer: Option B — False
Detailed Academic Explanation:
False is the correct answer to “Appending session data to an absolute URL does not represent a security risk.”. This question is standard in competitive examination syllabi for Html Forms Handling.
💡Key Conceptual Anchor:Html Forms Handling
Question 28 of 30
★ FPSC
★ PPSC
★ FPSC
★ PPSC
If the php.ini register_globals directive is set, session data becomes available in the . . . . namespace.
Correct Answer: Option A — Global
Detailed Academic Explanation:
Global is the correct answer to “If the php.ini register_globals directive is set, session data becomes available in the . . . . namespace.”. This question is standard in competitive examination syllabi for Html Forms Handling.
💡Key Conceptual Anchor:Html Forms Handling
Question 29 of 30
★ FPSC
★ PPSC
★ FPSC
★ PPSC
No expiry date is set in the cookie that PHP sets for the session. The session remains current only as long as the browser is active. When the browser is restarted the cookie is not stored. This behavior can be changed by altering . . . . . setting in php.ini file.
Correct Answer: Option C — session.cookie_lifetime
Detailed Academic Explanation:
session.cookie_lifetime is the correct answer to “No expiry date is set in the cookie that PHP sets for the session. The session remains current only as long as the browser is active. When the browser is restarted the cookie is not stored. This behavior can be changed by altering . . . . . setting in php.ini file.”. This question is standard in competitive examination syllabi for Html Forms Handling.
💡Key Conceptual Anchor:Html Forms Handling
Question 30 of 30
★ FPSC
★ PPSC
★ FPSC
★ PPSC
session_destroy() erases all session variable.
Correct Answer: Option A — True
Detailed Academic Explanation:
True is the correct answer to “session_destroy() erases all session variable.”. This question is standard in competitive examination syllabi for Html Forms Handling.
💡Key Conceptual Anchor:Html Forms Handling
✓Link copied to clipboard
Continue Your Practice
Advance Html — Part 1
Master the next curriculum module with 40 exam-standard MCQs.
💡Examiner's Advisory for Programming & Software Development
In competitive commission exams (FPSC, PPSC, KPPSC, SPSC, CSS, PMS), questions are frequently phrased with distractor options designed to catch rote learners. Whenever you answer an MCQ, read the Detailed Academic Explanation and Conceptual Anchor to understand why the remaining options are incorrect.