Google News
logo
PHP - Quiz(MCQ)
1 .
Who is designed by PHP ?
A)
Rasmus Lerdorf 
B)
James Gosling
C)
Dennis Ritchie
D)
Brendan Eich

Correct Answer :  

Rasmus Lerdorf

2 .
PHP initial release date ?
A)
1991
B)
1993
C)
1995
D)
1997

Correct Answer :  

1995 

3 .
What does PHP stand for?
A)
Personal Hypertext Processor
B)
Hypertext Preprocessor
C)
Private Home Page
D)
Pre Hypertext Process

Correct Answer :  

Hypertext Preprocessor

4 .
PHP files have a default file extension of
A)
.ph
B)
.py
C)
.php
D)
None of the above

Correct Answer :   .php

5 .
Which of the following is/are a PHP code editor ?
A)
Adobe Dreamweaver
B)
Notepad
C)
Notepad++
D)
All of the above

Correct Answer :  

All of the above

6 .
Which of the following correct PHP syntax?
A)
<&>...</&>
B)
<?php>...</?> 
C)
<script>...</script>
D)
<?php...?>

Correct Answer :  

<?php...?>

7 .
What is WAMP server ?
A)
Windows Application mySQLPHP
B)
Windows Application amd MySQL PHP
C)
Windows Apache MySQL PHP 
D)
Windows Apache Microsoft PHP

Correct Answer :  

Windows Apache MySQL PHP 

8 .
In PHP, instructions are terminated by using which of the following ?
A)
;
B)
!
C)
#
D)
%>

Correct Answer :   ;

9 .
What is a correct way to add a comment in PHP?
A)
*\...\*
B)
/*...*/ 
C)
<comment>...</comment>
D)
<!--...-->

Correct Answer :  

/*...*/

10 .
How do you write "Hello World" in PHP
A)
Document.Write("Hello World");
B)
"Hello World";
C)
echo "Hello World"; 
D)
Document.print("Hello World");

Correct Answer :  

echo "Hello World"; 

11 .
Which of the following type specifier is invalid in print f() functions ?
A)
% b
B)
% a 
C)
% z
D)
% d

Correct Answer :  

% a

12 .
PHP Variable start with which symbol?
A)
$
B)
!
C)
*
D)
#

Correct Answer :  

$

13 .
The PHP syntax is most similar to:
A)
JavaScript
B)
VBScript
C)
Perl and C 
D)
jQuery

Correct Answer :  

Perl and C 

14 .
What is the correct way to include the file "header.inc" ?
A)
<!-- include file="header.inc" -->
B)
<?php include:"header.inc"; ?>
C)
<?php include file="header.inc"; ?>
D)
<?php include "header.inc"; ?>

Correct Answer :  

<?php include "header.inc"; ?>

15 .
In PHP which of following is the difference between include() and require() ?
A)
Both are same in every aspects
B)
Are different how they handle failure
C)
Is include() produced a Fatal Error while require results in a Warning
D)
None of the above

Correct Answer :  

Are different how they handle failure 

16 .
To process image what library needed in PHP?
A)
imageProcess
B)
imageCreator
C)
GD Library 
D)
PNG Library

Correct Answer :  

GD Library 

17 .
In PHP, which of the following function is used to insert content of one php file into another php file before server executes ?
A)
#include()
B)
include[]
C)
include()
D)
#include{}

Correct Answer :  

include() 

18 .
Which of the following function is used to redirect a page ?
A)
header()
B)
redirect()
C)
reflect()
D)
None of the above.

Correct Answer :  

header()

19 .
PHP variables are_____ ?
A)
Single type variable
B)
Multitype variables 
C)
Double type variables 
D)
Trible type variables

Correct Answer :  

Multitype variables

20 .
How can we check the value of a given variable is a number?
A)
numeric()
B)
number()
C)
is_number()
D)
is_numeric()

Correct Answer :  

is_numeric()

21 .
Which of following variable assignment is 'by value' assignment in PHP ?
A)
$value1= $value?   
B)
$value1= # $value?
C)
$value1= & $value? 
D)
None

Correct Answer :  

$value1= $value? 

22 .
How can we check the value of a given variable is alphanumeric?
A)
ctype_alnum() 
B)
ctype_alphanumeric()
C)
alnum()
D)
alphanumeric()

Correct Answer :  

ctype_alnum() 

23 .
How do I check if a given variable is empty?
A)
is_empty()
B)
empty() 
C)
null()
D)
is_null()

Correct Answer :  

empty()

24 .
Identify the variable scope that is not supported by PHP ?
A)
Local variables 
B)
Function parameters 
C)
Hidden variables   
D)
Global variables

Correct Answer :  

Hidden variables 

25 .
What is the correct way to create a function in PHP?
A)
create myFunction()
B)
function myFunction() 
C)
new_function myFunction()
D)
myFunction()

Correct Answer :  

function myFunction()

26 .
Which version of PHP introduced Try/catch Exception ?
A)
PHP 3
B)
PHP 5
C)
PHP 5.3
D)
PHP 7

Correct Answer :  

PHP 5

27 .
What is the correct way to open the file "footer.txt" as readable?
A)
fopen("footer.txt","r");
B)
fopen("footer.txt","r+");
C)
open("footer.txt","read");
D)
open("footer.txt");

Correct Answer :  

fopen("footer.txt","r"); 

28 .
Which one of the following PHP functions can be used to find files ?
A)
file()
B)
glob()  
C)
fget_file()
D)
globe.file()

Correct Answer :  

glob()

29 .
The left association operator % is used in PHP for ?
A)
percentage 
B)
division 
C)
bitwise or 
D)
modulus

Correct Answer :  

bitwise or

30 .
In PHP from the following which is the best all-purpose way of comparing two strings ?
A)
Using the strpos function
B)
Using strcasecmp()
C)
Using the == operator
D)
Using strcmp() 

Correct Answer :  

Using strcmp()

31 .
What will be the value of $var?
$var = 1 / 2;​
A)
0
B)
0.5
C)
1
D)
2

Correct Answer :  

0.5

32 .
What will be printed?
<?php
  $str = 'a\\b\n'; 
  echo $str;
?>​
A)
ab
B)
a\b
C)
a\b\n
D)
a\\b\n

Correct Answer :  

a\b\n

33 .
Which of the following function returns the number of characters in a string variable ?
A)
len($variable)
B)
count($variable)
C)
strlen($variable)    
D)
strcount($variable)

Correct Answer :  

strlen($variable) 

34 .
How do you get information from a form when method is "post"?
A)
$_GET[];
B)
$_POST[]; 
C)
$post
D)
Request.form;

Correct Answer :  

$_POST[]; 

35 .
In php which fo the following method is used to getting browser properties ?
A)
$_SERVER[‘PHP_SELF’]
B)
$_SERVER[‘SERVER_NAME’]
C)
$_SERVER[‘HTTP_VARIENT’]
D)
$_SERVER[‘HTTP_USER_AGENT’];

Correct Answer :  

$_SERVER[‘HTTP_USER_AGENT’]; 

36 .
In PHP which of the following gives a string containing PHP script file name in which it is called ?
A)
$_PHP_SELF
B)
$_COOKIE
C)
$_SESSION
D)
$php_errormsg

Correct Answer :  

$_PHP_SELF

37 .
Which superglobal variable holds information about headers, paths, and script locations?
A)
$_GET
B)
$_SESSION
C)
$_SERVER 
D)
$_GLOBALS

Correct Answer :  

$_SERVER

38 .
Which of the following type of variables are floating-point numbers, like 3.14159 or 49.1 ?
A)
Integers
B)
Strings
C)
Decimals
D)
Doubles 

Correct Answer :  

Doubles 

39 .
In PHP which of the following method sends input to a script through(via) a URL ?
A)
Get
B)
Post
C)
Both A and B
D)
None of the above

Correct Answer :  

Get

40 .
What is the correct way to add 1 to the $count variable?
A)
$count++; 
B)
$count =+1
C)
count++;
D)
++count

Correct Answer :  

$count++;

41 .
Which one of these variables has an illegal name?
A)
$my_Var
B)
$my-Var 
C)
$myVar
D)
$_myVar

Correct Answer :  

$my-Var

42 .
What will be printed?
<?php
   $var = 'a';
   $VAR = 'b';
  echo "$var$VAR";
?>​
A)
aa
B)
bb
C)
ba
D)
ab

Correct Answer :  

ab

43 .
Which of following are compound data type?
A)
Array 
B)
Objects
C)
Both
D)
None

Correct Answer :  

Both 

44 .
Which of the following method acts as a constructor function in a PHP class ?
A)
__construct
B)
class_name()
C)
constructor
D)
None of the above

Correct Answer :  

__construct

45 .
How do you create an array in PHP?
A)
$cars = "Volvo", "BMW", "Toyota";
B)
$cars = array{"Volvo", "BMW", "Toyota"};
C)
$cars = array["Volvo", "BMW", "Toyota"];
D)
$cars = array("Volvo", "BMW", "Toyota");

Correct Answer :  

