PHP Quiz | Set-2

  • Last Updated : 20 Sep, 2021

Question 1
Which below method is used to compute the difference between two arrays in PHP?
A
array_diff
B
diff_array
C
arrays_diff
D
diff_arrays
PHP Quiz | Set-2    
Discuss it


Question 1 Explanation: 
The array_diff is used to compare the difference between given arrays and return the value as a difference. It is used to compare the difference between two or more than two arrays. So for computing, the difference between the two arrays in PHP the method is used is array_diff.
Question 2
What is the output of the following code snippets: <?php $output = array(3, 3, 3); echo array_product($a); ?>
A
8
B
27
C
10
D
6
PHP Quiz | Set-2    
Discuss it


Question 2 Explanation: 
The array_product methods in PHP are used to calculate the product of arrays, So the given values are 3,3,3, and the product of the given value is 27.
Question 3
Which of the following method in PHP is used to get the current day and location?
A
date_sunrise()
B
sunrise()
C
date-sunrise()
D
None of the above
PHP Quiz | Set-2    
Discuss it


Question 3 Explanation: 
For finding out the current date and location in PHP the method is used are date_sunrise().
Question 4
What is the output of the following code?
<?php    
 	$value="GeeksForGeeks";    
 	echo strrev("$value");      
?>
A
skeeGroFskeeG
B
skeeGroFskeeO
C
skeeGorFskeeG
D
skeeForFskeeG
PHP Quiz | Set-2    
Discuss it


Question 4 Explanation: 
The strrev is used to reverse the string in PHP so after reversing the string in PHP the value is skeeGroFskeeG.Hence echo print the value.
Question 5
What is the output of the below code snippets?
<?php  
	while()  
	{  
	echo "GeeksForGeeks";  
	}  
?> 
A
Hello World
B
Infinite loop
C
no output
D
Error
PHP Quiz | Set-2    
Discuss it


Question 5 Explanation: 
After running the code the error is throwing so the code is not executable.
Question 6
Which of the following is used to calculate a number of character values in PHP?
A
count($variable)
B
len($variable)
C
strcount($variable)
D
strlen($variable)
PHP Quiz | Set-2    
Discuss it


Question 6 Explanation: 
The strlen($variable) is used to calculate the number of character values in PHP.It takes an argument as the variable.
Question 7
Out of the following is not considered as predefined values?
A
$get
B
$ask
C
$request
D
$post
PHP Quiz | Set-2    
Discuss it


Question 7 Explanation: 
The $ask is not considered as predefined value so from the above option only option $ask is correct.
Question 8
If you want to send input through the script in PHP then which of the following is true?
A
Post
B
Get
C
All of the above
D
None of the above
PHP Quiz | Set-2    
Discuss it


Question 8 Explanation: 
If we want to send the input through the script in PHP then we use Get method .
Question 9
The correct syntax for enclosing the PHP script are?
A
<PHPgt; </phpgt;
B
<?PHP ?gt;
C
?PHP ?PHP
D
<p?gt; </?pgt;
PHP Quiz | Set-2    
Discuss it


Question 9 Explanation: 
The correct syntax for enclosing is the Php script are <?PHP ?gt; where , <?php is starting position and end with ?gt;
Question 10
In Php how many types of filter is present?
A
2
B
3
C
4
D
None
PHP Quiz | Set-2    
Discuss it


Question 10 Explanation: 
In php there are 3 type of filter is present .
There are 15 questions to complete.
12
My Personal Notes arrow_drop_up


Writing code in comment? Please use ide.geeksforgeeks.org, generate link and share the link here.