Skip to content

PHP MCQ Questions

0
Answered
0
Correct
0%
Accuracy
Q1 Easy

What is the difference between the include() and require() language constructs?

Q2 Easy

What is the output of the following code?

Q3 Easy

What is the job of the controller as a component in MVC?

Q4 Easy

What is meant by nl2br()?

Q5 Easy

What is the best way to load a file that contains necessary functions and classes?

Q6 Easy

What is a key difference between GET and POST?

Q7 Easy

What is the default maximum execution time for a PHP script?

Q8 Easy

What is the output of this line of code?"; echo is_finite(log(0)) . ""; echo is_finite(2000); ?>

Q9 Easy

What is the output when the following code is executed? function callFun( &$arg ) { $return = $arg; $arg += 1; return $return; } $a = 3; $b = callFun( $a ); $c = callFun($a); echo $a; echo ' \n '; echo $b; echo ' \n '; echo $c;

Q10 Easy

What is the precedence between && and "and"?

Q11 Easy

What is the correct syntax of mail() function in PHP?

Q12 Easy

What is the preferred way to write this if statement, and why?

Q13 Easy

What is the meaning of the system message, "Allowed memory size of <number> bytes exhausted"?

Q14 Easy

What is the output of this : $a = true; var_dump($a);

Q15 Easy

What is a large binary data object called in PHP?

Q16 Easy

When it comes to the value of a variable, what is the difference between NULL and empty?

Q17 Easy

What is empty () ?

Q18 Easy

$var = (10 % 2 == 0) ? true:false; What is the output of $var?

Q19 Easy

What is the default extension for PHP files

Q20 Easy

When user clicks on Logout link, the user is redirected to logout.php file and the file has following code? <?php session_unset(); session_destroy(); header("Location: index.php"); ?> What is wrong with the following code?

Q21 Easy

What is the end tag in PHP

Q22 Easy

What is the output of the following code?<?phpfunctionvec_add (&$a, $b){$a['x'] += $b['x'];$a['y'] += $b['y'];$a['z'] += $b['z'];}$a = array (x => 3, y => 2, z => 5);$b = array (x => 9, y => 3, z => -7);vec_add (&$a, $b);print_r ($a);?>

Q23 Easy

What is the correct way to join strings in php? $str = "abcdef" + "ghi"; $str = "abcdef" . "ghi"; $str = join("abcdef","ghi"); $str = "abcdef" plus "ghi"

Q24 Easy

What is the output of the following code? $a = "clue"; $a .= "get"; echo "$a";

Q25 Easy

What is the Object oriented style of associative array?

Q26 Easy

What is the procedural style of associative array?

Q27 Easy

What is input sanitization?

Q28 Easy

What is the answer of this $a = 'b'; $b = 1; echo '$${a}';

Q29 Easy

What is the output of the following code? $sentence = "ThiS iS a SenTEnCe"; echo ucwords($sentence);

Q30 Easy

What is the correct way to read the result of a variable dump into a string?

Q31 Easy

The php not operator is !. Given the snippet, is there an out put and what is it?

Q32 Easy

What is the correct way to call an anonymous function?

Q33 Easy

Variable $a has not been declared. With error reporting turned off, what is the result of: $a[1][2]=3;?

Q34 Easy

What is $_REQUEST?

Q35 Easy

What is the difference between public, protected and private in a class definition?

Q36 Easy

What is the result of casting the integer 1 to an array: (array) 1

Q37 Easy

What is the purpose of this function? headers_sent()

Q38 Easy

What is the syntax to compare two values?

Q39 Easy

What is the functions unlink?

Q40 Easy

$message vs. $$message . what is the difference

Q41 Easy

What is the result of the following code?

Q42 Easy

What is the output of the following PHP code snippet?<?php$var = “testing module”;$statement = „This is a $var‟;echo ($statement);?>

Q43 Easy

What is the output when the following code is executed? $alpha = array('A' => 'AA', 'Bud' => 'BB','C' => 'D'); $food = array('tea', 'drink', 'pizza', 'juice'); printf(foods var export food true)

Q44 Easy

Given, the following:What is the output?

Q45 Easy

What is the value of $start after exiting the for loop?

Q46 Easy

What is the associativity of +=?

Q47 Easy

What is the best way to change the key without changing the value of a PHP arrayelement?

Q48 Easy

What is returned by array_product( array( 2, 3) )?

Q49 Easy

Which of the following code syntax is True about declaring a class definition?

Q50 Easy

What is the correct PHP command to use to catch anyerror messages within the code?

Showing 50 of 138 questions