Explore topic-wise MCQs in Php.

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

1.

Which one of the following filter checks if the variable of the specified type exists?

A. filter_has_var
B. filter_var
C. filter_id
D. filter_var_array
Answer» B. filter_var
2.

If the input variable is a string like this “http://www.saåånfoøøundry.com/”, the $url variable after the sanitizing will look like?

A. http://www.saåånfoøøundry.com/
B. http://www.saaanfoooundry.com/
C. http://www.saånfoøundry.com/
D. https://www.sanfoundry.com/
Answer» E.
3.

Which one of the following does not describe a validating filter?

A. Are used to allow or disallow specific characters in a string
B. Are used to validate user input
C. Strict format rules
D. Returns the expected type on success or FALSE on failure
Answer» B. Are used to validate user input
4.

How many types of filtering are present in PHP?

A. 3
B. 2
C. 4
D. None
Answer» C. 4
5.

What will be the output of the following PHP code?

A. o output is returned
B. nteger is not valid
C. nteger is valid
D. rror
Answer» D. rror
6.

What will be the output of the following PHP code?"convertSpace"));?>

A. eter_is_a_great_guy!
B. eterisagreatguy!
C. eter is a great guy!
D. rror
Answer» D. rror
7.

What will be the output of the following PHP code?

A. ALSE
B. RUE
C. ULL
D. RROR
Answer» D. RROR
8.

What will be the output of the following PHP code?<?php$var=300;$int_options = array("options"=>array ("min_range"=>0, "max_range"=>256));if (!filter_var($var, FILTER_VALIDATE_INT, $int_options))echo("Integer is not valid");elseecho("Integer is valid");?>

A. o output is returned
B. nteger is not valid
C. nteger is valid
D. rror
Answer» C. nteger is valid
9.

WHICH_ONE_OF_THE_FOLLOWING_FILTER_CHECKS_IF_VARIABLE_OF_SPECIFIED_TYPE_EXISTS??$

A. filter_has_var
B. filter_var
C. filter_id
D. filter_var_array
Answer» D. filter_var_array
10.

If the input variable is a string like this “http://www.saåånfoøøundry.com/”, the?#url variable after the sanitizing will look lik?#

A. http://www.saåånfoøøundry.com/
B. http://www.saaanfoooundry.com/
C. http://www.saånfoøundry.com/
D. https://www.sanfoundry.com/
Answer» D. https://www.sanfoundry.com/
11.

No output is returned

A. Integer is not valid
B. Integer is valid
C. Error
Answer» B. Integer is valid
12.

Which one of the following filter is used to filter several variables with the same or different filters?

A. filter_var_array()
B. filter_var()
C. filter_input
D. filter_input_array
Answer» B. filter_var()
13.

Which of the following is/are an external data?

A. Cookies
B. Input data from a form
C. Server Variables
D. Web services data
Answer» E.