Explore topic-wise MCQs in Php.

This section includes 12 Mcqs, each offering curated multiple-choice questions to sharpen your Php knowledge and support exam preparation. Choose a topic below to get started.

1.

How many validation filters like FILTER_VALIDATE_EMAIL are currently available?

A. 5
B. 6
C. 7
D. 8
Answer» D. 8
2.

To validate an email address, which flag is to be passed to the function filter_var()?

A. FILTER_VALIDATE_EMAIL
B. FILTER_VALIDATE_MAIL
C. VALIDATE_EMAIL
D. VALIDATE_MAIL
Answer» B. FILTER_VALIDATE_MAIL
3.

What will be the value of the variable $input in the following PHP code?

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>!View Answer
Answer» E.
4.

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()
Answer» C. tags_strip()
5.

Which one of the following should not be used while sending passwords or other sensitive information?

A. GET
B. POST
C. REQUEST
D. NEXT
Answer» B. POST
6.

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

A. $BOTH
B. $_BOTH
C. $REQUEST
D. $_REQUEST
Answer» E.
7.

When you use the $_POST variable to collect data, the data is visible to ___________

A. none
B. only you
C. everyone
D. selected few
Answer» C. everyone
8.

When you use the $_GET variable to collect data, the data is visible to ___________

A. none
B. only you
C. everyone
D. selected few
Answer» D. selected few
9.

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
Answer» D. scripting
10.

Which two predefined variables are used to retrieve information from forms?

A. $GET & $SET
B. $_GET & $_SET
C. $__GET & $__SET
D. GET & SET
Answer» C. $__GET & $__SET
11.

TO_VALIDATE_AN_EMAIL_ADDRESS,_WHICH_FLAG_IS_TO_BE_PASSED_TO_THE_FUNCTION_FILTER_VAR()??$

A. FILTER_VALIDATE_EMAIL
B. FILTER_VALIDATE_MAIL
C. VALIDATE_EMAIL
D. VALIDATE_MAIL
Answer» D. VALIDATE_MAIL
12.

Swapna Lawrence you are really pretty?

A. Swapna <td>Lawrence</td> you are really<i>pretty</i>!
B. Swapna <td>Lawrence</td> you are really pretty!
C. Swapna Lawrence you are really<i>pretty</i>!
Answer» B. Swapna <td>Lawrence</td> you are really pretty!