PHP

PHP Objective Questions and Answers

More interview questions and answers

PHP stands for a. PHP Hypertext Preprocessor b. Perfect Hypertext Preprocessor c. Past Hypertext Preprocessor

a. PHP Hypertext Preprocessor

PHP is an a. client-side scripting language b. server-side scripting language c. both server-side and client-side scripting language

b. server-side scripting language

Choose correct syntax to print "R4R Welcomes You!" using PHP in HTML. a. b. c.

a. 

Which one is right in PHP? a. var_name = $value; b. $var_name = $value; c. $var_name = value; d. var_name = value;

c. $var_name = value; i.e.$num = 7;
 

Who develops PHP?

PHP develop by Rasmus Lerdorf in 1995.

In php string data are a. '' b. "" c. delimited by <<< identifier d. All of above

d.  All of above

PHP compound data types are?a. Arrayb. Objectsc. Bothd. None

c.  Both

Which of folowiing variable assignment is 'by value' assignment in PHP a. $value1= $value b. $value1= & $value c. $value1= & $value d. None

a.  $value1= $value2

Which of following variable scope that is not supported by PHP? a. Local variables b. Function parameters c. Hidden variables d. Global variables

c.  Hidden variables

Which of following is invalid identifier in PHP? a. my-function b. size c. –some word d. This&that

Both c and d are invalid identifier as c starts with hyphen(-) which is invalid and 'd' consist of special chars

Casting syntax introduced in PHP 6 is a. (array) b. (int64) c. (real) or (double) or (float) d. (object)

B.  (int64)

Which is true for identifier in PHP ? a. Identifier are case sensitive. So $r4r is different than $R4R b. Identifiers can be any length c. Both of above d. None of above

c.  Both of above

12. What is output of following: $r4r=15; function adit() { GLOBAL $r4r; $r4r++ ; echo "r4r is $r4r"; } addit (); a. r4r is 15 b. r4r is 16 c. r4r is 1 d. r4r is $ r4r

b.  r4r is 16

What is use of left associative dot operator (.)in PHP ? a. multiplication b. concatenation c. separate object and its member d. delimeter

b. concatenation

function that does continue the script execution even if the file inclusion fails? a. include () b. require () c. both of above d. None of above

a.include ()

When failure which statement the script execution stops displaying error/warning message? a. rinclude () b. require () c. both of above d. None of above

b.  require ()

Which function includes the specified file even the statement evaluates to false in which block the function is placed? a. include () b. require () c. both of above d. None of above

b.require ()

The left association operator % is used in PHP a. percentage b. bitwise or c. division d. modulus

d.modulus

which a variable does not loose its value when the function exists and use that value if the function is called agai.Which scop is it? a. Local b. function parameter c. static d. None of above

c.static

Which datatypes are treaded as arrays a. Integer b. Float c. String d. Booleans

c. String

Which of the following delimiting method is known as string Interpolation a. '' b. "" c. delimited by <<< identifier d. All of above

C.delimited by <<< identifier

Which of the folowing are valid float values? a. 4.5678 b. 4.0 c. 7e4 d. All of above

d.  All of above

Trace the odd data type for PHP a. floats b. integer c. doubles d. Real number

b. integer

Trace the false statement 1. Any code found within an included file will inherit the variable scope of the location of its caller 2. Because the included code will be embedded in a PHP execution block, the PHP execution block, the PHP escape tags (Wink aren't required on the file to be included 3. For the inclusion of remote files the allow-url-pope must be enabled ad URL wrapper must be supported 4. Including a file produces the same result as copying the data from the file specified into the location in which the statement appears 5.None

b

1. mail($param2, $param2, $param3, $param4), the $param2 contains: a.The message b.The recipient c.The header d.The subject

 d.The subject

Which of the following is not a session function? a.sssion_decode b.session_destroy c.session_id d.session_pw

d.session_pw

When uploading a file if the UPLOAD_ERR-OK contains value 0 it means a.Uplaod is not successful, error occurred b.The file uploaded with success c.Uploaded file size is 0 d.File upload progress is 0% completed

b.The file uploaded with success

8. Which of the following delimiter is PHP style? a. b. <% %> c. d.

a. 

Which of following function return 1 when output is successful? a.echo( ) b.print( ) c.both d.None

b.print( )

Which of followng statement for static text and dynamic information stored within one or several variables? a.echo ( ) b.print ( ) c.Print f ( ) d.None of above

c. Printf ( )

Which of the following type specifier is invalid in printf() functions a.% a b.% b c.% c d.% d

a. % a

Which of the following function for string variable a.echo() b.print() c.printf() d.sprintf()

d.sprintf()

Which of following comments is supported by Php a.Single line c++ syntax - // b.Shell syntax - # c.Both of above d.None of above

c. Both of above

mysql_connect( ) does not take following parameter a.database host b.user ID c.password d.database name

d.database name

Study following steps and determine the correct order (1) Open a connection to MySql server (2) Execute the SQL query (3) Fetch the data from query (4) Select database (5) Close Connection a. 1, 4, 2, 3, 5 b. 4, 1, 2, 3, 5 c. 1, 5, 4, 2, 1 d. 4, 1, 3, 2, 5

a. 1, 4, 2, 3, 5

Which syntax is nit PHP? a. b. <% %> c. d.

b.<%   %>
c. 
d. 

Which of the following data type is not seal or datetype supported by PHP a.Array b.String c.Float d.Boolean

a.Array

Which of the following data type is compound datatype supported by PHP? a.Array b.String c.Float d.Boolean

a.Array

If a boolean variable $ alve= 5; a.$ alve is false b.$ alve is true c.$ alve is overflow d.the statement is snot valid

b.$ alve is true

For integer data type PHP 5 or earlier supported 1.8 bit integer value 2.16 bit integer value 3.32 bit integer value 4.64 bit integer value

d. 64 bit integer value

When compared to the compiled program, scripts run a.Faster b.Slower c.The execution speed is similar d.All of above

b.Slower 

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 compiled. d.PHP can not be embedded into html.

d.PHP can not be embedded into html.

PHP supports all four different ways of delimiting.In such context identify the false statement: a.we can use any of the delimiting style b.we can use different delimiting styles in same page c.we can use any delimiting style but must use a single style consistently for a page d.Variables declared in previous blocks are remenbered on later blocks too!

c

PHP Objective Questions and Answers