$cars = array("Volvo", "BMW", "Toyota");

46 .
How do we access the value of 'd' later?
$a = array(
    'a',
    3 => 'b',
    1 => 'c',
    'd'
 );​
A)
$a[2]
B)
$a[3]
C)
$a[4]
D)
$a[5]

Correct Answer :  

$a[4]

47 .
What will be printed?
<?php
   $a = array(
	  null => 'a',
	  true => 'b',
	  false => 'c',
	  0 => 'd',
	  1 => 'e',
	  '' => 'f'
	);
  echo count($a), "\n";
?>​
A)
3
B)
4
C)
5
D)
6

Correct Answer :  

3

48 .
What will be the output of the following PHP code?
<?php
    define("Hi","Hello! How are you ?");
    echo constant("Hi");
?>​
A)
Hi
B)
Hello! How are you ?
C)
Hi, Hello! How are you ?
D)
“Hi”,”Hello ! How are you ?”

Correct Answer :  

Hello! How are you ?

49 .
Which in-built function will add a value to the end of an array ?
A)
into_array()
B)
array_unshift()
C)
inend_array()
D)
array_push()

Correct Answer :  

array_push()

50 .
Which two predefined variables are used to retrieve information from forms ?
A)
$__GET & $__SET
B)
$_GET & $_SET 
C)
$GET & $SET
D)
GET & SET

Correct Answer :  

$_GET & $_SET

51 .
How to start session in php?
A)
session_start()
B)
start session()
C)
session()
D)
$_SESSION[‘start’]

Correct Answer :   session_start()

52 .
Which of the following is used to check that a cookie is set or not ?
A)
 $_COOKIE variable
B)
isset() function 
C)
getcookie() function
D)
None of the above

Correct Answer :  

isset() function

53 .
How do you create a cookie in PHP?
A)
setcookie() 
B)
createcookie
C)
makecookie()
D)
newcookie

Correct Answer :  

setcookie()

54 .
In PHP which of the following is not a session function ?
A)
session_destroy
B)
session_decode
C)
session_id
D)
session_pw

Correct Answer :  

session_pw

55 .
In PHP the function setcookie( ) is used to ?
A)
Enable or disable cookie support
B)
Store data in cookie variable 
C)
Declare cookie variables
D)
All of the above

Correct Answer :  

Store data in cookie variable 

56 .
What is the purpose of $_SESSION[]?
A)
Used to store variables of the current session
B)
Used to initialize a session.
C)
Used to register a global variable
D)
None of the above

Correct Answer :  

Used to store variables of the current session

57 .
What is the default execution time set in set_time_limit()?
A)
20 secs
B)
30 secs
C)
35 secs   
D)
40 secs

Correct Answer :  

30 secs

58 .
Which statement about the code below is correct?
<?php 
  class A {}
  class B {}
  class C extends A, B {}
?>​
A)
the code is perfectly fine
B)
classes can not be empty
C)
class C can not extend both A and B     
D)
All of the above

Correct Answer :  

class C can not extend both A and B

59 .
Which of the following is true about php.ini file ?
A)
The php.ini file is read each time PHP is initialized.
B)
The PHP configuration file, php.ini, is the final and most immediate way to affect the functionality of PHP.
C)
All of the above
D)
None of the above

Correct Answer :  

All of the above

60 .
Which function returns an array consisting of associative key/value pairs ?
A)
array_count_values()
B)
count_values()
C)
array_count()
D)
count()

Correct Answer :  

array_count_values()

61 .
Which operator is used to check if two values are equal and of same data type?
A)
=
B)
==
C)
=== 
D)
!=

Correct Answer :  

===

62 .
What is the use of explode() in PHP?
A)
Used to split a string by a string 
B)
Used to convert a string to an array
C)
Used to split string into two equal halves
D)
None of the Above

Correct Answer :  

Used to split a string by a string 

63 .
How do I create PHP arrays in a HTML <form>?
A)
<input name= MyArray[]/>
B)
<input ="MyArray[]" />
C)
<input name="MyArray[]" />
D)
<input MyArray[] />

Correct Answer :  

<input name="MyArray[]" />

64 .
In which variable is the users IP address stored?
A)
$DOMAIN
B)
$GLOBALS
C)
$_ENV
D)
$REMOTE_ADDR

Correct Answer :  

$REMOTE_ADDR

65 .
Which of the following method can be used to create a MySql database using PHP ?
A)
mysql_query()
B)
mysql_close()
C)
mysql_connect()
D)
None of the above

Correct Answer :  

mysql_query()

66 .
Which functions is used to get the height of an image :
A)
getimagehight()
B)
imagesy()
C)
image_hight()
D)
imagehight()

Correct Answer :  

imagesy()

67 .
What is the function file_get_contents() useful for?
A)
read
B)
write
C)
save
D)
upload

Correct Answer :  

read

68 .
Which of the following is NOT a valid PHP comparison operator?
A)
!=
B)
>=
C)
&&& 
D)
<>

Correct Answer :  

&&&

69 .
Which one of the following function is used to send a e-mail using PHP script ?
A)
mail_send()
B)
mail()
C)
mailrr()
D)
send_mail()

Correct Answer :  

mail()

70 .
How to determine number of rows returned in result set?
A)
mysqli_num_row()
B)
mysqli_rows()
C)
mysqli_num_rows()
D)
mysqli_nums_row()

Correct Answer :  

mysqli_num_rows()

71 .
Which function gives us the number of affected entries by a query?
A)
mysqli_affects_row()
B)
mysqli_affected()
C)
mysqli_affect_rows()
D)
mysqli_affected_rows()

Correct Answer :  

mysqli_affected_rows()

72 .
What is the default upload file size in php?
A)
16 MB
B)
2 MB 
C)
8 MB
D)
Any size you can upload.

Correct Answer :  

2 MB

73 .
Which of the following method can be used to close a MySQL database using PHP ?
A)
mysql_close()
B)
mysql_query()
C)
mysql_connect()
D)
None of the above

Correct Answer :  

mysql_close()

74 .
In PHP the error control operator is _______ ?
A)
 .
B)
*
C)
@
D)
&

Correct Answer :   @

75 .
What is the output ?
<?php 
	define("x","5"); 
	$x=x+10; 
	echo x; 
?>​
A)
5
B)
10
C)
15
D)
Error

Correct Answer :   5

76 .
What is the out put.
<?php 
  $x=array(1,3,2,3,7,8,9,7,3); 
  $y=array_count_values($x); 
  echo $y[9]; 
?>​
A)
9
B)
7
C)
3
D)
1

Correct Answer :  

3

77 .
What will be printed ?
if (null === false) {
  echo 'true';
} else {
  echo 'false';
}​
A)
true
B)
false 
C)
there is a syntax error
D)
None of the above

Correct Answer :  

false 

78 .
What is the perfect output ?
<?php
  $RESULT = 11 + 011 + 0x11;
  echo "$RESULT";
?>​
A)
11
B)
22
C)
33
D)
37

Correct Answer :   37

79 .
What is the difference between echo and print?
A)
They both behave the same.
B)
Print can take multiple parameters where as echo cannot
C)
Echo can take multiple parameters where as print cannot
D)
Print is a function where as echo is not.

Correct Answer :  

Echo can take multiple parameters where as print cannot

80 .
Which one of the following is the correct abstract method?
A)
public function write()
B)
abstract function write()
C)
abstract public write();
D)
abstract public function write();

Correct Answer :   abstract public function write();

81 .
Which of the following array represents an array with a numeric index?
A)
Numeric Array
B)
Associative Array
C)
Multidimentional Array
D)
None of the above

Correct Answer :   Numeric Array

82 .
In mail($param2, $param2, $param3, $param4), the $param2 contains:
A)
The message
B)
The recipient
C)
The header
D)
The subject

Correct Answer :   The subject

83 .
Which of following function return 1 when output is successful?
A)
echo ( )
B)
print ( )
C)
both
D)
None of the above

Correct Answer :   print ( )

84 .
Which function is used to strip whitespace (or other characters) from the beginning and end of a string?
A)
trim_str
B)
strip
C)
trim
D)
strip_str

Correct Answer :   trim

85 .
Which of the following is not true?
A)
PHP can be used to develop web applications.
B)
PHP makes a website dynamic
C)
PHP applications can not be compile
D)
PHP can not be embedded into html

Correct Answer :   PHP applications can not be compile

86 .
If a boolean variable $ alive= 5;
A)
$ alive is false
B)
$ alive is true
C)
$ alive is overflow
D)
the statement is not valid

Correct Answer :   $ alive is true

87 .
Which of the following PHP functions accepts any number of parameters?
A)
 func_get_args()
B)
func_get_argv()
C)
get_argv()
D)
get_argc()

Correct Answer :    func_get_args()

88 .
Which of following is not a Superglobals in PHP?
A)
$_SERVER
B)
$_ENV
C)
$_FILES
D)
$_PUT

Correct Answer :   $_PUT

89 .
What will be the output of the following PHP code?
 
    <?php
    $a = 5;
    $b = 5;
    echo ($a === $b);
    ?>
