2.Question
what would be the output of the following code?
$stg=’good day’;
$stg= ucwords($stg);
echo $stg;
?>
a. good day
b. GOOD DAY
c. Good Day
d None of the above

3.Question:
which of the following command line interface constant is not defined in the cli sapi?
a. STDIN
b. STDOUT
c. STDPRT
d STDERR

4.Question:
if the session_cache_expire()is not set,then by default the session cache will expire after:
a. 1 hr
b. 2 hr
c. 3 hr
d 4 hr
5.Question:
Which of the following is not a correct way of commenting in php?
a. //php comment
b. /*php comment*/
c. #php comment
d /# php comment
6.Question:
What is true regarding this code?
a. setcookie will return false
b. setcookie will return true
c. setcookie will return null
d. Any of the above can happen

7.Question:
Which of the following is not a correct way of printing text in php5?
a. echo “Plain text”;
?>
b.
c.
d. <# echo “Plain text” #>

8.Question:
Which of the following is not the correct way of starting a session?
a. session.auto_start
b. session_register()
c. session_initiate()
d. session_start()

9.Question:
Which of the following functions do you need to implement HTTP Basic Authentication?
a. authenticate ()
b. header ()
c. basic_auth ()
d. None of the above

10.Question:
Which of the following Command Line Interface constant is not defined in the CLI SAPI?
a. STDIN
b. STDOUT
c. STDPRT
d. STDERR

11.Question:
Which of the following statements is correct with regard to final and abstract?
a. An abstract class cannot have final methods
b. An abstract class cannot have non abstract methods
c. A final class cannot have abstract methods
d. A final class cannot have final methods

13.Question:
The default value of register_globals in PHP is:
a. Off
b. On

14.Question:
Which of the following is not a valid PHP connection status?
a. aborted
b. normal
c. open
d. timeout

15.Question:
Choose the correct statement:
a. include() includes and evaluates a specific file
b. require() includes and evaluates a specific file
c. include_once() includes and evaluates a specific file only if it has not been included before
d. require_once() includes and evaluates a specific file only if it has not been included before
e. All of the above

19.Question:
Which of the following statements is true with regard to comparisons in PHP5?
a. With “= =” operator, two object instances are equal if they have the same attributes and values, and are instances of a different class.
b. With “==” operator two object instances are equal if they have the same attributes and values, and are instances of the same class.
c. With (===) operator, object variables are identical if and only if they refer to the same instance of the same class.
d. With (===) operator, object variables are identical if and only if they refer to the different instance of the same class.

20.Question:
You have to upload a file using form post method:
1
2 Send this file:
3
4
What should be the code in line 3, if the file name to upload is “SalesFile”?
a.
b.
c.
d.

21.Question:
Which of the following built-in function assist in checking if actually the function exists or not?
a. exists
b. function_exists
c. fexists
d. isFunction

22.Question:
What will be the output of the following code?
$a = 0.0;
for ($i = 0; $i < a =”=””>
a. 0.9
Not Equals
b. 1
Equals
c. 1
Not Equals
d. 1.1
Not Equals
e. None of the above

Question:
You have designed a user login form as follows:
User Name:
Password:
How can you access the username entered by the user in the ‘Validate.php’ webpage?
a. $var= $_POST[‘username’];
b. $var= $_REQUEST[‘username’];
c. import_request_variables(‘p’, ‘p_’);
$var= $p_username;
d. All of the above
30.Question:
Which of the following does not represent logical AND operator in PHP?
a. &
b. &&
c. And
d. AND
Question:
Which of the following is not true for a persistent connection?
a. These are not closed even after the execution of the script
b. These are mainly used to increase the efficiency of the system
c. These can’t be converted to non-persistent connections
d. These are preferably not used in the scripts involving transactions

41.Question:
What will be the ouput of the following code?
if (-1)
print “true”;
else
print “false”;
?>
a. true
b. false
42.Question:
What will be the output of the following code?
echo 12 . 6;
a. 12 . 6
b. 126
c. 12.6
d. Error: You cannot add integers through the concatenation operator(.)

44.Question
The setrawcookie() method of setting cookies is different from PHP standard method of cookie setting as:
a. It does not allow expiry time to be set
b. It can be used only once
c. It does not URL-ENCODE the value on its own
d.It does not allow domain setting

45.Question
You need to keep an eye on the existing number of objects of a given class without introducing a non-class varibale. which of the following makes this happen?
a. Add a member varibale that gets incremented in the default constructer and decremented the destructer.
b. Add a local variable that gets incremented in each constructer and decremented in the desructer
c. Add a static member variable that gets incremented in each constructer and decreented in the destructor
d. This cannot be accomplished since the creation of objects is being done dynamically via “new”
46.Question
How can you hide the fact that web pages are written in PHP?
a. By using AddType application/X-httpd-php asp
b. Specify all file names without any dot and extension
c. By using .htaccess diretive in Apeche
d. All of the above

48.Question
Which of the following set of operations is not valid in PHP 5?
a. >, >=
b. =,==
c. !==,!==
d. +=, *=

49.Question
Late PHP version support remote file accessing for the functions:
a. include()
b. include_once()
c. require_once()
d. All of the above

PHP Test And solutions
50.Question.
which of the following are used for code reuse?
a. Loops
b. functions
c. Database
d. include files
51.Question
Which of the following are ”magic constant’?
a. __LINE__
b. __FILE__
c __PRETTY_FUNCTION__
d __CLASS__
e. __METHOD__
52.Question
Which one of the following is turnary operator?
a. &
b. =
c.
d. ?:
e. +=
f. &&

53.Question
What is the result of the following Exprssion?
5+2*4+6
a. 70
b. 19
c. 34
d. 21

54.Question.
The default value of register global in PHP is:
a. Off
b. On

55.Question
What would b the outpur of the following code?
$string = ‘good day’;
$string = ucword($string);
echo $string;
?>
a. good day
b. GOOD DAY
c. Good Day
d. non of the above

56.Question

If you want to pass a value to a function by reference, the correct way is: