PHP MCQ Test

PHP MCQ Test

Q1. Use the ___________ to delete the data inside the table, and not the table itself?

  1. DEOP TABLE
  2. DELETE TABLE
  3. TRUNCATE TABLE
  4. REMOVE TABLE

Right Answer: C

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

  1. The message
  2. The recipient
  3. The header
  4. The subject

Right Answer: D

Q3. Which of the following delimiter is ASP style?

  1. <% %>
  2. <? ?>
  3. <script language=”php”></script>
  4. All of the above

Right Answer: A

Q4. What is the purpose of basename() function in PHP?

  1. Returns the last accessed time of the file
  2. Returns the first accessed time of the file
  3. Strips of the path and returns the file name.
  4. Strips of the path the returns of the folder name.

Right Answer: C

Q5. In PHP, fgets() is used to read a file one line at a time.

  1. TRUE
  2. FALSE

Right Answer: A

Q6. Which of the following statement produce different output

  1. <? echo “this is php example”; ?>
  2. <P=”This is php example”;?>
  3. <?php echo “This is php example”; php?>
  4. <script language=”php”>print “This is php example”;</script>

Right Answer: C

Q7. Which of the following data type is compound datatype supported by PHP.

  1. Array
  2. String
  3. Float
  4. Boolean

Right Answer: A

Q8. Which of the following functions in PHP do not return a timestamp?

  1. time()
  2. date()
  3. strtotime()
  4. localtime()
  5. gmmktime()

Right Answer: BD

Q9. Which of the following are valid float values?

  1. 4.5678
  2. 4
  3. 7.00E+04
  4. All of the above

Right Answer: D

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

  1. % a
  2. % b
  3. % c
  4. % d

Right Answer: A

Q11. Transactions are used to treat sets of SQL statements atomically.

  1. TRUE
  2. FALSE

Right Answer: A

Q12. How does the identity operator ===compare two values in PHP?

  1. It converts them to common compatible data type and then compares the resulting values.
  2. It returns True only if they are both of the same type and value
  3. If the two values are strings, it performs a lexical comparison
  4. It based its comparison on the C strcmp function exclusively
  5. It converts both values to strings and compares them

Right Answer: B

Q13. Which of the following is not an SQL aggregate function?

  1. AVG
  2. SUM
  3. MIN
  4. MAX
  5. CURRENT_DATE()

Right Answer: E

Q14. The _____________ statement is used to delete a table in MySQL.

  1. DROP TABLE
  2. DELETE TABLE
  3. DEL TABLE
  4. REMOVE TABLE

Right Answer: A

Q15. The ____________function parses an English textual date or time into Unix timestamp in PHP.

  1. strtodate()
  2. stroftime()
  3. strtotime()
  4. str_to_time()

Right Answer: C

Q16. Which function(s) in PHP computes the difference of arrays?

  1. array_diff
  2. diff_array
  3. arrays_diff
  4. diff_arrays

Right Answer: A

Q17. ______________ Returns the time of sunrise for a given day / location in PHP.

  1. datesunrise()
  2. date_sunrise()
  3. date-sunrise()
  4. date.sunrise()

Right Answer: B

Q18. What is the difference between print() and echo() in PHP?

  1. echo can take multiple parameters where as print not
  2. print has a return value of 1 so it can be used in expressions where as echo has a void return type
  3. echo() can be used in the CLI version of PHP, while print() can’t
  4. print() can be used in the CLI version of PHP, while echo() can’t
  5. There’s no difference: both functions print out some text!

Right Answer: AB

Q19. The ___________ function is used to read a single character from a file in PHP.

  1. fgetc()
  2. fgets()
  3. fget()
  4. fgetf()

Right Answer: A

Q20. In PHP, which of the following(s) count elements in an array?

  1. count
  2. Sizeof
  3. Array_Count
  4. Count_array

Right Answer: AB

Advertisements

Please Login to Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s