A)
1
B)
5 === 5
C)
Error
D)
None of the above

Correct Answer :   1

90 .
Which of the conditional statements is/are supported by PHP?
 
i) if statements
ii) if-else statements
iii) if-elseif statements
iv) switch statements
 
A)
Only i)
B)
i), ii) and iv)
C)
ii), iii) and iv)
D)
i), ii), iii) and iv)

Correct Answer :   i), ii), iii) and iv)

91 .
Which of the looping statements is/are supported by PHP?
 
i) for loop
ii) while loop
iii) do-while loop
iv) foreach loop
 
A)
i) and ii)
B)
i), ii) and iii)
C)
i), ii), iii) and iv)
D)
None of the above

Correct Answer :   i), ii), iii) and iv)

92 .
If $a = 12 what will be returned when ($a == 12) ? 5 : 1 is executed?
A)
1
B)
5
C)
12
D)
Error

Correct Answer :   5

93 .
What will be the value of $a and $b after the function call in the following PHP code?
 
    <?php
    function doSomething( &$arg ) {
        $return = $arg;
        $arg += 1;
        return $return;	
    }
    $a = 3;
    $b = doSomething( $a );
    ?>
A)
a is 3 and b is 4
B)
a is 4 and b is 3
C)
Error
D)
None of the above

Correct Answer :   a is 4 and b is 3

94 .
Type Hinting was introduced in which version of PHP?
A)
PHP 4
B)
PHP 5
C)
PHP 5.3
D)
PHP 6

Correct Answer :   PHP 5

95 .
Which of the following are valid function names?
 
i) function()
ii) €()
iii) .function()
iv) $function()
 
A)
Only i)
B)
Only ii)
C)
i) and ii)
D)
iii) and iv)

Correct Answer :   Only ii)

96 .
What will be the output of the following PHP code?
 
    <?php
    function a()
    {
        function b()
        {
            echo 'I am b';
 	}
        echo 'I am a';
    }
    a();
    a();
    ?>
A)
I am a
B)
I am bI am a
C)
I am a Error
D)
Error

Correct Answer :   I am a

97 .
A function in PHP which starts with __ (double underscore) is known as ___
A)
Inbuilt Function
B)
Default Function
C)
User Defined Function
D)
Magic Function

Correct Answer :   Magic Function

98 .
PHP’s numerically indexed array begin with position ___________
A)
0
B)
1
C)
-1
D)
2

Correct Answer :   0

99 .
Which of the following are correct ways of creating an array?
 
i) state[0] = "nellore";
ii) $state[] = array("nellore");
iii) $state[0] = "nellore";
iv)  $state = array("nellore");
A)
Only i)
B)
ii) and iii)
C)
iii) and iv)
D)
ii), iii) and iv)

Correct Answer :   iii) and iv)

100 .
Which of the following PHP function will return true if a variable is an array or false if it is not an array?
A)
this_array()
B)
is_array()
C)
do_array()
D)
in_array()

Correct Answer :   is_array()

101 .
Which in-built function will add a value to the end of an array?
A)
array_unshift()
B)
into_array()
C)
inend_array()
D)
array_push()

Correct Answer :   array_push()

102 .
What will be the output of the following PHP code?
 
    <?php
    $state = array ("Karnataka", "Goa", "Tamil Nadu",
    "Andhra Pradesh");
    echo (array_search ("Tamil Nadu", $state) );
    ?>
A)
1
B)
2
C)
True
D)
False

Correct Answer :   2

103 .
What will be the output of the following PHP code?
 
    <?php
    $fruits = array ("apple", "orange", "banana");
    echo (next($fruits));	
    echo (next($fruits));
    ?>
A)
appleapple
B)
orangeorange
C)
appleorange
D)
orangebanana

Correct Answer :   orangebanana

104 .
Which of the following function is used to get the value of the previous element in an array?
A)
last()
B)
before()
C)
prev()
D)
previous()

Correct Answer :   prev()

105 .
Which function returns an array consisting of associative key/value pairs?
A)
count()
B)
array_count()
C)
array_count_values()
D)
count_values()

Correct Answer :   array_count_values()

106 .
What will be the output of the following PHP code?
 
<?php
$a1 = array("a" => "red", "b" => "green", "c" => "blue", "d" => "yellow");
$result = array_flip($a1);
print_r($result);
?>
A)
Array ( [red] => a [green] => b [blue] => c [yellow] => d )
B)
Array ( [red] => red [green] => green [blue] => blue [yellow] => yellow )
C)
Array ( [a] => a [b] => b [c] => c [d] => d )
D)
Array ( [a] => red [b] => green [c] => blue [d] => yellow )

Correct Answer :   Array ( [red] => a [green] => b [blue] => c [yellow] => d )

107 .
What will be the output of the following PHP code?
 
<?php
$a1 = array("a" => "red", "b" => "green", "c" => "blue", "d" => "yellow");
$a2 = array("e" => "red","f" => "green", "g" => "blue");
$result = array_intersect($a1, $a2);
print_r($result);
?>
A)
Array ( [e] => red [f] => green [g] => blue )
B)
Array ( [a] => red [b] => green [c] => blue )
C)
Array ( [a] => red [b] => green [c] => blue [d] => yellow )
D)
Array ( [a] => red [b] => green [c] => blue [d] => yellow [e] => red [f] => green [g] => blue )

Correct Answer :   Array ( [a] => red [b] => green [c] => blue )

108 .
What will be the output of the following PHP code?
 
<?php
$a = array(12, 5, 2);
echo(array_product($a));
?>
A)
010
B)
024
C)
120
D)
060

Correct Answer :   120

109 .
What will be the output of the following PHP code?
 
<?php
$number = range(0, 5);
print_r ($number);
?>
A)
Array ( [0] => 0 [1] => 1 [2] => 2 [3] => 3 [4] => 4 [5] => 5 )
B)
Array ( [0] => 0 [1] => 0 [2] => 0 [3] => 0 [4] => 0 [5] => 0 )
C)
Array ( [0] => 5 [1] => 5 [2] => 5 [3] => 5 [4] => 5 [5] => 5 )
D)
Array ( [0] => 0 [5] => 5 )

Correct Answer :   Array ( [0] => 0 [1] => 1 [2] => 2 [3] => 3 [4] => 4 [5] => 5 )

110 .
What will be the output of the following PHP code?
 
    <?php
    $fruits = array ("mango", "apple", "pear", "peach");
    $fruits = array_flip($fruits);
    echo ($fruits[0]);
    ?>
A)
0
B)
mango
C)
peach
D)
error

Correct Answer :   error

111 .
Which function should we use to sort the array in natural order?
A)
dsort()
B)
casesort()
C)
natcasesort()
D)
naturalsort()

Correct Answer :   natcasesort()

112 .
What will be the output of the following PHP code?
 
    <?php
    $face = array ("A", "J", "Q", "K");
    $number = array ("2","3","4", "5", "6", "7", "8", "9", "10");
    $cards = array_merge ($face, $number);
    print_r ($cards);
    ?>
A)
Array ( [0] => A [1] => J [2] => Q [3] => K [4] => 2 [5] => 3 [6] => 4 [7] => 5 [8] => 6 [9] => 7 [10] => 8 [11] => 9 [12] => 10 )
B)
Array ( [0] => A [1] => 2 [2] => J [3] => 3 [4] => Q [5] => 4 [6] => K [7] => 5 [8] => 6 [9] => 7 [10] => 8 [11] => 9 [12] => 10 )
C)
Array ( [0] => 2 [1] => 3 [2] => 4 [3] => 5 [4] => 6 [5] => 7 [6] => 8 [7] => 9 [8] => 10 [9] => A [10] => J [11] => Q [12] => K )
D)
Error

Correct Answer :   Array ( [0] => A [1] => J [2] => Q [3] => K [4] => 2 [5] => 3 [6] => 4 [7] => 5 [8] => 6 [9] => 7 [10] => 8 [11] => 9 [12] => 10 )

113 .
What will be the output of the following PHP code?
 
    <?php
    $fruits = array ("apple", "mango", "peach", "pear",
    "orange");
    $subset = array_splice ($fruits, 2);
    print_r ($fruits);
    ?>
A)
Array ( [0] => apple [1] => mango [2] => peach )
B)
Array ( [0] => apple [1] => mango )
C)
Array ( [0] => pear [1] => orange )
D)
Error

Correct Answer :   Array ( [0] => apple [1] => mango )

114 .
What will be the output of the following PHP code?
 
    <?php
    $number = array ("4", "hello", 2);
    echo (array_sum ($number));
    ?>
A)
2
B)
4
C)
6
D)
Error

Correct Answer :   6

115 .
The practice of separating the user from the true inner workings of an application through well-known interfaces is known as _________
A)
Polymorphism
B)
Inheritance
C)
Encapsulation
D)
Abstraction

Correct Answer :   Encapsulation

116 .
Which of the following term originates from the Greek language that means “having multiple forms,” defines OOP’s ability to redefine, a class’s characteristics?
A)
Polymorphism
B)
Abstraction
C)
Inheritance
D)
Differential

