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.

20 Questions Published

Questions

Question 1 Multiple Choice (Single Answer)

Which of the following variables is not a predefined variable?

  1. $get
  2. $ask
  3. $request
  4. $post
Question 2 Multiple Choice (Single Answer)

You can define a constant by using the define() function. Once a constant is defined

  1. You can define a constant by using the define() function. Once a constant is defined
  2. It can never be changed but can be undefined
  3. It can be changed but can not be undefined
  4. It can be changed and can be undefined
Question 3 Multiple Choice (Single Answer)

You can define a constant by using the define() function. Once a constant is defined

  1. You can define a constant by using the define() function. Once a constant is defined
  2. It can never be changed but can be undefined
  3. It can be changed but can not be undefined
  4. It can be changed and can be undefined
Question 4 Multiple Choice (Single Answer)

Which of the following function returns the number of characters in a string variable?

  1. count($variable)
  2. len($variable)
  3. strcount($variable)
  4. strlen($variable)
Question 5 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 6 Multiple Choice (Single Answer)

A variable $word is set to “HELLO WORLD”, which of the following script returns in title case?

  1. echo ucwords($word)
  2. echo ucwords(strtolower($word)
  3. echo ucfirst($word)
  4. echo ucfirst(strtolower($word)
Question 7 Multiple Choice (Single Answer)

The difference between include() and require()

  1. are different how they handle failure
  2. both are same in every aspects
  3. is include() produced a Fatal Error while require results in a Warning
  4. none of above
Question 8 Multiple Choice (Single Answer)

When a file is included the code it contains, behave for variable scope of the line on which the include occurs

  1. Any variable available at that line in the calling file will be available within the called file from that point
  2. Any variable available at that line in the calling file will not be available within the called file
  3. Variables are local in both called and calling files
  4. None of above
Question 9 Multiple Choice (Single Answer)

Which of the following method sends input to a script via a URL?

  1. Get
  2. Post
  3. Both
  4. None
Question 10 Multiple Choice (Single Answer)

Which of the following method is suitable when you need to send larger form submissions?

  1. Get
  2. Post
  3. Both Get and Post
  4. There is no direct way for larger form. You need to store them in a file and retrieve
Question 11 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. W
  2. W+
  3. A
  4. A+
Question 12 Multiple Choice (Single Answer)

The function setcookie( ) is used to

  1. Enable or disable cookie support
  2. Declare cookie variables
  3. Store data in cookie variable
  4. All of above
Question 13 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 14 Multiple Choice (Single Answer)

fopen($file_doc,”r+&rdquo opens a file for

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

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

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

mysql_connect( ) does not take following parameter

  1. database host
  2. user ID
  3. password
  4. database name
Question 17 Multiple Choice (Single Answer)

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. 1, 4, 2, 3, 5
  2. 4, 1, 2, 3, 5
  3. 1, 5, 4, 2, 1
  4. 4, 1, 3, 2, 5
Question 18 Multiple Choice (Single Answer)

Which of the following is not a session function?

  1. sssion_decode
  2. session_destroy
  3. session_id
  4. session_pw
Question 19 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 20 Multiple Choice (Single Answer)

Which of the following delimiter syntax is PHP's default delimiter syntax

  1. <? php ?>
  2. <% %>
  3. <? ?>
  4. <script language="php"> </script>