Sie sind auf Seite 1von 8

PHP TEST

Q1
a.
b.

The difference between include() and require()


are different how they handle failure.
both are same in every aspects

c.
is include() produced a Fatal Error while
require results in a
warning
d.

none of above

Q2 Which of the following method is suitable when


you need to send larger form submissions?
a.

Get

b.

Post.

c.

Both Get and Post

d.
There is no direct way for larger form. You
need to store them in a file and retrieve
Q3

The function setcookie( ) is used to

a.

Enable or disable cookie support

b.

Declare cookie variables

c.

Store data in cookie variable.

d.

All of above

Q4 If a boolean variable $ alive= 5;


a.

$ alive is false

b.

$ alive is true.

c.

$ alive is overflow

d.

the statement is not valid

Q5 The left associative dot operator (.) is used in


PHP for
a. multiplication
b. concatenation.
c. separate object and its member
d. delimeter

Q6 Identify the variable scope that is not


supported by PHP

a. Local variables
b. Function parameters
c. Hidden variables.
d. Global variables

Q7 Which of the following form element names can


be used to create an array in PHP?
A. foo
B. [foo
C. foo[].
D. foo[bar]

Q8 What are the contents of output.txt after the


following code snippet is run?

<?php
$str = abcdefghijklmnop;
$fp = fopen(output.txt, w);
for($i=0; $i< 4; $i++) {
fwrite($fp, $str, $i);
}
?>
A. abcd
B. aababcabcd
C. aababc.
D. aaaa

Q9 What is the name of the function that you


should use to put uploaded files into a permanent
location on your server?
(write answer here)

Q10 What is the value displayed when the


following is executed? Assume that the code was
executed using the following URL:
testscript.php?c=25
<?php
function process($c, $d = 25)
{
global $e;
$retval = $c + $d - $_GET['c'] - $e;
return $retval;
}
$e = 10;
echo process(5);
?>
A) 25
B) -5.
C) 10
D) 5

Q11 Which of the following will not combine strings


$s1 and $s2 into a single string?
A) $s1 + $s2.
B) "{$s1}{$s2}"
C) $s1.$s2
D) implode(' ', array($s1,$s2))
Q12 What will the following script output?
<?php
$array = array (1, 2, 3, 5, 8, 13, 21, 34, 55);
$sum = 0;
for ($i = 0; $i< 5; $i++) {
$sum += $array[$array[$i]];
}
echo $sum;
?>
A) 78.
B) 19
C) NULL
D) 5
Q13 fgets() is used to read a file one line at a time
A) True.
B) False

Q14 In PHP in order to access MySQL database you


will use:
A) mysqlconnect() function
B) mysql-connect() function
C) mysql_connect() function.
D) sql_connect() function

Q15 What is the output ?


Assume that today is 2009-5-19:2:45:32 pm <?php
$today = date("F j, Y, g:i a"); ?>
(A)may 19,09,2:45:32 PM
(B)May 19, 2009, 2:45 pm.
(C)May 19,2009,14:45:32 pm
(D)May 19,2009,14:45:32 PM
Q16
Which of the following function is used for
terminate the script execution in PHP?
(A)break()
(B)quit()
(C)die().

Q17

<?php

FUNCTION TEST()
{
ECHO "PROGRAMMING SKILLS!\n";
}
test();
?>
(A)nothing
(B)its a compiler error, the code won't run.
(C) PROGRAMMING SKILLS!.
(D) programming skills!
Q18 A value that has no defined value is expressed
in PHP with the following keyword:
(A)None
(B)undef
(C)There is no such concept in PHP
(D) null.

Q19

What will be the value of $var?

$var = 1 / 2;

(A)0
(B)1
(C)0.5.
(D)null

Q20 Write a code to make a form using Html and


save all the values in the database using php.
The form fields are:
Name //text field
Roll no //number field
Gender //radio button
Hobbies // check box (atleast 3 values)

The database name is TEST and table name is


PHPSIG.

Das könnte Ihnen auch gefallen