Correct Answer :   Polymorphism

117 .
The practice of creating objects based on predefined classes is often referred to as ________
A)
class creation
B)
object creation
C)
object instantiation
D)
class instantiation

Correct Answer :   class instantiation

118 .
Which one of the following can be used to instantiate an object in PHP assuming class name to be Foo?
A)
$obj = new $foo;
B)
$obj = new foo;
C)
$obj = new foo ();
D)
obj = new foo ();

Correct Answer :   $obj = new foo ();

119 .
Which one of the following is the right way to define a constant?
A)
const PI = ‘3.1415’;
B)
constant PI = ‘3.1415’;
C)
constant PI = “3.1415”;
D)
const $PI = “3.1415”;

Correct Answer :   const PI = ‘3.1415’;

120 .
Which one of the following is the right way to invoke a method?
A)
object->methodName();
B)
$object->methodName();
C)
object::methodName();
D)
$object::methodName();

Correct Answer :   $object->methodName();

121 .
Which of the following is/are the right way to declare a method?
 
i) function functionName() { function body }
ii) scope function functionName() { function body }
iii) method methodName() { method body }
iv) scope method methodName() { method body }
 
A)
Only ii)
B)
Only iv)
C)
i) and ii)
D)
iii) and iv)

Correct Answer :   i) and ii)

122 .
In the following PHP code, what is/are the properties?
 
    <?php
    class Example 
    {
        public $name;
        function Sample()
        {
            echo "This is an example";
        }
    } 
    ?>
A)
public $name;
B)
class Example
C)
echo “This is an example”;
D)
function sample()

Correct Answer :   public $name;

123 .
Which keyword allows class members (methods and properties) to be used without needing to instantiate a new instance of the class?
A)
final
B)
static
C)
private
D)
protected

Correct Answer :   static

124 .
Which method scope prevents a method from being overridden by a subclass?
A)
Abstract
B)
Static
C)
Protected
D)
Final

Correct Answer :   Final

125 .
PHP recognizes constructors by the name _________
A)
_construct()
B)
classname()
C)
function __construct()
D)
None of the above

Correct Answer :   function __construct()

126 .
Which one of the following keyword is used to inherit our subclass into a superclass?
A)
extends
B)
inherit
C)
implements
D)
include

Correct Answer :   extends

127 .
Which one of the following is the right way to clone an object?
A)
_clone(targetObject);
B)
destinationObject = clone targetObject;
C)
destinationObject = _clone(targetObject);
D)
destinationObject = clone(targetObject);

Correct Answer :   destinationObject = clone targetObject;

128 .
The class from which the child class inherits is called ________
 
i) Child class
ii) Parent class
iii) Super class
iv) Base class
A)
Only i)
B)
Only iii)
C)
ii) and iv)
D)
ii), iii) and iv)

Correct Answer :   ii) and iv)

129 .
Which method is used to tweak an object’s cloning behavior?
A)
clone()
B)
__clone()
C)
_clone
D)
object_clone()

Correct Answer :   __clone()

130 .
Which magic method is used to implement overloading in PHP?
A)
__call
B)
__invoke
C)
__wakeup
D)
__unset

Correct Answer :   __call

131 .
How many error levels are available in PHP?
A)
14
B)
15
C)
16
D)
17

Correct Answer :   16

132 .
What is the description of Error level E_ERROR?
A)
Near-fatal error
B)
Fatal run-time error
C)
Compile-time error
D)
Fatal Compile-time error

Correct Answer :   Fatal run-time error

133 .
Say you want to report error concerned about fatal run-time, fatal compile-time error and core error which statement would you use?
A)
error_reporting = E_ALL
B)
error_reporting = E_ERROR | E_PARSE | E_CORE_ERROR
C)
error_reporting = E_ERROR | E_COMPILE_WARNING | E_CORE_ERROR
D)
error_reporting = E_ERROR | E_COMPILE_ERROR | E_CORE_ERROR

Correct Answer :   error_reporting = E_ERROR | E_COMPILE_ERROR | E_CORE_ERROR

134 .
Which of the following statements causes PHP to disregard repeated error messages that occur within the same file and on the same line?
A)
ignore_repeated_errors
B)
ignore_repeat_error
C)
repeatedly_ignore_error
D)
repeated_error_ignore

Correct Answer :   ignore_repeated_errors

135 .
Which function initializes the constants necessary for using the openlog(), clodelog(), and syslog() functions?
A)
define_variable()
B)
define_log_variable()
C)
log_variable()
D)
define_syslog_variable()

Correct Answer :   define_syslog_variable()

136 .
Which function is responsible for sending a custom message to the system log?
A)
systemlog()
B)
syslog()
C)
log_system()
D)
sys_log()

Correct Answer :   syslog()

137 .
Which version added the method getPrevious()?
A)
PHP 4
B)
PHP 5
C)
PHP 5.1
D)
PHP 5.3

Correct Answer :   PHP 5.3

138 .
Which one of the following is the right description for the method getMessage()?
A)
Returns the message if it is passed to the constructor
B)
Returns the message if it is passed to the class
C)
Returns the message if it is passed to the file
D)
Returns the message if it is passed to the object

Correct Answer :   Returns the message if it is passed to the constructor

139 .
What does SPL stand for?
A)
Standard PHP Library
B)
Source PHP Library
C)
Standard PHP List
D)
Source PHP List

Correct Answer :   Standard PHP Library

140 .
Which of the following is/are an exception?
 
i) BadFunctionCallException
ii) BadMethodCallException
iii) LogicException
iv) DomainException
 
A)
Only ii)
B)
Only iii)
C)
Only iv)
D)
i), ii), iii) and iv)

Correct Answer :   i), ii), iii) and iv)

141 .
Which one of the following filter is used to filter several variables with the same or different filters?
A)
filter_input
B)
filter_input_array
C)
filter_var()
D)
filter_var_array()

Correct Answer :   filter_var_array()

142 .
What will be the output of the following PHP code?
 
    <?php
    $num = "123";
    if (!filter_var($num, FILTER_VALIDATE_INT))
        echo("Integer is not valid");
    else
        echo("Integer is valid");
    ?>
A)
Integer is not valid
B)
Integer is valid
C)
No output is returned
D)
Error

Correct Answer :   Integer is valid

143 .
Which one of the following does not describe a validating filter?
A)
Are used to allow or disallow specific characters in a string
B)
re used to validate user input
C)
Strict format rules
D)
Returns the expected type on success or FALSE on failure

Correct Answer :   Are used to allow or disallow specific characters in a string

144 .
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");
    else
        echo("Integer is valid");
    ?>
A)
Integer is valid
B)
Integer is not valid
C)
No output is returned
D)
Error

Correct Answer :   Integer is not valid

145 .
What will be the output of the following PHP code?
 
    <?php
    $value = 'car';
    $result = filter_var($value, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE);
    ?>
A)
TRUE
B)
FALSE
C)
NULL
D)
ERROR

Correct Answer :   NULL

146 .
What will be the output of the following PHP code?
 
    <?php
    function convertSpace($string)
    {
        return str_replace("_", " ", $string);
    }
    $string = "Peter_is_a_great_guy!";
    echo filter_var($string, FILTER_CALLBACK, array("options"=>"convertSpace"));
    ?>
A)
Peterisagreatguy!
B)
Peter is a great guy!
C)
Peter_is_a_great_guy!
D)
Error

Correct Answer :   Peter is a great guy!

147 .
[:alpha:] can also be specified as ________
A)
[a-z]
B)
[A-z]
C)
[A-za-z]
D)
[A-Za-z0-9]

Correct Answer :   [A-za-z]

148 .
POSIX implementation was deprecated in which version of PHP?
A)
PHP 4
B)
PHP 5
C)
PHP 5.1
D)
PHP 5.3

Correct Answer :   PHP 5.3

149 .
POSIX stands for _______
A)
Portable Operating System Interface for Unix
B)
Portable Operating System Interface for Linux
C)
Portative Operating System Interface for Unix
D)
Portative Operating System Interface for Linux

Correct Answer :   Portable Operating System Interface for Unix

150 .
What will be the output of the following PHP code?
 
    <?php
    $text = "this is\tsome text that\nwe might like to parse.";
    print_r(split("[\n\t]",$text));
    ?>
A)
Array ( [0] => some text that [1] => we might like to parse. )
B)
Array ( [0] => this is [1] => some text that [2] => we might like to parse. )
C)
[0] => this is [1] => some text that [2] => we might like to parse.
D)
None of the above

Correct Answer :   [0] => this is [1] => some text that [2] => we might like to parse.

151 .
Which among the following is/are not a metacharacter?

i) \a
ii) \A
iii) \b
iv) \B
A)
Only i)
B)
i) and iii)
C)
ii) and iv)
D)
ii), iii) and iv)

Correct Answer :   Only i)

152 .
What will be the output of the following PHP code?
 
    <?php
    $foods = array("pasta", "steak", "fish", "potatoes");
    $food = preg_grep("/^s/", $foods);
    print_r($food);
    ?>
