What will be the output of the following PHP 7.1 code snippet.
string(5)
Answer
Correct Answer:
string(5)
Note: This Question is unanswered, help us to find answer for this one
Check Answer
55. Which of the following conditions must be followed by functions that are declared with void as their return type?
i) Omit their return statement.
ii) Use an empty return statement.
Neither option i) nor ii).
Answer
Correct Answer:
Either option i) or ii).
Note: This Question is unanswered, help us to find answer for this one
Check Answer
56. What will be the output of the following PHP code.
$x = array("x" => "Adam", "y" => "Binca");
$y = array("x" => "Avin", "y" => "Beth", "z" => "Chris");
$z = $y + $x;
$x += $y;
var_dump($x);
?>
array(3) {
[string(4) "Adam"
["y"]=>
string(5) "Binca"
["z"]=>
string(5) "Chris"
}
array(3) {
[string(4) "Adam"
["y"]=>
string(4) "Beth"
["z"]=>
string(5) "Chris"
}
array(3) {
[string(4) "Avin"
["y"]=>
string(5) "Binca"
["z"]=>
string(5) "Chris"
}
Answer
Correct Answer:
array(3) {
[string(4) "Adam"
["y"]=>
string(5) "Binca"
["z"]=>
string(5) "Chris"
}
array(3) {
[string(4) "Adam"
["y"]=>
string(4) "Beth"
["z"]=>
string(5) "Chris"
}
array(3) {
[string(4) "Avin"
["y"]=>
string(5) "Binca"
["z"]=>
string(5) "Chris"
}
Note: This question has more than 1 correct answers
Note: This Question is unanswered, help us to find answer for this one
Check Answer
57. What will be the output of the following PHP 7.1 code?
var_dump((bool) -1);
var_dump((bool) 1.5e5);
var_dump((bool) "false");
?>
bool(true)
bool(true)
bool(true)
bool(false)
bool(true)
bool(true)
bool(false)
bool(true)
bool(false)
bool(fa!se)
bool(false)
bool(false)
Answer
Correct Answer:
bool(true)
bool(true)
bool(true)
Note: This Question is unanswered, help us to find answer for this one
Check Answer
58. In PHP 7.1, which of the following is the correct syntax of the function, Closure::from Callable, which is used to convert a callable into a closure?
private void Closure Closure::fromCallable ( string new $callable )
public static Closure: :fromCallable ( string $callable)
public static Closure Closure::from Callable ()
public static Closure Closure::fromCallable ( callable $callable )
Answer
Correct Answer:
public static Closure Closure::fromCallable ( callable $callable )
Note: This Question is unanswered, help us to find answer for this one
Check Answer
59. What will be the output of the following PHP 7.1 code snippet?
<?php
function xrange($first, $last, $forward = 1)
{ if ($first < $last) {
if ($forward <= 0) {
throw new LogicException('The value of forward should be positive');
}
for ($i = $first; $i <= $last; $i += $forward){
yield $i;
}
} else {
if ($forward >= 0) {
throw new LogicException('The value of forward should be negative');
}
for ($i = $first; $i >= $last; $i += $forward){
yield $i;
}
}
}
echo "\n";
echo 'Output is: ';
foreach (xrange(1, 7, 2) as $num) {
echo "$num";
}
?>
Answer
Correct Answer:
Output is: 1 3 5 7
Note: This Question is unanswered, help us to find answer for this one
Check Answer
60. What will be the output of the following PHP 7.1 code?
$st = echo "At index -4, the character is $st[-4].", PHP_EOL;
$st[-3] = 'o';
echo "Replacement at index -3 to o gives $st.", PHP_EOL;
?>
At index -4, the character is r.
Replacement at index -3 to o gives stroke.
At index -4, the character is r.
Replacement at index -3 to i gives stroke.
At index -4, the character is r.
Replacement at index -3 to o gives o.
The code will throw an error.
Answer
Correct Answer:
At index -4, the character is r.
Replacement at index -3 to o gives stroke.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
61. Find the output of the following code snippet.
$bar = <<< 1;Anna;eats mangoes
2;Mark;eats apples
EOF;
function bar_parser($bar) {
foreach (explode("\n", $bar) as $I) {
$foo = explode(';', $I);
$id = array_shift($foo);
yield $id => $foo;
}
}
foreach (bar_parser($bar) as $id => $foo) {
echo "$id:\n";
echo" $foo[0]\n";
echo" $foo[1]\n";
}
?>
1; Anna; eats mangoes
2; Mark; eats apples
1:
Anna
eats mangoes
2:
Mark
eats apples
1: Anna;
eats mangoes
2: Mark;
eats apples
Answer
Correct Answer:
Compilation error.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
62. In the following PHP 7.1 program, which of the given code statements should replace ??? to obtain 12345 as output?
function recursive($var){
echo $var;
if($var < 5){
???
}
}
$a = 1;
recursive($a);
?>
return recursive($var + 1);
return recursive(+ + $var);
recursive($var++);
Return;
Answer
Correct Answer:
return recursive($var + 1);
Note: This Question is unanswered, help us to find answer for this one
Check Answer
63. What will be the output of the following PHP 7.1 code snippet?
var $example = var $array = array('My name is A.', 'My name is B.', 'My name is C.');
var $r = 'My name is r.';
}
$f = new f();
$example = 'example';
$b = array('f', 'example', 'b', 'c');
echo $f->$example. "\n";
echo $f->{$b[1]} . "\n";
$start = 'exa';
$end = 'mple';
echo $f->{$start. $end}. "\n";
$array = 'array';
echo $f->{$array[1]}. "\n";
?>
My name is A.
My name is B.
My name is C.
My name is example.
My name is example.
My name is exa.
My name is mple.
My name is array.
My name is example.
My name is example.
My name is example.
My name is r.
The code will throw an error.
Answer
Correct Answer:
My name is example.
My name is example.
My name is example.
My name is r.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
64. In PHP 7.1, which of the following options can be the key of an array?
Integer
Array
Object
String
Answer
Correct Answer:
Integer String
Note: This question has more than 1 correct answers
Note: This Question is unanswered, help us to find answer for this one
Check Answer
65. What will be the output of the following PHP 7.1 code?
class Example
{
public function abcFunction()
{
return Closure::fromCallable([$this, }
private function privateFunction($param)
{
var_dump($param);
}
}
$expFunc = (new Example)->abcFunction();
$expFunc('My New Example');?>
Answer
Correct Answer:
string(14)
Note: This Question is unanswered, help us to find answer for this one
Check Answer
66. In PHP 7.1, what will be the output of the following code?
$E_array = array(
"test" => "code",
64 =>46,
"multi" => array(
"dimensional" => array(
"array" => "test"
)
)
);
var_dump($E_array["test"]);
var_dump($E_array [64]);
var_dump($E_array["multi"]["dimensional"]["array"]);
?>
The code will throw an error.
Answer
Correct Answer:
string(4)
string(4)
string(4)
Note: This question has more than 1 correct answers
Note: This Question is unanswered, help us to find answer for this one
Check Answer
67. What will be the output of the following PHP 7.1 code?
for($a=0,$b=20; $a<50; $a++) {
while($b--) {
if($b==8) goto end;
}
}
echo "a = $a";
end:
echo ?>
Note: This Question is unanswered, help us to find answer for this one
Check Answer
68. What will be the output of the following PHP 7.1 code?
var_dump(0 == "x");
var_dump("2" == "02");
var_dump("20" == "2e2");
var_dump(200 == "2e4");
switch ("x") {
case 0:
echo "0";
break;
case "x":
echo "x";
break;
}
?>
bool(true)
bool(true)
bool(true)
bool(true)
x
bool(true)
bool(true)
bool(false)
bool(true)
0
bool(true)
bool(false)
bool(false)
bool(false)
x
bool(true)
bool(true)
bool(false)
bool(false)
0
Answer
Correct Answer:
bool(true)
bool(true)
bool(false)
bool(false)
0
Note: This Question is unanswered, help us to find answer for this one
Check Answer
69. What will be the output of the following PHP 7.1 code?
class First
{
private $foo = 2;
protected $bar = 4;
protected function A_funct()
{
return 5;
}
public function B_funct()
{
return new class($this->foo) extends First {
private $test;
public function _construct($foo)
{
$this->test = $foo;
}
public function C_funct()
{
return $this->bar + $this->test + $this->A_funct();
}
};
}
}
echo (new First)->B_funct()->C_funct();?>
Note: This Question is unanswered, help us to find answer for this one
Check Answer
70. In PHP 7.1, which of the following cast options can be used for explicitly converting a value to integer?
int
integer
Either option a or b can be used.
Neither option a nor b can be used.
Answer
Correct Answer:
Either option a or b can be used.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
71. Which of the given options is the correct output of the following PHP 7.1 program?
function swap(&$x, &$y): void
{
if ($x === $y) {
return;
}
$exp = $x;
$x = $y;
$y = $exp;
}
$var1 = 12;
$var2 = 20;
var_dump(swap($var1, $var2), $var1, $var2);?>
12,20
NULL int(12) int(20)
The code will throw an error.
Answer
Correct Answer:
NULL
int(20)
int(12)
Note: This Question is unanswered, help us to find answer for this one
Check Answer
72. Which of the given statements is correct about the following PHP 7.1 code?
$example = 25;
$b = &$example;
$b = &(12 * 9);
function t()
{
return 15;
}
$b = &t();
?>
The code will throw an error.
The code will compile successfully but will not print any output
The code will print the output: 15.
The code will print the output: 108.
Answer
Correct Answer:
The code will throw an error.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
73. Which of the following is an invalid constant in PHP 7.1?
Exp1
1exp
_exp1
exp_2
Note: This Question is unanswered, help us to find answer for this one
Check Answer
74. What will be the output of the following PHP 7.1 code snippet?
class Bar
{
public function checking()
{
return function() {
var_dump($this);
};
}
}
$object = new Bar;
$function = $object->checking();
$function();
?>
Answer
Correct Answer:
object(Bar)#1 (0) {
)
Note: This Question is unanswered, help us to find answer for this one
Check Answer
75. Which of the given statements is correct about the following PHP 7.1 code?
interface ExampleInterface
{
}
class ExampleClass implements Exampleinterface
{
}
$x = new ExampleClass;
$y = new ExampleClass;
$z = $p = 'NotExampleClass';
var_dump($x instanceof $y);
var_dump($x instanceof $z);
var_dump($x instanceof $p);
?>
The code will compile successfully and will print the following output:
bool(true)
bool(true)
bool(true)
The code will compile successfully and will print the following output:
bool(true)
bool(true)
bool(false)
The code will compile successfully and will print the following output:
bool(false)
bool(true)
bool(false)
The code will not compile and will throw an error.
Answer
Correct Answer:
The code will compile successfully and will print the following output:
bool(true)
bool(true)
bool(false)
Note: This Question is unanswered, help us to find answer for this one
Check Answer
76. In PHP 7.1, what will be the output of the following code?
$example = array(2, 4, 6, 8, 10);
foreach ($example as $x => $value){
unset($example[$x]);
}
print_r($example);
$example[] = 12;
print_r($example);
$example = array_values($example);
$example[] = 14;
print_r($example);
?>
Array (
)
Array
(
[0] =>12
)
Array
(
[1] => 14
)
Array
(
)
Array
( [5] => 12
)
Array
(
[0] => 12
[1] => 14
)
Array (
[0] => 2
[1] => 4
[2] => 6
[3] => 8
[4] => 10
)
Array
[5] =>12
)
Array
[5] => 14
The code will throw a syntax error.
Answer
Correct Answer:
Array
(
)
Array
( [5] => 12
)
Array
(
[0] => 12
[1] => 14
)
Note: This Question is unanswered, help us to find answer for this one
Check Answer
77. In PHP 7.1, the string session_create_id ([ string $prefix ]) function is used for creating a new session id. Which of the following characters are allowed by the parameter prefix?
, (Comma)
+ (Plus)F
- (Minus)
= (Equal)
Answer
Correct Answer:
, (Comma) - (Minus)
Note: This question has more than 1 correct answers
Note: This Question is unanswered, help us to find answer for this one
Check Answer
78. Find the output of the following PHP 7.1 code snippet.
namespace A\B\C;
const E_ERROR = 32;
function strlen($s)
{
return \strlen($s) - 5;
}
echo E_ERROR, "\n";
echo INI_ALL, "\n";
echo strlen( if (is_array('abc')) {
echo "is an example.\n";
} else {
echo "is a test.\n";
}
?>
32 7
1
is a test, is an example
Answer
Correct Answer:
32
7
-2
is a test.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
79. Find the output of the following PHP 7.1 code.
$a = $b = &$a;
$b = "I met $b";
echo $b;
echo $a;
?>
Answer
Correct Answer:
I met Lisal met Lisa
Note: This Question is unanswered, help us to find answer for this one
Check Answer
80. What will be the output of the following PHP 7.1 code?
for ($a = 2, $b = 1; $a <= 6; $b += $a, print $a, $a++);
?>
Note: This Question is unanswered, help us to find answer for this one
Check Answer
81. Which of the given options is the correct output of the following code?
$result = echo "<pre>$result</pre>";
?>
Note: This Question is unanswered, help us to find answer for this one
Check Answer
82. In relation to PHP 7.1 error handling, error reporting should be set to which of the following options in the development environment?
E.NOTICE
E_ALL
E.STRICT
E.DEPRECATED
Note: This Question is unanswered, help us to find answer for this one
Check Answer
83. Which of the given statements is correct about the following PHP 7.1 code snippet?
const C = 2;
class example {
const D = C * 2;
const E = C + self::D;
const F = }
echo example::D, PHP_EOL;
echo example::F;
?>
The code will throw a compilation error.
The code will compile successfully and will print the following output:
Four The result is Six
The code will compile successfully and will print the following output:
4
The result is 6
The code will compile successfully and will print the following output:
C * 2 The result is
Answer
Correct Answer:
The code will compile successfully and will print the following output:
4
The result is 6
Note: This Question is unanswered, help us to find answer for this one
Check Answer
84. Which of the following options is used for checking the installed version of PHP 7.1 ?
$ php -v
$ php -ver
$ php check version
$ php check --ver
Note: This Question is unanswered, help us to find answer for this one
Check Answer
85. Which of the given options is correct about the following PHP 7.1 code?
class example
{
function do_example()
{
echo "Testing example code.";
}
}
$b = new example;
$b->do_example();
?>
The code will throw a compilation error.
The code will throw a runtime error.
The code will compile successfully but will not print anything.
The code will compile successfully and will print: Testing example code.
Answer
Correct Answer:
The code will compile successfully and will print: Testing example code.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
86. What is the correct output of the following PHP 7.1 code snippet?
interface exp1
{
const c = }
echo exp1 ::c;
class exp2 implements exp1
{
const c = 'Second Example';
}
echo exp2::c;
?>
The code will throw a compilation error.
First Example
Second Example
First Example
First Example
Answer
Correct Answer:
First Example
Fatal error
Note: This Question is unanswered, help us to find answer for this one
Check Answer
87. Which of the given statements is correct about the following PHP 7.1 code snippet?
function example() {
foreach (range(5, 7) as $a){yield;
}
}
var_dump(iterator_to_array(example()));
?>
The code will throw a compilation error.
The code will compile successfully but will not print anything.
The code will compile successfully and will print the following:
array(3) {
[0]=>
NULL
[1]=>
NULL
[2]=>
NULL
}
The code will compile successfully and will print the following:array(3) {
[0]=>
Five
[1]=>
Six
[2]=>
Seven
}
Answer
Correct Answer:
The code will throw a compilation error.
The code will compile successfully and will print the following:
array(3) {
[0]=>
NULL
[1]=>
NULL
[2]=>
NULL
}
Note: This question has more than 1 correct answers
Note: This Question is unanswered, help us to find answer for this one
Check Answer
88. We have two variable definitions:
1. 023
2. x23
Choose the correct options:
1 is octal
2 is hexadecimal
2 is octal
1 is hexadecimal
Answer
Correct Answer:
1 is octal
Note: This Question is unanswered, help us to find answer for this one
Check Answer
89. You need to keep an eye on the existing number of objects of a given class without introducing a non-class member variable. Which of the following makes this happen?
Add a member variable that gets incremented in the default constructor and decremented in the destructor
Add a local variable that gets incremented in each constructor and decremented in the destructor
Add a static member variable that gets incremented in each constructor and decremented in the destructor
This cannot be accomplished since the creation of objects is being done dynamically via new.
Answer
Correct Answer:
Add a static member variable that gets incremented in each constructor and decremented in the destructor
Note: This Question is unanswered, help us to find answer for this one
Check Answer
90. What will be the output of the following code? <?php var_dump (3*4); ?>
int(3*4)
int(12)
3*4
12
None of the above
Note: This Question is unanswered, help us to find answer for this one
Check Answer
91. What will be the output of the following code?
function fn(&$var)
{
$var = $var - ($var/10 * 5);
return $var;
}
echo fn(100);
100
50
98
Error message
None of the above
Answer
Correct Answer:
Error message
Note: This Question is unanswered, help us to find answer for this one
Check Answer
92. You have defined three variables $to, $subject, and $body to send an email. Which of the following methods would you use for sending an email?
mail($to,$subject,$body)
sendmail($to,$subject,$body)
mail(to,subject,body)
sendmail(to,subject,body)
Answer
Correct Answer:
mail($to,$subject,$body)
Note: This Question is unanswered, help us to find answer for this one
Check Answer
93. Does PHP provide the goto keyword in latest version?
Yes
No
Note: This Question is unanswered, help us to find answer for this one
Check Answer
94. What do you infer from the following code?
<?php
$str = 'Dear Customer,\nThanks for your query. We will reply very soon.?\n Regards.\n Customer Service Agent';
print $str;
?>
Only first \n character will be recognised and new line will be inserted.
Last \n will not be recognised and only first two parts will come in new lines.
All the \n will work and text will be printed on respective new lines.
All will be printed on one line irrespective of the \n.
Answer
Correct Answer:
All will be printed on one line irrespective of the \n.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
95. Which of the following environment variables is used to fetch the IP address of the user in your PHP application?
$IP_ADDR
$REMOTE_ADDR_USER
$REMOTE_ADDR
$IP_ADDR_USER
Answer
Correct Answer:
$REMOTE_ADDR
Note: This Question is unanswered, help us to find answer for this one
Check Answer
96. Which of the following text manipulation functions is supported by PHP?
strtoupper()
ucfirst()
strtolower()
str_split()
All of the above
Answer
Correct Answer:
All of the above
Note: This Question is unanswered, help us to find answer for this one
Check Answer
97. You need to check the size of a file in PHP function.
$size=X(filename);
Which function will suitably replace 'X'?
filesize
size
sizeofFile
getSize
Note: This Question is unanswered, help us to find answer for this one
Check Answer
98. Which of the following types are supported by 'str_replace()' function?
Integer
String
Boolean
Array
Note: This Question is unanswered, help us to find answer for this one
Check Answer
99. What will be the output of the following code? $Rent = 250; function Expenses($Other) { $Rent = 250 + $Other; return $Rent; } Expenses(50); echo $Rent;
300
250
200
Program will not compile
Note: This Question is unanswered, help us to find answer for this one
Check Answer
100. Which of the following are the valid PHP data types?
resource
null
boolean
string
Both a and c
Both b, c and d
All of the above
Answer
Correct Answer:
All of the above
Note: This Question is unanswered, help us to find answer for this one
Check Answer
101. Which of the following is correct with regard to echo and print ?
echo is a construct and print is a function
echo is a function and print is a construct
Both are functions
Both are constructs
Answer
Correct Answer:
Both are constructs
Note: This Question is unanswered, help us to find answer for this one
Check Answer
102. Which of the following characters are taken care of by htmlspecialchars?
<
>
single quote
double quote
&
All of the above
Answer
Correct Answer:
All of the above
Note: This Question is unanswered, help us to find answer for this one
Check Answer
103. You have two strings, which you want to concatenate.
$str1 = 'Have a ';
$str2 = 'Nice Day';
The fastest way would be:
$str1.Concat($str2);
$str1.$str2;
"$str1$str2";
None of the above
Answer
Correct Answer:
$str1.$str2;
Note: This Question is unanswered, help us to find answer for this one
Check Answer
104. What will be the output of the following code? $a = 10; if($a > 5 OR < 15) echo "true"; else echo "false"
true
false
No output
Parse Error
Answer
Correct Answer:
Parse Error
Note: This Question is unanswered, help us to find answer for this one
Check Answer
105. Which of the following PHP syntax depictions is/are incorrect?
"This is a syntax test"
"This is another syntax test"
"This is yet another syntax test"
Answer
Correct Answer:
"This is another syntax test"
Note: This Question is unanswered, help us to find answer for this one
Check Answer
106. What will be the output of the following code?
$var = 10;
function fn()
{
$var = 20;
return $var;
}
fn();
echo $var;
10
20
Undefined Variable
Syntax Error
Note: This Question is unanswered, help us to find answer for this one
Check Answer
107. Which of the following is an iterator class included in Standard PHP Library (SPL) in PHP5?
OuterIterator
InfiniteIterator
Countable
SeekableIterator
Answer
Correct Answer:
InfiniteIterator
Note: This Question is unanswered, help us to find answer for this one
Check Answer
108. Which of the following is not a file related function in PHP?
fclose
fopen
fwrite
fgets
fap
Note: This Question is unanswered, help us to find answer for this one
Check Answer
109. Which of the following variable declarations within a class is invalid in PHP5?
private $type = 'moderate';
internal $term =3;
public $amnt = '500';
protected $name = 'Quantas Private Limit
Answer
Correct Answer:
internal $term =3;
Note: This Question is unanswered, help us to find answer for this one
Check Answer
110. Which of the following printing constructs/functions accept(s) multiple parameters?
echo
print
printf
All of the above
Note: This Question is unanswered, help us to find answer for this one
Check Answer
111. Which of the following statements is not true with regard to abstract classes in php5?
Abstract classes are introduced in PHP5
A class with a single abstract method must be declared abstract
Abstract class can contain non abstract methods
Abstract method must have method definition and can have optional empty braces following it
Answer
Correct Answer:
Abstract method must have method definition and can have optional empty braces following it
Note: This Question is unanswered, help us to find answer for this one
Check Answer
112. What will be the result of the following expression: 6+4 * 9-3
60
87
39
30
Note: This Question is unanswered, help us to find answer for this one
Check Answer
113. The value of a local variable of a function has to be retained over multiple calls to that function. How should that variable be declared?
local
global
static
None of the above
Note: This Question is unanswered, help us to find answer for this one
Check Answer
114. Consider the following class:
1 class Insurance
2 {
3 function clsName()
4 {
5 echo get_class($this);
6 }
7 }
8 $cl = new Insurance();
9 $cl->clsName();
10 Insurance::clsName();
Which of the following code line(s) should be commented to print the class name without errors?
Line 8 and 9
Line 10
Line 9 and 10
All the three lines 8,9, and 10 should be left as it
Note: This Question is unanswered, help us to find answer for this one
Check Answer
115. Which of the following pair of operators have equal precedence and are non-associative?
+, -
==, !=
, ; ;
=, |=
Note: This Question is unanswered, help us to find answer for this one
Check Answer
116. How would you store order number (34) in an 'OrderCookie'?
setcookie("OrderCookie",34);
makeCookie("OrderCookie",34);
Cookie("OrderCookie",34);
OrderCookie(34);
Answer
Correct Answer:
setcookie("OrderCookie",34);
Note: This Question is unanswered, help us to find answer for this one
Check Answer
117. Which of the following crypto in PHP returns longest hash value?
md5()
sha1()
crc32()
All return same length hash
Note: This Question is unanswered, help us to find answer for this one
Check Answer
118. If visibility is not defined for a method/member then it is treated as public static.
True
False
Note: This Question is unanswered, help us to find answer for this one
Check Answer
119. Which of the following is a correct declaration?
static $varb = array(1,'val',3);
static $varb = 1+(2*90);
static $varb = sqrt(81);
static $varb = new Object;
Answer
Correct Answer:
static $varb = array(1,'val',3);
Note: This Question is unanswered, help us to find answer for this one
Check Answer
120. You wrote following script to check for the right category: 1 <?php 2 $cate=5; 3 ... 4 ... 5 6 if ($cate==5) 7 { 8 ?> 9 Correct category! 10 <?php 11 } else { 12 ?> 13 Incorrect category! 14 <?php 15 } 16 ?> What will be the output of the program if value of 'cate' remains 5?
Correct category!
Incorrect category!
Error due to use of invalid operator in line 6:"if ($cate==5)"
Error due to incorrect syntax at line 8, 10, 12 and 14
Answer
Correct Answer:
Correct category!
Note: This Question is unanswered, help us to find answer for this one
Check Answer
121. What will be the output of following code? $a = 10; echo "Value of a = $a";
Value of a = 10
Value of a = $a
Undefined
Syntax E
Answer
Correct Answer:
Value of a = 10
Note: This Question is unanswered, help us to find answer for this one
Check Answer
122. Which of the following attribute is needed for file upload via form?
enctype="multipart/form-data"
enctype="singlepart/data"
enctype="file"
enctype="form-data/file"
Answer
Correct Answer:
enctype="multipart/form-data"
Note: This Question is unanswered, help us to find answer for this one
Check Answer
123. Which of the following variables is not related to file uploads?
max_file_size
max_execution_time
post_max_size
max_input_time
Answer
Correct Answer:
max_input_time
Note: This Question is unanswered, help us to find answer for this one
Check Answer
124. What is the output of the following PHP code snippet?
<?php
$var = "testing module";
$statement = 'This is a $var';
echo ($statement);
?>
This is a testing module
This is a $var
The code will not work, and will give syntax error
Answer
Correct Answer:
This is a $var
Note: This Question is unanswered, help us to find answer for this one
Check Answer
125. Which of the following statements regarding PHP forms, are correct?
In PHP, the predefined $_POST variable is used to collect values in a form with method="post"
In PHP, the predefined $_GET variable is used to collect values in a form with method="get"
In PHP, the predefined $_REQUEST variable contains the contents of both $_GET, $_POST, and $_COOKIE
Information sent from a form with the POST method is invisible to others and has an 8MB limit on the amount of information to send, which cannot be changed
Answer
Correct Answer:
In PHP, the predefined $_POST variable is used to collect values in a form with method="post"
Note: This Question is unanswered, help us to find answer for this one
Check Answer
126. Consider the following two statements: I while (expr) statement II while (expr): statement ... endwhile; Which of the following are true in context of the given statements?
I is correct and II is wrong
I is wrong and II is correct
Both I II are wrong
Both I II are correct
Answer
Correct Answer:
Both I II are correct
Note: This Question is unanswered, help us to find answer for this one
Check Answer
127. You have a 2D array in PHP: $array = array(array(141,151,161), 2, 3, array(101, 202, 303)); You want to display all the values in the array. The correct way is:
function DisplayArray($array) {foreach ($array as $value) {if (array_valid($value)) {
}
function DisplayArray($array) {for ($array as $value) {if (valid_array($value)) {
}
function DisplayArray($array) {for ($array as $value) {if (is_array($value)) {
}
function DisplayArray($array) {foreach ($array as $value) {if (is_array($value)) {
}
Answer
Correct Answer:
function DisplayArray($array) {foreach ($array as $value) {if (is_array($value)) {
}
Note: This Question is unanswered, help us to find answer for this one
Check Answer
128. If expire parameter of setCookie function is not specified then:
Cookie will never expire.
Cookie will expire with closure of the browser
Cookie will expire with within 30 minutes
Cookie will expire in 24 hours
Answer
Correct Answer:
Cookie will expire with closure of the browser
Note: This Question is unanswered, help us to find answer for this one
Check Answer
129. Which of the following features are supported in PHP 5?
Multiple Inheritance
Embedded Database with SQLite
Exceptions and Iterators
Interoperable XML Tools
Answer
Correct Answer:
Embedded Database with SQLite
Note: This Question is unanswered, help us to find answer for this one
Check Answer
130. What will be the result of following operation? print 4<< 5;
3
128
120
6
Note: This Question is unanswered, help us to find answer for this one
Check Answer
131. Which of the following is true regarding $a + $b, where both of them are arrays?
Duplicated keys are NOT overwritten.
$b is appended to $a.
Intersect keys from both arrays are returned.
This produces a syntax error.
Answer
Correct Answer:
Duplicated keys are NOT overwritten.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
132. What is the output of the following PHP code snippet?
<?php
$val = 10;
$val2 = 20;
function helloworld($a)
{
$val2 = $a * 30;
}
helloworld($val);
echo $val2;
?>
20
300
10
600
Note: This Question is unanswered, help us to find answer for this one
Check Answer
133. The inbuilt function to get the number of parameters passed is:
arg_num()
func_args_count()
func_num_args()
None of the above
Answer
Correct Answer:
func_num_args()
Note: This Question is unanswered, help us to find answer for this one
Check Answer
134. Which of the following is a Ternary Operator?
&
=
:?
?:
+=
&&
Note: This Question is unanswered, help us to find answer for this one
Check Answer
135. What is the function file_get_contents() useful for?
Share file online
display file content
link two files
Split a file after reading
it lets you read a file and store it in a single variable.
Answer
Correct Answer:
it lets you read a file and store it in a single variable.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
136. After the code is executed, what will be the value of $text and what will strlen($text) return? $text ='John'; $text[10]='Doe';
"John D" and strlen($text) return 11
"johnD and strlen($text10)
"Error"
"John " and strlen($text) return 6
Answer
Correct Answer:
"John D" and strlen($text) return 11
Note: This Question is unanswered, help us to find answer for this one
Check Answer
137. What's the result of the following code? echo count('');
1
true
false
0
Note: This Question is unanswered, help us to find answer for this one
Check Answer
138. Considerer this code : $var = 1; function &blah() { global $var; $var++; return $var; } $num = &blah(); $num = &blah(); blah(); What is the value of $num ?
4
3
Will return an error.
2
Note: This Question is unanswered, help us to find answer for this one
Check Answer
139. How to use try/catch block in php ?
try { } catch(Exception $e) { }
try { } catch(Exception $e) { ]
try [ } catch(Exception $e) { }
try { } catch { }
Answer
Correct Answer:
try { } catch(Exception $e) { }
Note: This Question is unanswered, help us to find answer for this one
Check Answer
140. $a = fread($x); fclose($x); What is the correct syntax to initialize a handle to read from standard input?
$x = fstream('php://stdin','r');
$x = fread('php://stdin','r');
$x = fgets('php://stdin','r');
$x = fopen('php://stdin','r');
Answer
Correct Answer:
$x = fopen('php://stdin','r');
Note: This Question is unanswered, help us to find answer for this one
Check Answer
141. What is the out-put of the following code?
array(1) { [0]=> int(5), [1]=> int(6) }
array(1) { [1]=> int(6) }
array(1) { [0]=> int(6) }
array(1) { [1]=> int(5) }
Answer
Correct Answer:
array(1) { [1]=> int(6) }
Note: This Question is unanswered, help us to find answer for this one
Check Answer
142. Is it possible to extend the execution time of a php script?
No
The use of the set_time_limit(int seconds) enables us to extend the execution time of a php script. The default limit is 30 seconds.
Yes
Answer
Correct Answer:
The use of the set_time_limit(int seconds) enables us to extend the execution time of a php script. The default limit is 30 seconds.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
143. Which array syntax is incorrect?
array(1, 2, 3)
[1, 2, 3]
array(1 => 1, 2 => 2, 3 => 3)
array(1 = 1, 2 = 2, 3 = 3)
Answer
Correct Answer:
array(1 = 1, 2 = 2, 3 = 3)
Note: This Question is unanswered, help us to find answer for this one
Check Answer
144. How do you access the GET request parameter 'foo'?
get('foo')
FOO
$foo
$get['foo']
$_GET['foo']
Answer
Correct Answer:
$_GET['foo']
Note: This Question is unanswered, help us to find answer for this one
Check Answer
145. For PHP version <= 5.3, how can we activate error reporting for all levels??
error_reporting(E_ALL);
error_reporting(-1);
error_reporting(E_ERROR);
error_reporting(0);
Answer
Correct Answer:
error_reporting(-1);
Note: This Question is unanswered, help us to find answer for this one
Check Answer
146. How do you retrieve the user's IP address
$user_ip
$_SERVER['USER_IP']
$_GET['USER_IP']
user_ip()
$_SERVER['REMOTE_ADDR']
Answer
Correct Answer:
$_SERVER['REMOTE_ADDR']
Note: This Question is unanswered, help us to find answer for this one
Check Answer
147. What is the truth about the "implode" method?
Can accept only two parameters.
The "glue" String can be of any size.
All answers.
Can accept the parameters in either direction.
Answer
Correct Answer:
All answers.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
148. Consider the following code:$string = 'Question test.'; $find = 'Q'; $pos = strpos($string, $find);if ($pos == false) echo 'No correspondence.'; else echo 'The caracter is find.';
The caracter is find.
No correspondence.
Answer
Correct Answer:
No correspondence.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
149. What will be the output of the following code? $j=30; $k=0; $k=$j++/$i++; echo $i . ” ” . $j . ” ” . $k . ” “;
7 30 5
5 31 7.5
31 5 8
30 7 5.5
Note: This Question is unanswered, help us to find answer for this one
Check Answer
150. What will $x be equal to after the statement $x = 3 + "15%" + "$25"?
9
18
0
3
Note: This Question is unanswered, help us to find answer for this one
Check Answer
151. Join() and Implode() are the same ?
No.
Yes.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
152. The default value of register_globals in PHP is:
On
Off
Note: This Question is unanswered, help us to find answer for this one
Check Answer
153. What is the inherit key?
implements
inherit
extends
extend
Note: This Question is unanswered, help us to find answer for this one
Check Answer
154. Which function discard the contents of the output buffer?
ob_flush_end()
ob_flush()
ob_start()
ob_clean()
Answer
Correct Answer:
ob_clean()
Note: This Question is unanswered, help us to find answer for this one
Check Answer
155. if(a==b) { echo '1'; } else { echo '2'; } can be replaced with?
if a==b echo '1'; else echo '2';
(a==b) ? '1' : '2';
Answer
Correct Answer:
(a==b) ? '1' : '2';
Note: This Question is unanswered, help us to find answer for this one
Check Answer
156. What is the output of the following code?
3
2
Error
1.5
1
Note: This Question is unanswered, help us to find answer for this one
Check Answer
157. What will be the values of $a and $b after the code below is executed? Explain your answer. $a = '1'; $b = &$a; $b = '2$b';
3
21
1
2
Note: This Question is unanswered, help us to find answer for this one
Check Answer
158. How to add the elements 'banana' and 'apple' to the following array? $stack = array('orange', 'lemon');
array_pop($stack,
array_push($stack,
array_merge($stack,
array_shift($stack,
Answer
Correct Answer:
array_push($stack,
Note: This Question is unanswered, help us to find answer for this one
Check Answer
159. You want to add a new line of text to existing file, what do you use? $data = 'some text'
file_put_contents('some_file.txt',$data,FILE_ADD);
file_put_contents('some_file.txt',$data,ADD);
file_put_contents('some_file.txt',$data,APPEND_FILE);
file_put_contents('some_file.txt',$data,FILE_APPEND);
file_put_contents('some_file.txt',$data,APPEND);
Answer
Correct Answer:
file_put_contents('some_file.txt',$data,FILE_APPEND);
Note: This Question is unanswered, help us to find answer for this one
Check Answer
160. Which function is used for counting element from an array.
count_array
Sizeof
array_count
Note: This Question is unanswered, help us to find answer for this one
Check Answer
161. PHP 5 Format => local time/date as integer
dtime();
itime();
intime();
Note: This Question is unanswered, help us to find answer for this one
Check Answer
162. mysql_connect( ) does not take following parameter
database host
database name
password
user ID
Answer
Correct Answer:
database name
Note: This Question is unanswered, help us to find answer for this one
Check Answer
163. Using strpos what is the position of "t" in $var $var = "take that";
7
8
6
1
5
Note: This Question is unanswered, help us to find answer for this one
Check Answer
164. Output of the following code: if (strpos('jo.blogs@nowhere.com','jo')) { echo 'true'; } else { echo 'false'; }
true
false
The code produces no output
Note: This Question is unanswered, help us to find answer for this one
Check Answer
165. Which function is used for checks specified key exists in the array
array_key_exist()
array_key_exists()
array_keys_exists()
arrays_key_exists()
Answer
Correct Answer:
array_key_exists()
Note: This Question is unanswered, help us to find answer for this one
Check Answer
166. What is the output of the following code: $var = true and false; echo $var ? "true" : "false";
false
true
The code produces no output, but yields a syntax error when run
Note: This Question is unanswered, help us to find answer for this one
Check Answer
167. What elements will the script output? <?php $array = array (true => 'a', 1 => 'b'); var_dump ($array); ?>
1=>'b'
NULL
0 => 'a', 1 => 'b'
True => 'a', 1 => 'b'
Note: This Question is unanswered, help us to find answer for this one
Check Answer
168. How to define an option in PHP5?
defineopt
is-option
None of these
def_opt
option_def
Answer
Correct Answer:
None of these
Note: This Question is unanswered, help us to find answer for this one
Check Answer
169. PHP5 is a new version of the protocol hard priority 4.
True
PHP5 is the new version of protocol hard priority 3
False
Note: This Question is unanswered, help us to find answer for this one
Check Answer
170. What we have in php5.2
array("a", "a", "c");
array("b", "a", "c");
Error
array("a", "b", "c");
Note: This Question is unanswered, help us to find answer for this one
Check Answer
171. $b = false; $a = unset($b); var_dump($a);
Une erreur PHP.
bool(true)
Answer
Correct Answer:
Une erreur PHP.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
172. What will the following script output?
78
05
NULL
19
Note: This Question is unanswered, help us to find answer for this one
Check Answer
173. Which lines needed to be commented to print class name ? Class GOT { function tirian() { echo get_class($this); } } 8. $sparta = new GOT(); 9. $sparta -> tirian(); 10.GOT::tirian();
Line 9 and 10
Line 8 and 9
Line 9
All the three lines 8,9, and 10 should be left as it is
Line 10
Answer
Correct Answer:
All the three lines 8,9, and 10 should be left as it is
Note: This Question is unanswered, help us to find answer for this one
Check Answer
174. What is different in explode() and str_split function?
explode() and str_split has no different
explode() can use in binnary
str_split() expldoe string without delimiter
Answer
Correct Answer:
str_split() expldoe string without delimiter
Note: This Question is unanswered, help us to find answer for this one
Check Answer
175. Why for($i=0; $i<count($array); $i++) is a bad style?
No matters
Because count() will call every tick
Answer
Correct Answer:
Because count() will call every tick
Note: This Question is unanswered, help us to find answer for this one
Check Answer
176. Which of the following operations cannot be performed using the standard ftp:// stream wrapper ?
Reading and writing a file
Creating a new directory
Reading a file
Establishing a stateful connection and changing directories interactively
Writing a file
Answer
Correct Answer:
Establishing a stateful connection and changing directories interactively
Note: This Question is unanswered, help us to find answer for this one
Check Answer
177. what is php tag?
Time's Up!
??
...?>
Note: This Question is unanswered, help us to find answer for this one
Check Answer
178. strpbrk() function for...
Search a string for any of a set of characters
Converting a string to an array
Binary safe optionally case insensitive comparison of two strings from an offset, up to length characters
Answer
Correct Answer:
Search a string for any of a set of characters
Note: This Question is unanswered, help us to find answer for this one
Check Answer
179. What php function get the Unix timestamp for a date ?
datetime()
mktime()
date()
time()
Note: This Question is unanswered, help us to find answer for this one
Check Answer
180. What is the result if $req is 2 : $result = (isset($req)) ? $req : 3;
3
2
none
Note: This Question is unanswered, help us to find answer for this one
Check Answer
181. What's the api to draw image in PHP5
GD
SZ
TG
YE
GS
Note: This Question is unanswered, help us to find answer for this one
Check Answer
182. What is the right way to convert a string to upper case
upper_str()
strtoupper()
str_upper()
Answer
Correct Answer:
strtoupper()
Note: This Question is unanswered, help us to find answer for this one
Check Answer
183. $_SERVER['SERVER_NAME'] => returns..
Current URL
Server URL
Answer
Correct Answer:
Server URL
Note: This Question is unanswered, help us to find answer for this one
Check Answer
184. How can we open a new connection to a external server
cURLS
cURL
Note: This Question is unanswered, help us to find answer for this one
Check Answer
185. When should one use require() vs include() ?
The require() function is identical to include(), except that it handles errors differently. If an error occurs, the include() function generates a warning, but the script will continue execution. The require() generates a fatal error, and the script will
The require() function is identical to include(), does'nt matter
Answer
Correct Answer:
The require() function is identical to include(), except that it handles errors differently. If an error occurs, the include() function generates a warning, but the script will continue execution. The require() generates a fatal error, and the script will
Note: This Question is unanswered, help us to find answer for this one
Check Answer
186. What is difference between echo or print()
print() and echo are used to display values. you can use either of them
Expression. print() behaves like a function in that you can do: $ret = print "Hello World"; And $ret will be 1. That means that print can be used as part of a more complex expression where echo cannot.
Answer
Correct Answer:
Expression. print() behaves like a function in that you can do: $ret = print "Hello World"; And $ret will be 1. That means that print can be used as part of a more complex expression where echo cannot.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
187. Consider the following statement: $str = "endri"; In what way you can print the character "e" by indexing it as an array ?
str(0)
$str{0}
$str(0)
$str[0]
Note: This Question is unanswered, help us to find answer for this one
Check Answer
188. Consider the following code: $a=8; $b=2; echo $a / $b; Which of the following code gives the same result as the code above by using bitwise operators:
$a=8; $b=2; echo $a >> $b;
$a=8; $b=2; echo $a | $b;
$a=8; $b=2; echo $a & $b;
$a=8; $b=2; echo $a ^ $b;
$a=8; $b=2; echo $a << $b;
Answer
Correct Answer:
$a=8; $b=2; echo $a >> $b;
Note: This Question is unanswered, help us to find answer for this one
Check Answer
189. In which version the "finally" keyword was added?
5.2
5.3
5.5
5.4
Note: This Question is unanswered, help us to find answer for this one
Check Answer
190. Will the function glob($pattern, $flag) work correctly on remote files?
Yes
Yes, if the GLOB_NOCHECK flag is explicitly specified in the second parameter
No
Note: This Question is unanswered, help us to find answer for this one
Check Answer
191. How to define a trait?
class trait
trait class
trait
Note: This Question is unanswered, help us to find answer for this one
Check Answer
192. Is PHP 4 Object oriented?
False
True
Note: This Question is unanswered, help us to find answer for this one
Check Answer
193. When the password_hash() function appear in PHP ?
5.4
5
6
5.5
Note: This Question is unanswered, help us to find answer for this one
Check Answer
194. How to define an abstract class?
abstract class
class abstract
abstract
Answer
Correct Answer:
abstract class
Note: This Question is unanswered, help us to find answer for this one
Check Answer
195. How to define an interface?
interface class
class interface
interface
Answer
Correct Answer:
interface
Note: This Question is unanswered, help us to find answer for this one
Check Answer
196. What happen when you use mysql_connect in php 5.5 ?
you got a NOTICE error
you got a FATAL error
you got an E_DEPRECATED error
Answer
Correct Answer:
you got an E_DEPRECATED error
Note: This Question is unanswered, help us to find answer for this one
Check Answer
197. What does password_verify function ?
Verifies that the given password is good for the user selected
Verifies that the given hash matches the given password.
Answer
Correct Answer:
Verifies that the given hash matches the given password.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
198. Consider the following code: $a=$b=7; You want to test whether variables $a and $b are equal and of the same type, which of the following is correct ?
$a <> $b
$a = $b
$a == $b
$a === $b
Answer
Correct Answer:
$a === $b
Note: This Question is unanswered, help us to find answer for this one
Check Answer
199. What is the keyword to define a class ?
$class
class
Note: This Question is unanswered, help us to find answer for this one
Check Answer
200. Can we use mysqli commands to connect to the database ?
False
True
Note: This Question is unanswered, help us to find answer for this one
Check Answer
201. When an object is serialized, which method will be called, automatically, providing your object with an opportunity to close any resources or otherwise prepare to be serialized?
__shutdown()
__destruct()
__serialize()
__sleep()
Answer
Correct Answer:
__sleep()
Note: This Question is unanswered, help us to find answer for this one
Check Answer
202. What should you do to prevent error while unserializing serialized object of non-existent class?
Use try{} catch() blocks
Nothing
Set unserialize_callback_func in php.ini file
Provide empty classes for the objects
Note: This Question is unanswered, help us to find answer for this one
Check Answer
203. How do I extend an interface?
interface A { /* ... */ } interface B implements A { /* ... */ }
interface A { /* ... */ } interface B extends A { /* ... */ }
You cannot extend an interface.
Answer
Correct Answer:
interface A { /* ... */ } interface B extends A { /* ... */ }
Note: This Question is unanswered, help us to find answer for this one
Check Answer
204. When passing an undefined variable to a function by reference, e.g. function test(&$var) { /* ... */ } unset($x); test($x); What is the error message?
PHP Fatal error: Undefined variable: x
No error message, the variable will be created.
PHP Notice: Undefined variable: x
No error message, the script will be aborted.
Answer
Correct Answer:
No error message, the variable will be created.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
205. class B { public $b; } function process_a($a) { $a['b'] = 42; } function process_b($b) { $b->b = 42; } $v1 = array('b' => 2); process_a($v1); $v2 = new B(); $v2->b = 2; process_b($v2); What are the values of $v1['b'] and $v2->b?
42, 42
42, 2
2, 2
2, 42
Note: This Question is unanswered, help us to find answer for this one
Check Answer
206. Which of following functions compute the intersection of arrays with additional index check and are defined newly in PHP5?
array_wintersect_assoc(); array_wintersect_uassoc();
array_intersect_new_assoc(); array_intersect_new_uassoc();
array_intersect_assoc(); array_intersect_uassoc();
array_nintersect_assoc(); array_nintersect_uassoc();
array_uintersect_assoc(); array_uintersect_uassoc();
Answer
Correct Answer:
array_uintersect_assoc(); array_uintersect_uassoc();
Note: This Question is unanswered, help us to find answer for this one
Check Answer
207. What does php_strip_whitespace function return?
Returns the PHP source code in filename with PHP comments and whitespace removed.
Returns the string with whitespace removed
Returns the string with comments and whitespace removed.
Returns the PHP source code in filename with whitespace removed.
None of these
Answer
Correct Answer:
Returns the PHP source code in filename with PHP comments and whitespace removed.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
208. In what version of PHP were namespaces added?
5.2
5.1
5.0
5.3
5.4
Note: This Question is unanswered, help us to find answer for this one
Check Answer
209. What will isset() return in the following code? $search_array = array('first' => null, 'second' => 4); isset($search_array['first']);
FALSE
TRUE
Note: This Question is unanswered, help us to find answer for this one
Check Answer
210. Object iteration. class A { public $v1 = 'a'; protected $v2 = 'b'; private $v3 = 'c'; var $v4 = 'd'; } $a = new A(); foreach ($a as $k => $v) { echo "$k => $v\n"; } What is the output of the foreach loop?
v1 => a v2 => b v3 => c
v1 => a v4 => d
v1 => a
v1 => a v2 => b
You cannot iterate over an object's attributes.
Answer
Correct Answer:
v1 => a v4 => d
Note: This Question is unanswered, help us to find answer for this one
Check Answer
211. The number of parameters in setCookie function
2
7
3
4
5
Note: This Question is unanswered, help us to find answer for this one
Check Answer
212. $a = array("pomme", "banane"); $b = array(1 => "banane", "0" => "pomme"); var_dump($a === $b); What does-it print ?
FALSE
TRUE
Note: This Question is unanswered, help us to find answer for this one
Check Answer
213. How to read a class static property?
$this::name
$this->$name
self::$name
$this->name
self::name
Answer
Correct Answer:
self::$name
Note: This Question is unanswered, help us to find answer for this one
Check Answer
214. Which function would you use to prepend one or more elements to the beginning of an array?
array_unshift()
array_pop()
array_push()
array_shift()
Answer
Correct Answer:
array_unshift()
Note: This Question is unanswered, help us to find answer for this one
Check Answer
215. How should you filter variables before passing to header()?
urlencode()
PHP's doing this itself nowadays
strtr($var, "\r\n", ' ')
htmlspecialchars()
Answer
Correct Answer:
PHP's doing this itself nowadays
Note: This Question is unanswered, help us to find answer for this one
Check Answer
216. Which variable type can NOT be used as a type hint?
resource
any class name
array
callable
Note: This Question is unanswered, help us to find answer for this one
Check Answer
217. What will be the array $b after executing this code? $a = array(1, 3, 5); $b = array(2, 4, 6); $b += $a;
$b = array(2, 4, 6, 1, 3, 5)
$b = array(2, 4, 6)
$b = array(3, 7, 11)
PHP Fatal Error
$b = array(1, 2, 3, 4, 5, 6)
Answer
Correct Answer:
$b = array(2, 4, 6)
Note: This Question is unanswered, help us to find answer for this one
Check Answer
218. Which of the following functions is a relative ftp function new to PHP5?
ftp_mkdir()
ftp_alloc()
ftp_chmod()
ftp_read_write_alloc()
ftp_chdir()
Answer
Correct Answer:
ftp_alloc()
Note: This Question is unanswered, help us to find answer for this one
Check Answer
219. What is the output of this code snippet? $i = 5; print $i++ + ++$i;
13
11
12
10
Note: This Question is unanswered, help us to find answer for this one
Check Answer
220. What will be output of this code. function test(&$var) { $var=$var-1; return $var; } $returnVar = test(50); echo $returnVar. " is answer.";
Error message
51 is answer.
49 is answer.
50 is answer.
Answer
Correct Answer:
Error message
Note: This Question is unanswered, help us to find answer for this one
Check Answer
221. What will be the result of the following code ? $a = 0 or 1; $b = 0 || 1; echo "$a, $b";
1, 1
1, 0
0, 0
0, 1
Note: This Question is unanswered, help us to find answer for this one
Check Answer
222. What is the output in following codes? "green", "red", "blue"); $array2 = array("b" => "green", "yellow", "red"); $result = array_intersect($array1, $array2); print_r($result); ?>
Array ( [a] => green [0] => red )
Array ( [a] => green [1] => red )
Array ( [a] => green [2] => red )
Array ( [0] => green [1] => red )
Array ( [a] => green [b] => red )
Answer
Correct Answer:
Array ( [a] => green [0] => red )
Note: This Question is unanswered, help us to find answer for this one
Check Answer
223. What will be the output of the next code? : $someString = 1.2e3; var_dump(strlen($someString));
int 1200
int 5
int 4
Note: This Question is unanswered, help us to find answer for this one
Check Answer
224. Key casts in arrays. What is the resulting array $a = array( 1 => "John", "1" => "Doe", 1.5 => "Jane", true => "Smith", );
Array ( [1] => "Jane", )">
Array ( [1] => Smith )
Array ( [1] => "Jane", [true] => Smith )">
Array ( [1] => "Doe", [1.5] => "Jane", [true] => Smith )">
Array ( [1] => John )
Answer
Correct Answer:
Array ( [1] => Smith )
Note: This Question is unanswered, help us to find answer for this one
Check Answer
225. $a = 'Hello'; echo (int)!!$a;
1
FALSE
TRUE
Hello
0
Note: This Question is unanswered, help us to find answer for this one
Check Answer
226. What is the function to report errors from mysqli functions or queries?
mysqlireport();
mysqli_report();
mysql_sql_exception
mysql_generate_report();
mysqli_report_error();
Answer
Correct Answer:
mysqli_report();
Note: This Question is unanswered, help us to find answer for this one
Check Answer
227. Output of the following code? echo new stdClass == new stdClass, '-', new stdClass !== new stdClass;
0-0
1-1
1-0
0-1
Note: This Question is unanswered, help us to find answer for this one
Check Answer
228. What this code will do? class Animal { public $name = 'dog'; } $a = new Animal(); $b = clone $a; $c = $a; $a->name = 'cat'; $b->name = 'bear'; $c->name = 'parrot'; echo $a->name . ', ' . $b->name . ', ' . $c->name;
parrot, bear, parrot
dog, dog, dog
cat, bear, parrot
cat, bear, cat
Answer
Correct Answer:
parrot, bear, parrot
Note: This Question is unanswered, help us to find answer for this one
Check Answer
229. The contents of an image file are stored in memory as $imString, but the original file is not available. Of the following, which uses the least amount of code and is a valid method of retrieving the dimensions of $imString?
$fn = tempnam('/dir', 'foobar'); file_put_contents($fn, $imString); return getimagesize($fn);
$im = imagecreatefromstring($imString); return array(imagesx($im), imagesy($im));
None of the above are valid PHP code
return getimagesizefromstring($imString);
return strlen($imString);
Answer
Correct Answer:
return getimagesizefromstring($imString);
Note: This Question is unanswered, help us to find answer for this one
Check Answer
230. What result? $a = "1"; $a[$a] = "2"; echo $a;
12
1
2
error
3
Note: This Question is unanswered, help us to find answer for this one
Check Answer
231. Which of following functions get a list of response headers sent (or ready to send)?
get_header_list()
headers_list()
header_list()
None of these
Answer
Correct Answer:
headers_list()
Note: This Question is unanswered, help us to find answer for this one
Check Answer
232. Which of the following functions set options in curl script?
curl_setopt()
curl_option()
curl_set_option()
curl_opt()
curl_set_opt()
Answer
Correct Answer:
curl_setopt()
Note: This Question is unanswered, help us to find answer for this one
Check Answer
233. How to check if a directory exists?
is_dir_exists($name);
is_exists($name);
file_exists($name);
dir_exists($name);
Answer
Correct Answer:
file_exists($name);
Note: This Question is unanswered, help us to find answer for this one
Check Answer
234. ____ will walk through the entire array regardless of pointer position.
foreach()
array_walk()
array_map()
array_loop()
Answer
Correct Answer:
array_walk()
Note: This Question is unanswered, help us to find answer for this one
Check Answer
235. What is the difference between idate and date function?
idate function always returns a formatted date string, but date function returns a formatted date string or FALSE.
All of these
idate function has more diverse expressions than date function.
None of these
idate function always returns an integer, but date function returns formatted date string or FALSE.
Answer
Correct Answer:
idate function always returns an integer, but date function returns formatted date string or FALSE.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
236. How do you get header information from a URL?
get_headers()
None of these
get_header_info()
get_header()
Answer
Correct Answer:
get_headers()
Note: This Question is unanswered, help us to find answer for this one
Check Answer
237. What will following code outputs? function add($a) { return $a++; } echo add(5);
6
E_WARNING
5
E_NOTICE
4
Note: This Question is unanswered, help us to find answer for this one
Check Answer
238. What is output of the following code? $arr = "a"; $arr[0]="b"; echo $arr; echo $arr[0];
Fatal Error.
bb
aa
ab
PHP Warning.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
239. To ensure that a given object has a particular set of methods, you must provide a method list in the form of an ________ and then attach it as part of your class using the ________ keyword.
instance, implements
interface, extends
interface, implements
array, interface
access-list, instance
Answer
Correct Answer:
interface, implements
Note: This Question is unanswered, help us to find answer for this one
Check Answer
240. $sweet = array('1' => 'apple', '2' => 'banana'); $fruits = array('delicious' => $sweet, 'sweet' => 'strawberry'); function myprint($item, $key) { echo '$key is $item\n'; } array_walk_recursive($fruits, 'myprint'); In above code, what is the output?
[1 is apple] [2 is banana] [sweet is strawberry]
[delicious is apple] [delicous is banana] [sweet is strawberry]
[apple is delicious] [banana is delicious] [strawberry is sweet]
Answer
Correct Answer:
[1 is apple] [2 is banana] [sweet is strawberry]
Note: This Question is unanswered, help us to find answer for this one
Check Answer
241. What prefix prevents child classes from overriding a method
private
protected static
final
private static
Note: This Question is unanswered, help us to find answer for this one
Check Answer
242. Output of the following code: <?php class A {} class B {} class C extends B {} class D { function sayHello (A $argument) { echo '$argument is an instance of A' } function sayHello (B $argument) { echo '$argument is an instance of B' } } $d = new D(); $c = new C(); $d->sayHello($c);
Call to undefined method D::sayHello()
$argument is an instance of A
$argument is an instance of B
PHP Fatal error
Answer
Correct Answer:
PHP Fatal error
Note: This Question is unanswered, help us to find answer for this one
Check Answer
243. How can you add five days to a PHP5 date-object like this: $date_object = date_create("1/18/2015");
$date_object->modify(
$date_object->add(
$date_object::add(
$date_object->modify(
Answer
Correct Answer:
$date_object->modify(
Note: This Question is unanswered, help us to find answer for this one
Check Answer
244. What is wrong with the following code? setValue(10); $a_copy->setValue(20); ?>
There is nothing wrong with this code
You must use return &$newObj instead
duplicate() must return a reference
You must use the clone operator to make a copy of an object
Answer
Correct Answer:
You must use the clone operator to make a copy of an object
Note: This Question is unanswered, help us to find answer for this one
Check Answer
245. What is the new syntax of array ?
[]
array[]
array{}
array()
()
Note: This Question is unanswered, help us to find answer for this one
Check Answer
246. Given: $email = ‘bob@example.com’; which code block will output example.com?
print strstr($email, ‘@’);
print substr($email, -1 * strrpos($email, ‘@’));
print substr($email, strpos($email, ‘@’) + 1);
print substr($email, strrpos($email, ‘@’));
Answer
Correct Answer:
print substr($email, strpos($email, ‘@’) + 1);
Note: This Question is unanswered, help us to find answer for this one
Check Answer
247. What will be output of this statement echo substr("Think Different",6);
ferent
Think Dif
Different
statement show's error
Think
Answer
Correct Answer:
Different
Note: This Question is unanswered, help us to find answer for this one
Check Answer
248. How to install pecl extensions?
sudo /usr/local/php5/bin/pecl install pecl_http
php /usr/local/php5/bin/pecl install pecl_http
Answer
Correct Answer:
sudo /usr/local/php5/bin/pecl install pecl_http
Note: This Question is unanswered, help us to find answer for this one
Check Answer
249. What is the name of default class for all classes
stdClass
__CLASS__
CLASS
NSObject
Object
Note: This Question is unanswered, help us to find answer for this one
Check Answer
250. What is the primary difference between a method declared as static and a normal method?
Static methods cannot be called from within class instances
Static methods don't have access to the self keyword
There is no functional difference between a static and non-static method
Static methods do not provide a reference to $this
Answer
Correct Answer:
Static methods do not provide a reference to $this
Note: This Question is unanswered, help us to find answer for this one
Check Answer
251. If the method is an abstract, class must be:
Interface or abstract
Only extended
Abstract
Interface and extended
Only Interface
Note: This Question is unanswered, help us to find answer for this one
Check Answer
252. Which subversion of PHP5 adds short array syntax?
2
4
5
3
Note: This Question is unanswered, help us to find answer for this one
Check Answer
253. $array = []; Is coorect in php version
5.3
5.1
5.4
5.2
Note: This Question is unanswered, help us to find answer for this one
Check Answer
254. $text = 'He went to the school.'; echo strpbrk($text, 'w'); In the above code, what is the output?
None of these
all of these
true
3
went to the school.
Answer
Correct Answer:
went to the school.
Note: This Question is unanswered, help us to find answer for this one
Check Answer
255. The _______ method will be called automatically when an object is represented as a string.
__toString()
__getString()
getString()
__get()
Answer
Correct Answer:
__toString()
Note: This Question is unanswered, help us to find answer for this one
Check Answer
256. What is the difference between $message and $$message?
Memory pointer
Classic example of PHP’s variable variables
Error
Answer
Correct Answer:
Classic example of PHP’s variable variables
Note: This Question is unanswered, help us to find answer for this one
Check Answer
257. How do you connect mysql with the use of PHP5 new functions?
(both answers are correct)
$connection = new mysqli('localhost', 'user', 'pass', 'test');
$user = 'user'; $pass = 'pass'; $connection = new PDO('mysql:host=localhost;dbname=test', $user, $pass);
Answer
Correct Answer:
(both answers are correct)
Note: This Question is unanswered, help us to find answer for this one
Check Answer
258. What will the following code output: "lemon", "a"=>"orange", "b"=>"banana", "c"=>"apple"); ksort($fruits); foreach ($fruits as $key => $val) { echo "$key = $val\n"; } ?>
a = apple b = banana c = lemon d = orange
d = apple a = banana b = lemon c = orange
a = orange b = banana c = apple d = lemon
d = lemon a = orange b = banana c = apple
a = lemon b = orange c = banana d = apple
Answer
Correct Answer:
a = orange b = banana c = apple d = lemon
Note: This Question is unanswered, help us to find answer for this one
Check Answer
259. What visibility level will this class property get in PHP5? var $cool = true;
protected
private
public
var keyword is no longer valid in PHP5
Note: This Question is unanswered, help us to find answer for this one
Check Answer
260. How do you make PHP use a class file without having to require or include it manually?
Define $_MAP superglobal
Set default_lib_path variable in php.ini
Use set_class_handler($class_handler) function
Define __autoload($class) magic function
There's no way to do it
Answer
Correct Answer:
Define __autoload($class) magic function
Note: This Question is unanswered, help us to find answer for this one
Check Answer
261. Which of these functions will not result in a runtime error if the file requested does not exist or can't be opened?
require()
include()
nowarn()
getFile()
Answer
Correct Answer:
include()
Note: This Question is unanswered, help us to find answer for this one
Check Answer
262. True or false? PHP provides the goto in the latest version.
True
False
Note: This Question is unanswered, help us to find answer for this one
Check Answer
263. ( (4 >= 4 && 8 < 1) || (44 == 33 || 5 > 3) ) will return
FALSE
TRUE
Note: This Question is unanswered, help us to find answer for this one
Check Answer
264. function foobar( ) { $a = func_get_args( ); return $a[2]; } print foobar('a',1,'b',2); What would the output be?
b
2
1
a
a2
Note: This Question is unanswered, help us to find answer for this one
Check Answer
265. You start a transaction with PDO::beginTransaction(). How do you commit a transaction?
PDO::endTransaction()
PDO::commitTransaction()
PDO::stopTransaction()
PDO::closeTransaction()
PDO::commit()
Answer
Correct Answer:
PDO::commit()
Note: This Question is unanswered, help us to find answer for this one
Check Answer
266. Assuming today is March 10th, 2001, 5:16:18 pm, and that we are in the Mountain Standard Time (MST) Time Zone, which of the follow outputs: March 10, 2001, 5:16 pm
date("F j, Y, g:i a");
date("j, n, Y");
date("m.d.y");
date('h-i-s, j-m-y, it is w Day');
date("D M j G:i:s T Y");
Answer
Correct Answer:
date("F j, Y, g:i a");
Note: This Question is unanswered, help us to find answer for this one
Check Answer
267. You start a transaction with PDO::beginTransaction(). How do you roll back a transaction?
PDO::stopTransaction()
PDO::rollbackTransaction()
PDO::rollBack()
PDO::abortTransaction()
Answer
Correct Answer:
PDO::rollBack()
Note: This Question is unanswered, help us to find answer for this one
Check Answer
268. What is the best way to URL encode a string?
urldecode( $str )
urlencode( $str )
urlcode( $str )
encode_url( $str )
encodeurl( $str )
Answer
Correct Answer:
urlencode( $str )
Note: This Question is unanswered, help us to find answer for this one
Check Answer
269. In mail($param1, $param2, $param3, $param4), the $param2 contains:
The subject
The recipient
The header
The message
Answer
Correct Answer:
The subject
Note: This Question is unanswered, help us to find answer for this one
Check Answer
270. $a = &$b; $b = 'Mary?' print $a;
Fatal error
Mary?
Empty output
Notice
Warning
Note: This Question is unanswered, help us to find answer for this one
Check Answer
271. Which of the following responsible for generates the backtrace
debug_backtrace()
trigger_error()
debug_print_backtrace()
user_error()
error_get_last()
Answer
Correct Answer:
debug_backtrace()
Note: This Question is unanswered, help us to find answer for this one
Check Answer
272. The ______ keyword is used to indicate an incomplete class or method, which must be further extended and/or implemented in order to be used.
abstract
incomplete
implements
protected
Note: This Question is unanswered, help us to find answer for this one
Check Answer
273. What is the name of the function to check that the variable type is an object?
(none of these)
is_object
TypeOject
isObject
Answer
Correct Answer:
is_object
Note: This Question is unanswered, help us to find answer for this one
Check Answer
274. Which of the following is not related to file
fgets
fopen
fappend
fclose
fwrite
Note: This Question is unanswered, help us to find answer for this one
Check Answer
275. What function in PHP allows you to find the position of the first occurrence of a substring?
strtok()
strripos()
str_repeat()
strpos()
substr()
Note: This Question is unanswered, help us to find answer for this one
Check Answer
276. How can you delete a file using a php function?
drop
delete
deletefile
remove
unlink
Note: This Question is unanswered, help us to find answer for this one
Check Answer
277. Which of the following responsible for change the current directory?
chdir()
closedir()
opendir()
dir()
rewinddir()
Note: This Question is unanswered, help us to find answer for this one
Check Answer
278. (8 < 1 || 4 >= 4 ) will return
True
False
Note: This Question is unanswered, help us to find answer for this one
Check Answer
279. A fatal error would be caught by
E_NOTICE
ERROR
E_ALERT
E_ERROR
E_WARNING
Note: This Question is unanswered, help us to find answer for this one
Check Answer
280. Which function would you use to append one or more elements to the end of the array?
array_push()
array_unshift()
array_shift()
array_pop()
Answer
Correct Answer:
array_push()
Note: This Question is unanswered, help us to find answer for this one
Check Answer
281. True or false? One can include (”abc.PHP”) two times in a PHP page “makeit.PHP”.
False
True
Note: This Question is unanswered, help us to find answer for this one
Check Answer
282. If regular expressions must be used, in general which type of regular expression functions available to PHP is preferred for performance reasons?
preg_* regular expression functions
ereg* regular expression functions
strtok() using regular expressions
strregex* regular expression functions
Answer
Correct Answer:
preg_* regular expression functions
Note: This Question is unanswered, help us to find answer for this one
Check Answer
283. What operator is used to test if two values are identical in every way
===
!==
instanceof
==
=
Note: This Question is unanswered, help us to find answer for this one
Check Answer
284. $x = 10.88; echo (int) $x;
1
0
11
10
Note: This Question is unanswered, help us to find answer for this one
Check Answer
285. How to open file in read/write mode?
$handle = fcopen("http://www.example.com/", "r");
$handle = fileopen("http://www.example.com/", "r+");
$handle = fopen("http://www.example.com/", "r");
$handle = fopen("http://www.example.com/", "r+");
$handle = fcopen("http://www.example.com/", "r+");
Answer
Correct Answer:
$handle = fopen("http://www.example.com/", "r+");
Note: This Question is unanswered, help us to find answer for this one
Check Answer
286. How do you kill or destroy a session?
kill_session()
session_destroy();
destroy_session()
reset_session()
session_kill()
Answer
Correct Answer:
session_destroy();
Note: This Question is unanswered, help us to find answer for this one
Check Answer
287. Which of the following function is used to check type of array
isArray
is_array
array_valid
valid_array
Note: This Question is unanswered, help us to find answer for this one
Check Answer
288. How do you write "Hello World"?
echo 'Hello World!"
"Hello World!"
Answer
Correct Answer:
echo 'Hello World!"
Note: This Question is unanswered, help us to find answer for this one
Check Answer
289. What Does OOM mean?
Object Original Miscleneaous
Object Orientaton Mechnism
Object Over Masterclass
Object Oriented Model
Original Overlap Model
Answer
Correct Answer:
Object Oriented Model
Note: This Question is unanswered, help us to find answer for this one
Check Answer
290. How can I identify the server IP address in PHP?
$_ADDRESS['server_ip'];
$_SERVER['SERVER_ADDR'];
server_id();
server_addr();
Answer
Correct Answer:
$_SERVER['SERVER_ADDR'];
Note: This Question is unanswered, help us to find answer for this one
Check Answer
291. The function used to iterate over array and object.
while
dowhile
foreach
for
Note: This Question is unanswered, help us to find answer for this one
Check Answer
292. What is the default timezone in pHP5
Gambier/Islands
French/Polynesia
Europe/Zurich
Answer
Correct Answer:
Europe/Zurich
Note: This Question is unanswered, help us to find answer for this one
Check Answer
293. What is PEAR in PHP?
PHP Extension and Application Repository
There is no PEAR in PHP.
PHP Extended Applications aRchive
Answer
Correct Answer:
PHP Extension and Application Repository
Note: This Question is unanswered, help us to find answer for this one
Check Answer
294. Which function can be used to rename files?
fputs()
rename()
fwrite()
copy()
die()
Note: This Question is unanswered, help us to find answer for this one
Check Answer
295. Which of the following function is used to display the properties of variable?
explain
define
none of the above
var_dump
Note: This Question is unanswered, help us to find answer for this one
Check Answer
296. PDO::beginTransaction() turns off autocommit mode.
True
False
Note: This Question is unanswered, help us to find answer for this one
Check Answer
297. Which function will list files and directories inside the specified path?
fopen()
fscan()
scandir()
opendir()
readdir()
Answer
Correct Answer:
scandir()
Note: This Question is unanswered, help us to find answer for this one
Check Answer