1. Which keyword precedes a method name?
2. Which keyword refers to properties or methods within the class itself?
3. Correct way to add comments to PHP?
4. When using the POST method, variables are displayed in the URL:
5. __construct is a
6. Which one stores PHP values, such as strings, numbers or arrays?
7. PHP is?
8. The concatenation operator in PHP is
9. strpos() stands for
10. Which is a characteristic of the PHP language?
11. What's the output? $name = 'John' echo 'Hi there '.$name;
12. Which is not a predefined variable?
13. Function to check for data type?
14. In PHP the error control operator is _______
15. Function to convert the first letter of a string to uppercase?
16. Variable assignment which is performed 'by value' in PHP.
17. What is meaning of PEAR?
18. There are two objects- $product1 = new Shop(); $product2 = new Shop(); Which is right about them?
19. What's the output?
20. What does delete() function do?
21. Which PHP function sends a raw HTTP header to a client?
22. Which compound type is supported by PHP?
23. The PHP statement: $i[2] = 'orange'; is an example of
24. The function setcookie( ) is used to
25. What's the output? $x=array(2=>'mouse',7=>'keyboard'); $y=array_keys($x); echo $y[1];
26. Which do not return a timestamp?
27. what is array_column?
28. Which is NOT true for PHP constants?
29. What is the time complexity of a call to array_key_exists()?
30. Which superglobals doesn't contain data from the client?
31. What's the output? $array1 = array('a' => 'green', 'b' => 'brown', 'c' => 'blue', 'red'); $array2 = array('a' => 'green', 'yellow', 'red'); $result = array_diff_assoc($array1, $array2); print_r($result);
32. What's the output? '; echo is_finite(log(0)) . ''; echo is_finite(2000); ?>
33. Given this code: function doSomething( &$arg ) { $return = $arg; $arg += 1; return $return; } $a = 3; $b = doSomething( $a ); what is the value of $a and $b after the function call?
34. What function computes the difference of arrays?
35. PHP can be run on Microsoft Windows IIS(Internet Information Server):
36. What's the output?
37. Is PHP a Hypertext Preprocessor, open source server-side scripting language that is widely used for web development
38. Which is a valid start to a pho comment?
39. What is the standard PHP function to send emails?
40. What's the output? $a = 'clue'; $a .= 'get'; echo '$a';
41. What is the functions unlink?
42. Which is not valid PHP code?
43. What's the output?
44. Which characters are taken care of by htmlspecialchars?
45. Which is not a predefined constant?
46. Which are not considered Boolean false?
47. Which variables are supported by the 'str_replace()' function?
48. Which is correct with regard to echo and print?
49. Which functions output text?
50. By which delimmiters are PHP scripts enclosed?
51. Which function of Array object returns a string representing the array and its elements?
52. Correct way to open the file 'sample.txt' as read only?
53. By which delimiters are PHP scripts enclosed?
54. Which line could you NOT use to comment out "Space: the final frontier"?
PHP MCQs | Topic-wise