A)
Array ( [0] => potatoes )
B)
Array ( [3] => potatoes )
C)
Array ( [1] => steak )
D)
Array ( [0] => pasta [1] => steak [2] => fish [3] => potatoes )

Correct Answer :   Array ( [1] => steak )

153 .
Which one of the following functions will convert a string to all uppercase?
A)
strtoupper()
B)
uppercase()
C)
str_uppercase()
D)
struppercase()

Correct Answer :   strtoupper()

154 .
What will be the output of the following PHP code?
 
    <?php
    echo str_pad("Salad", 5)." is good.";
    ?>
A)
is good  Salad
B)
Salad  is good
C)
is good SaladSaladSaladSaladSalad
D)
SaladSaladSaladSaladSalad is good

Correct Answer :   Salad  is good

155 .
Which one of the following functions can be used to concatenate array elements to form a single delimited string?
A)
explode()
B)
implode()
C)
concat()
D)
concatenate()

Correct Answer :   implode()

156 .
Which one of the following functions finds the last occurrence of a string, returning its numerical position?
A)
strpos()
B)
strlast()
C)
strrpos()
D)
strlastpos()

Correct Answer :   strrpos()

157 .
What will be the output of the following PHP code?
 
    <?php
    $url = "freetimelearn@example.com";
    echo ltrim(strstr($url, "@"),"@");
    ?>
A)
freetimelearn@example.com
B)
freetimelearn
C)
freetimelearn@
D)
example.com

Correct Answer :   example.com

158 .
The filesize() function returns the file size in _________
A)
bits
B)
bytes
C)
kilobytes
D)
gigabytes

Correct Answer :   bytes

159 .
Which one of the following PHP function is used to determine a file’s last access time?
A)
fileltime()
B)
filectime()
C)
fileatime()
D)
filetime()

Correct Answer :   fileatime()

160 .
Which one of the following function is capable of reading a file into a string variable?
A)
file_content()
B)
file_contents()
C)
file_get_contents()
D)
file_get_content()

Correct Answer :   file_get_contents()

161 .
Which one of the following function operates similarly to fgets(), except that it also strips any HTML and PHP tags form the input?
A)
fgetsh()
B)
fgetsp()
C)
fgetsa()
D)
fgetss()

Correct Answer :   fgetss()

162 .
Which one of the following function outputs the contents of a string variable to the specified resource?
A)
filewrite()
B)
fwrite()
C)
filewrites()
D)
fwrites()

Correct Answer :   fwrite()

163 .
Which function is useful when you want to output the executed command result?
A)
cmm()
B)
out_cmm()
C)
system()
D)
out_system()

Correct Answer :   system()

164 .
Which one of the following function reads a directory into an Array?
A)
scandir()
B)
readdir()
C)
scandirectory()
D)
readdirectory()

Correct Answer :   scandir()

165 .
The date() function returns ___ representation of the current date and/or time.
A)
Integer
B)
String
C)
Float
D)
Boolean

Correct Answer :   String

166 .
Which one of the following format parameter can be used to identify timezone?
A)
T
B)
N
C)
E
D)
I

Correct Answer :   E

167 .
Which one of the following function is useful for producing a timestamp based on a given date and time?
A)
time()
B)
mktime()
C)
mrtime()
D)
mtime()

Correct Answer :   mktime()

168 .
Which function displays the web page’s most recent modification date?
A)
lastmod()
B)
getlastmod()
C)
last_mod()
D)
get_last_mod()

Correct Answer :   getlastmod()

169 .
What will be the output of the following code? (If say date is 08/10/2018.)
 
    <?php
    echo "Today is ".date("F d, Y");
    ?>
A)
Today is 08 October, 2018
B)
Today is 08-10-2018
C)
Today is 10-08-2018
D)
Today is October 08, 2018

Correct Answer :   Today is October 08, 2018

170 .
Suppose you want to calculate the date 45 days from the present date which one of the following statement will you use?
A)
totime(“+45”)
B)
totime(“+45 days”)
C)
strtotime(“+45 days”)
D)
strtotime(“-45 days”)

Correct Answer :   strtotime(“+45 days”)

171 .
Which two predefined variables are used to retrieve information from forms?
A)
$GET & $SET
B)
$_GET & $_SET
C)
GET & SET
D)
$__GET & $__SET

Correct Answer :   $_GET & $_SET

172 .
When you use the $_GET variable to collect data, the data is visible to _______
A)
only you
B)
everyone
C)
everyone
D)
None of the above

Correct Answer :   everyone

173 .
Which variable is used to collect form data sent with both the GET and POST methods?
A)
$BOTH
B)
$_BOTH
C)
$REQUEST
D)
$_REQUEST

Correct Answer :   $_REQUEST

174 .
Which one of the following should not be used while sending passwords or other sensitive information?
A)
POST
B)
GET
C)
NEXT
D)
REQUEST

Correct Answer :   GET

175 .
To validate an email address, which flag is to be passed to the function filter_var()?
A)
VALIDATE_MAIL
B)
VALIDATE_EMAIL
C)
FILTER_VALIDATE_MAIL
D)
FILTER_VALIDATE_EMAIL

Correct Answer :   FILTER_VALIDATE_EMAIL

176 .
Which of the following variables does PHP use to authenticate a user?
 
i) $_SERVER['PHP_AUTH_USER'].
ii) $_SERVER['PHP_AUTH_USERS'].
iii) $_SERVER['PHP_AUTH_PU'].
iv) $_SERVER['PHP_AUTH_PW'].
A)
i) and ii)
B)
ii) and iv)
C)
i) and iv)
D)
ii) and iii)

Correct Answer :   i) and iv)

177 .
Which function is used to verify whether a variable contains a value?
A)
inset()
B)
isset()
C)
header()
D)
footer()

Correct Answer :   isset()

178 .
In which authentication method does changing the username or password can be done only by entering the code and making the manual adjustment.
A)
File-based authentication
B)
Data-based authentication
C)
PEAR’S HTTP authentication
D)
Hard-coding a login pair directly into the script

Correct Answer :   Hard-coding a login pair directly into the script

179 .
Which function is used to split a string into a series of substrings, with each string boundary is determined by a specific separator?
A)
break()
B)
md5()
C)
explode()
D)
divide()

Correct Answer :   explode()

180 .
Which is the most powerful authentication method among the four?
A)
File-based authentication
B)
Hard-coding a login pair directly into the script
C)
PEAR’S HTTP authentication
D)
Data-based authentication

Correct Answer :   Data-based authentication

181 .
Which directive determines whether PHP scripts on the server can accept file uploads?
A)
file_uploads
B)
file_upload
C)
file_input
D)
file_intake

Correct Answer :   file_uploads

182 .
Which of the following directive determines the maximum amount of time that a PHP script will spend attempting to parse input before registering a fatal error?
A)
max_take_time
B)
max_intake_time
C)
max_input_time
D)
max_parse_time

Correct Answer :   max_input_time

183 .
Since which version of PHP was the directive max_file_limit available.
A)
PHP 5.2.1
B)
PHP 5.2.2
C)
PHP 5.2.12
D)
PHP 5.2.21

Correct Answer :   PHP 5.2.12

184 .
Which directive sets a maximum allowable amount of memory in megabytes that a script can allow?
A)
max_size
B)
post_max_size
C)
max_memory_limit
D)
memory_limit

Correct Answer :   memory_limit

185 .
If you want to temporarily store uploaded files in the /tmp/phpuploads/ directory, which one of the following statement will you use?
A)
upload_tmp_dir “/tmp/phpuploads/ directory”
B)
upload_dir “/tmp/phpuploads/ directory”
C)
upload_temp_dir “/tmp/phpuploads/ directory”
D)
upload_temp_director “/tmp/phpuploads/ directory”

Correct Answer :   upload_tmp_dir “/tmp/phpuploads/ directory”

186 .
Which superglobal stores a variety of information pertinent to a file uploaded to the server via a PHP script?
A)
$_FILE Array
B)
$_FILES Array
C)
$_FILES_UPLOADED Array
D)
$_FILE_UPLOADED Array

Correct Answer :   $_FILES Array

187 .
Which function is used to determine whether a file was uploaded?
A)
is_file_uploaded()
B)
is_uploaded_file()
C)
file_uploaded(“filename”)
D)
uploaded_file(“filename”)

Correct Answer :   is_uploaded_file()

188 .
What is the full form of DNS?
A)
Digital Network System
B)
Domain Network System
C)
Digital Name Systmem
D)
Domain Name System

Correct Answer :   Domain Name System

189 .
Which one of the following function is used to return an array consisting of various DNS resource records pertinent to a specific domain?
A)
dns_record()
B)
dns_get_record()
C)
dnsrr_record()
D)
dnsrr_get_record()

Correct Answer :   dns_get_record()

190 .
Which one of the following function is used to retrieve the MX records for the domain specified by hostname?
A)
getmx()
B)
getmxrr()
C)
retrieve_mx()
D)
retrieve_mxrr()

Correct Answer :   getmxrr()

