PHP Programming Fundamentals

Tests knowledge of PHP variable scope, string manipulation, file handling, cookies, and email functions

19 Questions Published

Questions

Question 1 Multiple Choice (Single Answer)

Which of following commenting is supported by Php

  1. Single line c++ syntax - //
  2. Shell syntax - #
  3. Both of above
  4. None of above
Question 2 Multiple Choice (Single Answer)

Which of following function return 1 when output is successful?

  1. echo ( )
  2. print()
  3. both
  4. none
Question 3 Multiple Choice (Single Answer)

Which of followng statement is more suitable if you want to output a blend of static text and dynamic information stored within one or several variables?

  1. echo()
  2. print()
  3. Printf()
  4. none
Question 4 Multiple Choice (Single Answer)

Which of the following type specifier is invalid in printf() functions?

  1. %a
  2. %b
  3. %c
  4. %d
Question 5 Multiple Choice (Single Answer)

For integer data type PHP 5 and earlier supported?

  1. 8 bit integer value
  2. 16 bit integer value
  3. 32 bit integer value
  4. 64 bit integer value
Question 6 Multiple Choice (Single Answer)

In mail($param2, $param2, $param3, $param4), the $param2 contains:

  1. The message
  2. The subject
  3. The header
  4. The recipient
Question 7 Multiple Choice (Single Answer)

When uploading a file if the UPLOAD_ERR-OK contains value 0 it means?

  1. Uplaod is not successful, error occurred
  2. The file uploaded with success
  3. Uploaded file size is 0
  4. File upload progress is 0% completed
Question 8 Multiple Choice (Single Answer)

fopen($file_doc,"r+"); opens a file for?

  1. reading
  2. writing
  3. none of above
  4. both of above
Question 9 Multiple Choice (Single Answer)

To work with remote files in PHP you need to enable?

  1. allow_url_fopen
  2. allow_remote_files
  3. both of above
  4. none of above
Question 10 Multiple Choice (Single Answer)

Which of the following mode of fopen() function opens a file only for writing. If a file with that name does not exist, attempts to create anew file. If the file exist, place the file pointer at the end of the file after all other data?

  1. A
  2. W
  3. W+
  4. A+
Question 11 Multiple Choice (Single Answer)

The function setcookie( ) is used to:

  1. Declare cookie variables
  2. Store data in cookie variable
  3. Enable or disable cookie support
  4. All of the above
Question 12 Multiple Choice (Single Answer)

When you need to obtain the ASCII value of a character which of the following function you apply in PHP?

  1. chr( );
  2. asc( );
  3. ord( );
  4. val( );
Question 13 Multiple Choice (Single Answer)

The following piece of script will output:

  1. admin
  2. admin@psexam
  3. @psexam.com
  4. psexam.com
Question 14 Multiple Choice (Single Answer)

When compared to the compiled program, scripts run:

  1. Faster
  2. Slower
  3. The execution speed is similar
  4. All of above
Question 15 Multiple Choice (Single Answer)

The most portable version of PHP tag that is compatible to embed in XML or XHTML too is:

  1. <? ?>
  2. <script language=”php”> </script>
  3. <% %>
  4. <?php ?>
Question 16 Multiple Choice (Single Answer)

The output of ofllowing script would be $somerar=15; function ad it () { GLOBAL $somevar; $somerar++ ; echo "somerar is $somerar"; } addit ();

  1. somerar is 15
  2. somerar is 16
  3. somerar is 1
  4. error in code
Question 17 Multiple Choice (Single Answer)

Variable scope on which a variable does not loose its value when the function exists and use that value if the function is called again is:

  1. Local
  2. function parameter
  3. static
  4. None of above
Question 18 Multiple Choice (Single Answer)

Which of the following delimiting method is known as string Interpolation?

  1. delimited by single quote
  2. delimited by double quote
  3. delimited by <<< identifier
  4. All of above
Question 19 Multiple Choice (Single Answer)

Identify the variable scope that is not supported by PHP?

  1. Local variables
  2. Function parameters
  3. Hidden variables
  4. Global variables