PHP Web Development Fundamentals
Test your knowledge of PHP fundamentals for web development including file handling, sessions, cookies, MySQL integration, HTTP methods, and string manipulation.
Questions
Which of the following variables is not a predefined variable?
- $get
- $ask
- $request
- $post
You can define a constant by using the define() function. Once a constant is defined
- You can define a constant by using the define() function. Once a constant is defined
- It can never be changed but can be undefined
- It can be changed but can not be undefined
- It can be changed and can be undefined
You can define a constant by using the define() function. Once a constant is defined
- You can define a constant by using the define() function. Once a constant is defined
- It can never be changed but can be undefined
- It can be changed but can not be undefined
- It can be changed and can be undefined
Which of the following function returns the number of characters in a string variable?
- count($variable)
- len($variable)
- strcount($variable)
- strlen($variable)
When you need to obtain the ASCII value of a character which of the following function you apply in PHP?
- chr( );
- asc( );
- ord( );
- val( );
A variable $word is set to “HELLO WORLD”, which of the following script returns in title case?
- echo ucwords($word)
- echo ucwords(strtolower($word)
- echo ucfirst($word)
- echo ucfirst(strtolower($word)
The difference between include() and require()
- are different how they handle failure
- both are same in every aspects
- is include() produced a Fatal Error while require results in a Warning
- none of above
When a file is included the code it contains, behave for variable scope of the line on which the include occurs
- Any variable available at that line in the calling file will be available within the called file from that point
- Any variable available at that line in the calling file will not be available within the called file
- Variables are local in both called and calling files
- None of above
Which of the following method sends input to a script via a URL?
- Get
- Post
- Both
- None
Which of the following method is suitable when you need to send larger form submissions?
- Get
- Post
- Both Get and Post
- There is no direct way for larger form. You need to store them in a file and retrieve
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.
- W
- W+
- A
- A+
The function setcookie( ) is used to
- Enable or disable cookie support
- Declare cookie variables
- Store data in cookie variable
- All 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
fopen($file_doc,”r+&rdquo opens a file for
- reading
- writing
- none of above
- both of above
In mail($param2, $param2, $param3, $param4), the $param2 contains
- The message
- The recipient
- The header
- The subject
mysql_connect( ) does not take following parameter
- database host
- user ID
- password
- 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
- 1, 4, 2, 3, 5
- 4, 1, 2, 3, 5
- 1, 5, 4, 2, 1
- 4, 1, 3, 2, 5
Which of the following is not a session function?
- sssion_decode
- session_destroy
- session_id
- session_pw
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
Which of the following delimiter syntax is PHP's default delimiter syntax
- <? php ?>
- <% %>
- <? ?>
- <script language="php"> </script>