Suscriber with us



Receive HTML?

Syndicate

php interview question part1 PDF Print E-mail

1.Php supports following database

a) Solid & oracle
b) mysql
c) None of the above
d) All of the above

All of the above

2.php comments will be

a) //
b) /* fgfg */
c) All of the above
d) First one

ANS: All of the above

3.what is the output for the following script?

$s=”hihihi”;
echo $s. “ welcome”.$s;
a) syntax error
b) runtime error
c) all of the above
d) hihihi welcome hihihi

ANS: d

4.What is the output below mentioned

<?php
$findme = 'a';

$mystring2 = 'ABC';
$pos1 = stripos($mystring2, $findme);
if ($pos1 === false) {
echo "string is not matched";
}
else
{echo ‘ match found’;}
?>

a) String not matched
b) Match found
c) All of the above
d) None of the above

ANS : b (note stripos)

5.What is the output here?

<?php
var_dump(0 == "a");
?>

a) false
b) true
c) error
d) declaration error

ANS : true

6.What output do you get here?

<?php
$array=array(5,5,5);
echo $r=array_pad($array,5,2);
?>

Ans:Array

NOTE: use 'foreach($r as $v)' then try to output value 'echo $v' or use Print_r($r)

so if we make above script as

<?php
$array=array(5,5,5);
$r=array_pad($array,5,2);

foreach($r as $v)
echo $v;
?>

We get the output as 55522

7.What is scadir( )?

->>> List files and directories inside the specified path
->>> By default files order will be ascending
->>> make $f = scandir($direct, 1); it will display the files as descending order

8.What function would you use to redirect the browser to a new page?

1. redir()
2. header()
3. location()
4. redirect()

ANS:header()

9.What function can you use to open a file for reading and writing?

1. fget();
2. file_open();
3. fopen();
4. open_file();

ANS:fopen();

10.How can you get round the stateless nature of HTTP using PHP?

ANS: using Sessions in PHP





Digg!Del.icio.us!Google!Live!Facebook!Slashdot!Technorati!StumbleUpon!Newsvine!Yahoo!Free social bookmarking plugins and extensions for Joomla! websites!
Last Updated ( Thursday, 13 March 2008 )
 

Download Utility

XAMPP
WAMP
EditPlus
Zend Studio

Polls

Which is the best Scripting language?