191 .
Which one of the following function is used to send an email using PHP script?
A)
mail()
B)
mailrr()
C)
send_mail()
D)
mail_send()

Correct Answer :   mail()

192 .
Which of the following statements is used to add an attachment to the mail?
A)
$mimemail->attachment(‘attachment.pdf’);
B)
$mimemail=>attachment(‘attachment.pdf’);
C)
$mimemail->addAttachment(‘attachment.pdf’);
D)
$mimemail=>addAttachment(‘attachment.pdf’);

Correct Answer :   $mimemail->addAttachment(‘attachment.pdf’);

193 .
Which one of the following is the very first task executed by a session enabled page?
A)
Start a new session
B)
Delete the previous session
C)
Handle the session
D)
Check whether a valid session exists

Correct Answer :   Check whether a valid session exists

194 .
Which directive determines how the session information will be stored?
A)
save_data
B)
session.save
C)
session.save_data
D)
session.save_handler

Correct Answer :   session.save_handler

195 .
If session.use_cookie is set to 0, this results in use of _______
A)
Session
B)
Cookie
C)
URL rewriting
D)
Nothing happens

Correct Answer :   URL rewriting

196 .
Neglecting to set which of the following cookie will result in the cookie’s domain being set to the host name of the server which generated it.
A)
session.domain
B)
session.cookie_domain
C)
session.path
D)
session.cookie_path

Correct Answer :   session.cookie_domain

197 .
Which one of the following function is used to start a session?
A)
session_start()
B)
start_session()
C)
session_begin()
D)
begin_session()

Correct Answer :   session_start()

198 .
Which function is used to erase all session variables stored in the current session?
A)
session_destroy()
B)
session_change()
C)
session_remove()
D)
session_unset()

Correct Answer :   session_unset()

199 .
Which one of the following statements should you use to set the session username to Chanti?
A)
$SESSION[‘username’] = “Chanti”;
B)
$_SESSION[‘username’] = “Chanti”;
C)
session_start(“chanti”);
D)
$SESSION_START[“username”] = “Chanti”;

Correct Answer :   $_SESSION[‘username’] = “Chanti”;

200 .
What will be the output of the following PHP code? (Say your previous session username was chanti.)
 
    unset($_SESSION['username']);
    printf("Username now set to: %s", $_SESSION['username']);
A)
Username now set to: chanti
B)
Username now set to: System
C)
Username now set to:
D)
Error

Correct Answer :   Username now set to:

201 .
An attacker somehow obtains an unsuspecting user’s SID and then using it to impersonate the user in order to gain potentially sensitive information. This attack is known as __________
A)
session-copy
B)
session-hijack
C)
session-fixing
D)
session-fixation

Correct Answer :   session-fixation

202 .
Which parameter determines whether the old session file will also be deleted when the session ID is regenerated?
A)
delete_old_file
B)
delete_old_session
C)
delete_session_file
D)
delete_old_session_file

Correct Answer :   delete_old_session

203 .
Which function effectively deletes all sessions that have expired?
A)
session_delete()
B)
session_destroy()
C)
session_garbage_collect()
D)
SessionHandler::gc

Correct Answer :   SessionHandler::gc

204 .
Which function is used to transform PHP’s session-handler behavior into that defined by your custom handler?
A)
session_set_save()
B)
Session_handler()
C)
session_save_handler()
D)
session_set_save_handler()

Correct Answer :   session_set_save_handler()

205 .
Which one of the following statements should be used to disable just the fopen(), and file() functions?
A)
disable_functions = fopen(), file()
B)
disable_functions = fopen, file
C)
functions_disable = fopen, file
D)
functions_disable = fopen(), file()

Correct Answer :   disable_functions = fopen, file

206 .
The memory_limit is only applicable if ________ is enabled when you configure PHP.
A)
–enable-limit
B)
-enable-memory-limit
C)
–enable-memory-limit
D)
-memory-limit

Correct Answer :   –enable-memory-limit

207 .
Suppose all web material is located within the directory /home/www. To prevent users from viewing and manipulating files such as /etc/password, which one of the following statements should you use?
A)
open_dir = “/home/www/”
B)
open_dir = /home/www/
C)
open_basedir = /home/www/
D)
open_basedir = “/home/www/”

Correct Answer :   open_basedir = “/home/www/”

208 .
Which Apache directive outputs Apache’s server version, server name, port and compile-in modules?
A)
ServerInfo
B)
ServerName
C)
ServerSignature
D)
ServerDetails

Correct Answer :   ServerSignature

209 .
Say I want to change the extension of a PHP file, which of the following statements should I edit to change from .php to .html in the httpd.conf file?
A)
AddType application/x-httpd-php .php
B)
AddType application/x-httpd-asp .php
C)
AddType application/x-httpd-php .asp
D)
AddType application/x-httpd-asp .asp

Correct Answer :   AddType application/x-httpd-php .php

210 .
What will be the output of the following PHP code?
 
    <?php
    $number = array(0,1,two,three,four,5);
    $num = preg_grep("/[0-5]/", $number);
    print_r($num);
    ?>
A)
Array([1]=> 1)
B)
Array([0]=>0 [1]=>1 [5]=>5)
C)
Array([2]=>two [3]=>three [4]=>four)
D)
Array([0]=>0 [1]=>1 [2]=>two [3]=>three [4]=>four [5]=>5)

Correct Answer :   Array([0]=>0 [1]=>1 [5]=>5)

211 .
Which one of the following preg PHP function is used to do a find and replace on a string or an array?
A)
preg_replace()
B)
preg_find()
C)
preg_findre()
D)
preg_find_replace()

Correct Answer :   preg_replace()

212 .
Which one of the following is not a preg PHP function?
A)
preg_match
B)
preg_split
C)
preg_match_all
D)
preg_matchall

Correct Answer :   preg_matchall

213 .
Which one of the following databases has PHP supported almost since the beginning?
A)
SQL
B)
SQL+
C)
MySQL
D)
Oracle Database

Correct Answer :   MySQL

214 .
The updated MySQL extension released with PHP 5 is typically referred to as _______
A)
MySQL
B)
mysql
C)
mysqli
D)
mysqly

Correct Answer :   mysqli

215 .
Which one of the following lines need to be uncommented or added in the php.ini file so as to enable mysqli extension?
A)
extension=mysql.dll
B)
extension=php_mysqli.dll
C)
extension=mysqli.dl
D)
extension=php_mysqli.dl

Correct Answer :   extension=php_mysqli.dll

216 .
Which one of the following statements instantiates the mysqli class?
A)
mysqli = new mysqli()
B)
$mysqli = new mysqli()
C)
mysqli->new.mysqli()
D)
$mysqli->new.mysqli()

Correct Answer :   $mysqli = new mysqli()

217 .
Which one of the following statements can be used to select the database?
A)
$mysqli=select_db('databasename');
B)
$mysqli->select_db('databasename');
C)
mysqli=select_db('databasename');
D)
mysqli->select_db('databasename');

Correct Answer :   $mysqli->select_db('databasename');

218 .
Which one of the following methods can be used to diagnose and display information about a MySQL connection error?
A)
connect_errno()
B)
connect_error()
C)
mysqli_connect_errno()
D)
mysqli_connect_error()

Correct Answer :   mysqli_connect_errno()

219 .
Code that uses a class, function, or method is often described as the ____
A)
client code
B)
user code
C)
object code
D)
class code

Correct Answer :   client code

220 .
Which function is used to determine whether the variable’s value is either TRUE or FALSE?
A)
bool()
B)
is_bool()
C)
is_boolean()
D)
boolean()

Correct Answer :   is_bool()

221 .
Once your application can generate administrative links, you need to load those links into ______
A)
php.ini
B)
index.ini
C)
index.php
D)
start.php

Correct Answer :   index.php

222 .
The URLs in the administrative links won’t mean anything to admin.php unless you modify ______
A)
.htaccess
B)
.urlaccess
C)
.htmlaccess
D)
.adminaccess

Correct Answer :   .htaccess

223 .
([\w-]+) will match _____
A)
one word characters
B)
one or more word characters
C)
one or more word characters and/or hyphens
D)
one or more word characters and hyphens

Correct Answer :   one or more word characters and/or hyphens

224 .
You need to check whether ______ is set, to determine whether you’re editing an entry or creating a new one.
A)
$_GET[‘url’]
B)
$_SET[‘url’]
C)
$_GET[‘admin’]
D)
$_SET[‘admin’]

Correct Answer :   $_GET[‘url’]

225 .
Your confirmation form submits your choice, via the _______ method, to ________
A)
GET index.php
B)
GET admin.php
C)
POST index.php
D)
POST admin.php

Correct Answer :   POST admin.php

226 .
In which of the following circumstance should you use a static reference to a non static method?
A)
Making a method call using parent
B)
Making a method call using child
C)
Making an object call using child
D)
Making an object call using child

Correct Answer :   Making a method call using parent

227 .
What does PDO stand for?
A)
PHP Data Orientation
B)
PHP Database Object
C)
PHP Database Orientation
D)
PHP Data Object

Correct Answer :   PHP Data Object

