PHP MCQ Test
Q1. Use the ___________ to delete the data inside the table, and not the table itself?
- DEOP TABLE
- DELETE TABLE
- TRUNCATE TABLE
- REMOVE TABLE
Right Answer: C
Q2. In mail($param1, $param2, $param3, $param4), the $param2 contains:
- The message
- The recipient
- The header
- The subject
Right Answer: D
Q3. Which of the following delimiter is ASP style?
- <% %>
- <? ?>
- <script language=”php”></script>
- All of the above
Right Answer: A
Q4. What is the purpose of basename() function in PHP?
- Returns the last accessed time of the file
- Returns the first accessed time of the file
- Strips of the path and returns the file name.
- 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.
- TRUE
- FALSE
Right Answer: A
Q6. Which of the following statement produce different output
- <? echo “this is php example”; ?>
- <P=”This is php example”;?>
- <?php echo “This is php example”; php?>
- <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.
- Array
- String
- Float
- Boolean
Right Answer: A
Q8. Which of the following functions in PHP do not return a timestamp?
- time()
- date()
- strtotime()
- localtime()
- gmmktime()
Right Answer: BD
Q9. Which of the following are valid float values?
- 4.5678
- 4
- 7.00E+04
- All of the above
Right Answer: D
Q10. Which of the following type specifier is invalid in printf() functions.
- % a
- % b
- % c
- % d
Right Answer: A
Q11. Transactions are used to treat sets of SQL statements atomically.
- TRUE
- FALSE
Right Answer: A
Q12. How does the identity operator ===compare two values in PHP?
- It converts them to common compatible data type and then compares the resulting values.
- It returns True only if they are both of the same type and value
- If the two values are strings, it performs a lexical comparison
- It based its comparison on the C strcmp function exclusively
- It converts both values to strings and compares them
Right Answer: B
Q13. Which of the following is not an SQL aggregate function?
- AVG
- SUM
- MIN
- MAX
- CURRENT_DATE()
Right Answer: E
Q14. The _____________ statement is used to delete a table in MySQL.
- DROP TABLE
- DELETE TABLE
- DEL TABLE
- REMOVE TABLE
Right Answer: A
Q15. The ____________function parses an English textual date or time into Unix timestamp in PHP.
- strtodate()
- stroftime()
- strtotime()
- str_to_time()
Right Answer: C
Q16. Which function(s) in PHP computes the difference of arrays?
- array_diff
- diff_array
- arrays_diff
- diff_arrays
Right Answer: A
Q17. ______________ Returns the time of sunrise for a given day / location in PHP.
- datesunrise()
- date_sunrise()
- date-sunrise()
- date.sunrise()
Right Answer: B
Q18. What is the difference between print() and echo() in PHP?
- echo can take multiple parameters where as print not
- print has a return value of 1 so it can be used in expressions where as echo has a void return type
- echo() can be used in the CLI version of PHP, while print() can’t
- print() can be used in the CLI version of PHP, while echo() can’t
- 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.
- fgetc()
- fgets()
- fget()
- fgetf()
Right Answer: A
Q20. In PHP, which of the following(s) count elements in an array?
- count
- Sizeof
- Array_Count
- Count_array
Right Answer: AB