PHP Programming Fundamentals
Tests knowledge of PHP variable scope, string manipulation, file handling, cookies, and email functions
Questions
Which of following commenting is supported by Php
- Single line c++ syntax - //
- Shell syntax - #
- Both of above
- None of above
Which of following function return 1 when output is successful?
- echo ( )
- print()
- both
- none
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?
- echo()
- print()
- Printf()
- none
Which of the following type specifier is invalid in printf() functions?
- %a
- %b
- %c
- %d
For integer data type PHP 5 and earlier supported?
- 8 bit integer value
- 16 bit integer value
- 32 bit integer value
- 64 bit integer value
In mail($param2, $param2, $param3, $param4), the $param2 contains:
- The message
- The subject
- The header
- The recipient
When uploading a file if the UPLOAD_ERR-OK contains value 0 it means?
- Uplaod is not successful, error occurred
- The file uploaded with success
- Uploaded file size is 0
- File upload progress is 0% completed
fopen($file_doc,"r+"); opens a file for?
- reading
- writing
- none of above
- both of above
To work with remote files in PHP you need to enable?
- allow_url_fopen
- allow_remote_files
- both of above
- none of above
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?
- A
- W
- W+
- A+
The function setcookie( ) is used to:
- Declare cookie variables
- Store data in cookie variable
- Enable or disable cookie support
- All of the above
When you need to obtain the ASCII value of a character which of the following function you apply in PHP?
- chr( );
- asc( );
- ord( );
- val( );
The following piece of script will output:
- admin
- admin@psexam
- @psexam.com
- psexam.com
When compared to the compiled program, scripts run:
- Faster
- Slower
- The execution speed is similar
- All of above
The most portable version of PHP tag that is compatible to embed in XML or XHTML too is:
- <? ?>
- <script language=”php”> </script>
- <% %>
- <?php ?>
The output of ofllowing script would be $somerar=15; function ad it () { GLOBAL $somevar; $somerar++ ; echo "somerar is $somerar"; } addit ();
- somerar is 15
- somerar is 16
- somerar is 1
- error in code
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:
- Local
- function parameter
- static
- None of above
Which of the following delimiting method is known as string Interpolation?
- delimited by single quote
- delimited by double quote
- delimited by <<< identifier
- All of above
Identify the variable scope that is not supported by PHP?
- Local variables
- Function parameters
- Hidden variables
- Global variables