228 .
Which one of the following is a constant variable?
A)
const $name
B)
const NAME
C)
const $NAME
D)
constant NAME

Correct Answer :   const NAME

229 .
Which one of the following class can not be instantiated?
A)
inherited class
B)
every class
C)
constant class
D)
abstract class

Correct Answer :   abstract class

230 .
Which one of the following methods in the exception class, is used to get a nested exception object?
A)
getFile()
B)
getLine()
C)
getCode()
D)
getPrevious()

Correct Answer :   getPrevious()

231 .
PHP provides built-in interceptor methods, which can intercept messages sent to undefined methods and properties. This is also known as _________
A)
overloading
B)
overriding
C)
overbending
D)
overbinding

Correct Answer :   overloading

232 .
Which one of the following method is invoked when an undefined method is called by client code?
A)
__get()
B)
__isset()
C)
__unset()
D)
__call()

Correct Answer :   __call()

233 .
Which method introduced in PHP 5, is invoked just before an object is a garbage collected?
A)
__collect()
B)
__garbage()
C)
__destruct()
D)
__destructor()

Correct Answer :   __destruct()

234 .
Which one of the following PHP statements is true?
 
class CopyMe {}
$first = new CopyMe();
$second = $first;
A)
In PHP 4: $second and $first are 2 distinct objects
B)
In PHP 4: $second and $first refer to one object
C)
In PHP 5: $second and $first are 2 distinct objects
D)
None of the above

Correct Answer :   In PHP 4: $second and $first are 2 distinct objects

235 .
What will be the output of the following PHP code? (Before the version PHP 5.2)
 
class StringThing {}
$st = new StringThing();
print $st;
A)
Object id #1
B)
PHP Catchable fatal error
C)
Cannot initialize object
D)
Object Not Found

Correct Answer :   Object id #1

236 .
__clone() is run on the ___ object.
A)
original
B)
pseudo
C)
external
D)
copied

Correct Answer :   copied

237 .
Which one of the following is the correct way of declaring a namespace?
A)
namespace my;
B)
my namespace;
C)
namespace my();
D)
namespace(my);

Correct Answer :   namespace my;

238 .
Which one of the following statements is true for include_once() and require_once()?
A)
Both are exactly the same
B)
Both Handle the errors in the same way
C)
Both do not handle the errors in the same way
D)
include_once is used for files where as require_once() is not

Correct Answer :   Both do not handle the errors in the same way

239 .
Which one of the following functions will you use to check that the class exists before you work with it?
A)
exist()
B)
class_exist()
C)
class_exists()
D)
exists_class()

Correct Answer :   class_exists()

240 .
Which one of the following will you use to check the class of an object?
A)
class()
B)
_class()
C)
class_check()
D)
get_class()

Correct Answer :   get_class()

241 .
If you call a method and it doesn’t exist it’ll cause a problem. To check the method which function will you use?
A)
_method()
B)
methodexists()
C)
is_callable()
D)
is_method()

Correct Answer :   is_callable()

242 .
Which one of the following function should I use to find the parent class of a class?
A)
get_parent_class()
B)
parent_class()
C)
class_parent()
D)
get_class_parent()

Correct Answer :   get_parent_class()

243 .
Which class accepts a class name or an object reference and returns an array of interface name?
A)
class_implements()
B)
is_subclass()
C)
is_subclass_of()
D)
class_interface()

Correct Answer :   class_implements()

244 .
Object-oriented code tries to minimize dependencies by moving responsibility for handling tasks away from ___ and toward the objects in the system.
A)
server code
B)
client code
C)
machine code
D)
procedural code

Correct Answer :   client code

245 .
________ code makes change easier because the impact of altering an implementation will be localized to the component being altered.
A)
Coupling
B)
Cohesion
C)
Orthogonal
D)
Balancing

Correct Answer :   Orthogonal

246 .
Which one of the following is known as the key to object-oriented programming?
A)
Polymorphism
B)
Encapsulation
C)
Orthogonality
D)
Data Abstraction

Correct Answer :   Encapsulation

247 .
UML stands for?
A)
unified mailing language
B)
unified modeling logo
C)
undefined modeling language
D)
unified modeling language

Correct Answer :   unified modeling language

248 .
In a class diagram the class is divided into three sections, what is displayed in the first section?
A)
Class Attributes
B)
Class Name
C)
Class Declaration
D)
Class Functions

Correct Answer :   Class Name

249 .
______ are used in class diagrams to describe the way in which specific elements should be used.
A)
Attributes
B)
Constraints
C)
Constants
D)
Class Names

Correct Answer :   Constraints

250 .
+ is the visibility code for?
A)
Public
B)
Private
C)
Protected
D)
Friendly

Correct Answer :   Public

251 .
Which one of the following statements is true about sequence diagrams?
A)
A sequence diagram is class based
B)
A sequence diagram is object based
C)
The vertical broken lines represent the lifetime of the class in the system
D)
A sequence diagram presents the participants of a system from right to left

Correct Answer :   A sequence diagram is object based

252 .
A bidirectional relationship in class diagrams is described by________
A)
double-headed arrow
B)
visibility symbols
C)
double diamond
D)
single-headed arrow

Correct Answer :   double-headed arrow

253 .
Inheritance in class diagrams is depicted by________
A)
single-headed empty arrow
B)
single-headed filled arrow
C)
double-headed empty arrow
D)
double-headed filled arrow

Correct Answer :   single-headed empty arrow

254 .
What will be the output of the following PHP code?
 
<?php
  print_r "Hello world"
?>
A)
Hello World
B)
Error
C)
Nothing
D)
None of the above

Correct Answer :   Error

255 .
What will be the output of the following PHP code?
 
<?php
  Echo "Hello World1";
  echo " Hello world2";
  ECHO " Hello world3";
?>
A)
Hello world1 Hello world2 Hello World3
B)
Hello world1 
Hello world2 
Hello World3
C)
Hello world1 Hello world3
D)
Error

Correct Answer :   Hello world1 Hello world2 Hello World3

256 .
What will be the output of the following PHP code?
 
<?php
  $color = "red";
  echo "$color";
  echo "$COLOR";
  echo "$Color";
?>
A)
redredred
B)
redred
C)
red
D)
Error

Correct Answer :   red

257 .
What will be the output of the following PHP code?
 
<?php
  # echo "Hello world";
  echo "# Hello world"; 
?>
A)
# Hello world
B)
Hello world
C)
Hello world# Hello world
D)
Error

Correct Answer :   # Hello world

258 .
What will be the output of the following PHP code?
 
<?php
  echo "<i>Hello World</i>"
?>
A)
Hello world
B)
Hello world in italics
C)
Nothing
D)
None of the above

Correct Answer :   Hello world in italics

259 .
What will be the output of the following PHP code?
 
<?php
  $color = red;
  echo "\$color";
?>
A)
\red
B)
red
C)
$color
D)
Error

Correct Answer :   $color

260 .
What will be the output of the following PHP code?
 
<?php
  $color1 = red;
  $color2 = green;
  echo "$color1"."$color2";
?>
A)
red
B)
green
C)
red green
D)
Error

Correct Answer :   Error

261 .
What will be the output of the following PHP code?
 
<?php
  $color1 = "red";
  $color2 = "green";
  echo "$color1" + "$color2";
?>
A)
0
B)
redgreen
C)
red green
D)
Error

Correct Answer :   0

262 .
What will be the output of the following PHP code?
 
<?php
  $color1 = "1";
  $color2 = "1";
  echo "$color1" + "$color2";
?>
A)
0
B)
1
C)
2
D)
5

Correct Answer :   2

263 .
What will be the output of the following PHP code?
 
<?php
$x = 5;
 $y = 10;
 $z = "$x + $y";
 echo "$z";
?>
A)
$z
B)
$x + $y
C)
15
D)
10+5

Correct Answer :   10+5

264 .
What will be the output of the following PHP code?
 
<?php
  $x = 4;
  $y = 3;
  $z = 1;
  echo "$x = $x + $y + $z";
?>
A)
8
B)
4 = 4 + 3 + 1
C)
8 = 4 + 3 +1
D)
Error

Correct Answer :   4 = 4 + 3 + 1

265 .
What will be the output of the following PHP code?
 
<?php
 $x = 3.3;
 $y = 2;
 echo $x % $y;
?>
A)
0
B)
1
C)
2
D)
Error

Correct Answer :   1

266 .
What will be the output of the following PHP code?
 
<?php
 $x = 4;
 $y = -3;
 $z = 11;
 echo 4 + $y * $z / $x;
?>
A)
3.25
B)
-3.25
C)
4.25
D)
-4.25

Correct Answer :   -4.25

267 .
What will be the output of the following PHP code?
 
<?php
 $on$e = 1;
$tw$o = 2;
 $thre$e = 3;
 $fou$r = 4;
 echo "$on$e / $tw$o + $thre$e / $fou$r"; 
?>
A)
0.05
B)
0.75
C)
1.25
D)
Error

Correct Answer :   Error

268 .
What will be the output of the following PHP code?
 
