PHP MCQ
Q1. PHP is a _______?
- Open Source Language
- Widely used language
- Server side scripting language
- All of the above
Answer:- (4).
- //
- /* */
- {{ }}
- {/ \}
Answer:- (2).
- $$
- $
- #@
- $|
Answer:- (1).
- asc()
- chr()
- ascii()
- val()
Answer:- (2).
- count()
- strcount
- strlen
- len
Answer:- (3).
- Drek Kolkevi
- Rasmus Lerdorf
- William Makepiece
- List Barely
Answer:- (2).
- func_get_args()
- func_get_argv()
- get_argv
- get_argc()
Answer:- (1).
- Personal Home Page
- Hypertext pre-processor
- Pro Hypertext-preprocessor
- None of the above
Answer:- (2).
- $GET
- $POST
- $REQUEST
- $ASK
Answer:- (4).
- $_SESSION[]
- isset() function
- session_start() function
- session_destroy() function
Answer:- (3).
- <?php PHP code goes here ?>
- < PHP code goes here ?>
- <script language="php"> PHP code goes here </script>
- All of the above
Answer:- (4).
- srand()
- rand()
- random()
- None of the above
Answer:- (2).
- mysql_connect()
- mysql_query()
- mysql_close()
- None of the above
Answer:- (2).
<?php function calc($price, $tax) { $total = $price + $tax; } $pricetag = 15; $taxtag = 3; calc($pricetag, $taxtag); ?>
- Call By Value
- Call By Reference
- Default Argument Value
- Type Hinting
Answer:- (A).
Explanations :When you pass an argument in the above manner or say we pass 15 and 3 directly, it is called passing by value or call by value.
Explanations :When you pass an argument in the above manner or say we pass 15 and 3 directly, it is called passing by value or call by value.
- fgets()
- fget()
- fileget()
- filegets()
Answer:- (D).
- none
- only you
- everyone
- selected few
Answer:- (3).
- $BOTH
- $_BOTH
- $REQUEST
- $_REQUEST
Answer:- (4).
- FILTER_VALIDATE_EMAIL
- FILTER_VALIDATE_MAIL
- VALIDATE_EMAIL
- VALIDATE_MAIL
Answer:- (1).
<?php $fruits = array ("mango", "apple", "pear", "peach"); $fruits = array_flip($fruits); echo ($fruits[0]);
- mango
- Error
- peach
- 0
Answer:- (2).
Explanations : As we are flippling the values, $fruits["mango"] = 0, $fruits["apple"] = 1 and so on.
Explanations : As we are flippling the values, $fruits["mango"] = 0, $fruits["apple"] = 1 and so on.
- Extern
- Local
- Static
- Global
Answer:- (1).
Explanations :The scope of a variable is defined as its range in the program under which it can be accessed.
Explanations :The scope of a variable is defined as its range in the program under which it can be accessed.
- The strpos() function is used to search for the spaces in a string
- The strpos() function is used to search for a number in a string
- The strpos() fucntion is used to search for a character/text in a string
- The strpos() function is used to search for a capitalize character in a string
Answer:- (3).
Explanations :The strpos() is in-built function of PHP. It is used to find the position of the first occurence of a string inside another string or substring in a string.
Explanations :The strpos() is in-built function of PHP. It is used to find the position of the first occurence of a string inside another string or substring in a string.
- The fopen() function is used to open folders in PHP
- The fopen() function is used to open remote server
- The fopen() function is used to open files in PHP
- None of the above
Answer:- (3).
Explanations : The fopen() function accepts two arguments: $filename and $mode. The $filename represents the file to e opened and $mode represents the file mode.
Explanations : The fopen() function accepts two arguments: $filename and $mode. The $filename represents the file to e opened and $mode represents the file mode.
<?php $a = 15; function show() { $a = 20; echo "$a"; } show(); echo "$a"; ?>
- 2015
- 2020
- 1515
- 0
Answer:- (1).
Explanations : In the given program, first the show() function is called, and the variable $a is initialized to 20, and 20 is printed on the screen. Later, the global variable $a is initialized to 15, and the value 15 is printed on the screen. So the output of the above program will be 2015.
Explanations : In the given program, first the show() function is called, and the variable $a is initialized to 20, and 20 is printed on the screen. Later, the global variable $a is initialized to 15, and the value 15 is printed on the screen. So the output of the above program will be 2015.
<?php $var1="Hellow World"; echo strrev("var1"); ?>
- dlroW olleH
- olleH dlroW
- Hello dlroW
- None of the above
Answer:- (1).
Explanations :The strrev() function is used to reverse a string. It is a built in PHP function.
Explanations :The strrev() function is used to reverse a string. It is a built in PHP function.
- sort()
- asort()
- dsort()
- rsort()
Answer:- (4).
Explanations : The PHP rsort() function is used to sort an array in descending order.
Explanations : The PHP rsort() function is used to sort an array in descending order.
Copyright © 2022 Shineskill Software Pvt. Ltd., All rights reserved.