<?php
 $hello = "Hello World";
 $bye = "Bye";
 echo $hello;"$bye";
?>
A)
Hello World
B)
Hello worldBye
C)
Bye
D)
Error

Correct Answer :   Hello World

269 .
What will be the output of the following PHP code?
 
<?php
 $a = "$winner";
 $b = "\$looser";
 echo $a, $b;
?>
A)
\
B)
$looser
C)
\$looser
D)
$winner\$looser

Correct Answer :   $looser

270 .
What will be the output of the following PHP code?
 
<?php
  $x = 5;
  $y = 10;
  function fun()
  {
      $GLOBALS['y'] = $GLOBALS['x'] + $GLOBALS['y'];
  } 
  fun();
  echo $y;
?>
A)
5
B)
10
C)
15
D)
Error

Correct Answer :   15

271 .
What will be the output of the following PHP code?
 
<?php
  function fun()
  {
      static $x = 0;
      echo $x;
      $x++;
  }
  fun();
  fun();
  fun();
?>
A)
012
B)
111
C)
123
D)
Error

Correct Answer :   012

272 .
What will be the output of the following PHP code?
 
<?php
  $x = 0;
  function fun()
  {
     echo $GLOBALS['x'];
     $x++;
  }
  fun();
  fun();
  fun();
?>
A)
000
B)
012
C)
Nothing
D)
Error

Correct Answer :   000

273 .
What will be the output of the following PHP code?
 
<?php
  $a = 10;
  echo ++$a;
  echo $a++;
  echo $a;
  echo ++$a;
?>
A)
11111213
B)
11121213
C)
11111212
D)
11111112

Correct Answer :   11111213

274 .
What will be the output of the following PHP code?
 
<?php
  $x = "test";
  $y = "this";
  $z = "also"; 
  $x .= $y .= $z ;
  echo $x;
  echo $y;
?>
A)
testthis
B)
testthisthisalso
C)
testthisalsothisalso
D)
Error at line 4

Correct Answer :   testthisalsothisalso

275 .
What will be the output of the following PHP code?
 
<?php
  $y = 2;
  $w = 4;
  $y *= $w /= $y;
  echo $y, $w;
?>
A)
80.5
B)
82
C)
42
D)
44

Correct Answer :   42

276 .
What will be the output of the following PHP code?
 
<?php
  $y = 2;
  if (**$y == 4)
  {
      echo $y;
  }
?>
A)
2
B)
4
C)
error at line2
D)
None of the above

Correct Answer :   error at line2

277 .
What will be the output of the following PHP code?

<?php
  $y = 2;
  if (--$y == 2 || $y xor --$y)
  {
      echo $y;
  }
?>​
A)
1
B)
0
C)
2
D)
no output

Correct Answer :   0

278 .
What will be the output of the following PHP code?
 
<?php
  $auth = 1;
  $status = 1;
  if ($result = (($auth == 1) && ($status != 0)))
  {
      print "result is $result<br />";
  }
?>
A)
error
B)
result is true
C)
result is false
D)
result is 1

Correct Answer :   result is 1

279 .
What will be the output of the following PHP code?
 
<?php
  $i = 0;
  while ($i = 10)
  {   
      print "hi";
  }
  print "hello";
?>
A)
hello
B)
infinite loop
C)
hihello
D)
error

Correct Answer :   infinite loop

280 .
What will be the output of the following PHP code?
 
<?php
  $i = 5;
  while (--$i > 0)
  {   
     $i++;
     print $i;
     print "hello";
  }
?>
A)
4hello4hello4hello4hello4hello…..infinite
B)
5hello5hello5hello5hello5hello…..infinite
C)
no output
D)
Error

Correct Answer :   4hello4hello4hello4hello4hello…..infinite

281 .
What will be the output of the following PHP code?
 
<?php
$i = 5;
while (--$i > 0 || ++$i)
{   
    print $i;
}
?>
A)
54321111111….infinitely
B)
555555555…infinitely
C)
54321
D)
5

Correct Answer :   54321111111….infinitely

282 .
What will be the output of the following PHP code?
 
<?php
$i = 0;
while(++$i || --$i)
{   
    print $i;
}
?>
A)
0
B)
1
C)
01234567891011121314…infinitely
D)
1234567891011121314….infinitely

Correct Answer :   1234567891011121314….infinitely

283 .
What will be the output of the following PHP code?
 
<?php
$i = 0;
while ((--$i > ++$i) - 1)
{   
    print $i;
}
?>
A)
-1-1-1-1-1-1-1-1-1-1…infinitely
B)
00000000000000000000….infinitely
C)
No output
D)
Error

Correct Answer :   00000000000000000000….infinitely

284 .
What will be the output of the following PHP code?
 
<?php
$i = 2;
while (++$i)
{   
    while (--$i > 0)
        print $i;
}
?>
A)
10
B)
210
C)
infinite loop
D)
no output

Correct Answer :   infinite loop

285 .
What will be the output of the following PHP code?
 
<?php
 echo 5 * 9 / 3 + 9;
?>
A)
0
B)
3.7
C)
3.85
D)
24

Correct Answer :   24

286 .
What will be the output of the following PHP code?
 
<?php
 $i = 0;
 $j = 0;
 if ($i && ($j = $i + 10)) {
    echo "true";
 }
 echo $j;
?>
A)
0
B)
10
C)
true0
D)
true10

Correct Answer :   0

287 .
What will be the output of the following PHP code?
 
<?php
$i = 1;
if ($i++ && ($i == 1))
    printf("Yes\n$i");
else
    printf("No\n$i");
?>
A)
Yes 1
B)
No 1
C)
Yes 2
D)
No 2

Correct Answer :   No 2

288 .
What will be the output of the following PHP code?
 
<?php
 $a = 1; $b = 1; $d = 1;
 print ++$a + ++$a+$a++; print $a++ + ++$b; print ++$d + $d++ + $a++;
?>
A)
368
B)
742
C)
869
D)
Error

Correct Answer :   869

289 .
What will be the output of the following PHP code?
 
<?php
  $a = 10; $b = 10;
  if ($a = 5)
     $b--;
  print $a;print $b--;
?>
A)
58
B)
59
C)
108
D)
109

Correct Answer :   59

290 .
What will be the output of the following PHP code?
 
<?php
  $var1 = 0;
  $var1 = $var1++ + 5; 
  echo $var1; 
?>
A)
5
B)
6
C)
7
D)
Error

Correct Answer :   5

291 .
What will be the output of the following PHP code?
 
<?php
 $var1 = 1;
 echo $var1 = ++$var1 % 2 + ++$var1; 
?>
A)
0
B)
1
C)
2
D)
3

Correct Answer :   3

292 .
What will be the output of the following PHP code?
 
<?php
  $a = 5;$b = -7;$c =0; 
  $d = ++$a && ++$b || ++$c;
  print $d;print $a;
?>
A)
16
B)
06
C)
15
D)
05

Correct Answer :   16

293 .
What will be the output of the following PHP code?
 
<?php
  $i = 0;$j = 1;$k = 2;
  print (( +  + $i + $j) >! ($j - $k));
?>
A)
0
B)
1
C)
no output
D)
error

Correct Answer :   1

294 .
What will be the output of the following PHP code?
 
<?php
  $a  =  '12345';
  print "qwe{$a}rty";
?>
A)
qwe12345rty
B)
qwe{$a}rty
C)
Error
D)
No output

Correct Answer :   qwe12345rty

295 .
What will be the output of the following PHP code?
 
<?php
  $x = 0;
  if ($x++)
      print "hi";
  else
     print "how are u";
?>
A)
hi
B)
how are u
C)
error
D)
None of the above

Correct Answer :   how are u

296 .
What will be the output of the following PHP code?
 
<?php
  $a = "2";
  switch ($a)
  {
  case 1:
     print "hi";
  case 2:
     print "hello";
     break;
  default:
      print "hi1";
  }
?>
A)
hello
B)
hihi1
C)
hi1
D)
hihellohi1

Correct Answer :   hello

297 .
What will be the output of the following PHP code?
 
<?php
do
{
    print "hi";
}
while(0);
print "hello";
?>
A)
hello
B)
hihello
C)
infinite loop
D)
error

Correct Answer :   hihello

298 .
What will be the output of the following PHP code?
 
<?php
for ($x = 0; $x <= 10; print ++$x)
{
    print ++$x;
}
?>
A)
12345678910
B)
1234567891011
C)
123456789101112
D)
infinite loop

Correct Answer :   123456789101112

299 .
What will be the output of the following PHP code?
 
<?php
    for ($i++; $i == 1; $i = 2)
    print "In for loop ";
    print "After loop\n";
?>
A)
In for loop
B)
In for loopAfter for loop
C)
After for loop
D)
Infinite loop

Correct Answer :   In for loopAfter for loop

300 .
What will be the output of the following PHP code?
 
<?php
    $op2 = "blabla";
    function foo($op1)
    {
        echo $op1;
        echo $op2;
    }
    foo("hello");
?>
A)
hello
B)
helloblabla
C)
helloblablablabla
D)
error

Correct Answer :   hello