PHP MCQ For Freshers & Experienced

  • Question 1) PHP’s numerically indexed array begin with position __.
  • Question 2) Which of the functions is used to sort an array in descending order?
  • Question 3) Which of the following PHP function will return true if a variable is an array or false if it is not an array?
  • Question 4) Which of the following array represents an array containing one or more arrays?
  • Question 5) Which of the following function can be used to get an array in the reverse order?
  • Question 6) Which one of the following PHP functions can be used to build a function that accepts any number of arguments?
  • Question 7) The filesize() function returns the file size in ___.
  • Question 8) Which one of the following function is capable of reading a file into a string variable?
  • Question 9) Which function sets the file filename’s last-modified and last-accessed times?
  • Question 10) Which one of the following is the right way of defining a function in PHP?
  • Question 11) The var_dump() function displays
  • Question 12) Which function is used to compare strings as strings in PHP ?
  • Question 13) Which of the following function returns the number of characters in a string variable?
  • Sharad Jaiswal
  • 03rd Jan, 2019
  • 394 Followers

PHP MCQ
Updated ON

03rd Jan, 2019

No. of Questions

30

Posted In

MCQ

Author

Sharad Jaiswal

PHP Multiple choice interview questions

Q1. PHP’s numerically indexed array begin with position __.

  • 1
  • 2
  • -1
View Answer
0
Like many programming languages, the first element of an array in PHP has an index value of 0.

Q2. Which of the functions is used to sort an array in descending order?

  • sort()
  • asort()
  • rsort()
  • dsort()
View Answer
rsort()

Q3. Which of the following PHP function will return true if a variable is an array or false if it is not an array?

  • this_array()
  • is_array()
  • do_array()
  • in_array()
View Answer
is_array()

Q4. Which of the following array represents an array containing one or more arrays?

  • Numeric Array
  • Associative Array
  • Multidimentional Array
  • None of the above.
View Answer
Multidimentional Array

Q5. Which of the following function can be used to get an array in the reverse order?

  • array_reverse()
  • array_search()
  • array_shift()
  • array_slice()
View Answer
array_reverse()

Q6. Which one of the following PHP functions can be used to build a function that accepts any number of arguments?

  • func_get_argc()
  • func_get_argv()
  • get_argv()
  • get_argc()
View Answer
func_get_argc()

Q7. The filesize() function returns the file size in ___.

  • bits
  • bytes
  • kilobytes
  • gigabytes

Q8. Which one of the following function is capable of reading a file into a string variable?

  • file_contents()
  • file_get_contents()
  • file_content()
  • file_get_content()
View Answer
file_get_contents()

Q9. Which function sets the file filename’s last-modified and last-accessed times?

  • sets()
  • set()C.
  • touch()
  • touched()
View Answer
touch()

Q10. Which one of the following is the right way of defining a function in PHP?

  • function { function body }
  • data type functionName(parameters) { function body }
  • functionName(parameters) { function body }
  • function functionName(parameters) { function body }
View Answer
function fumctionName(parameters) { function body }

Q11. The var_dump() function displays

  • the binary value of a variable
  • any PHP value in a human readable form
  • the whether a variable is empty or not
  • none of these above
View Answer
any PHP value in a human readable form

Q12. Which function is used to compare strings as strings in PHP ?

  • startswith()
  • strcmp()
  • compare()
  • compareTo()
View Answer
strcmp()

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

  • count($variable)
  • len($variable)
  • strcount($variable)
  • strlen($variable)
View Answer
strlen($variable)

Q14. PHP function arguments are modified in function definition and

  • In a function call
  • In execution time
  • In deceleration time
  • None of them
View Answer
In a function call

Q15. How many ways that PHP offers to modify arguments of a function?

  • 1
  • 2
  • 3
  • 4

Q16. What is included in phpinfo ( ) function with release of PHP5.2.1 version?

  • A header tag
  • A footer tag
  • A Meta tag
  • None of them
View Answer
A Meta tag

Q17. Which is most important thing in configuration of PHP?

  • The php.ini file
  • Compile time options
  • Web server configuration
  • All of them
View Answer
All of them

Q18. Which of the following is the way to create comments in PHP?

  • // commented code to end of line
  • /* commented code here */
  • # commented code to end of line
  • all of the above
View Answer
all of the above

Q19. Which of the following differences are valid between PHP 4 and PHP 5?

  • Built-in native support for SQLite
  • Both a and c
  • improved MySQL support
  • Support for inheritance
View Answer
Both a and c

Q20. How do I create PHP arrays in a HTML <form>?

  • < input name= MyArray[]/>
  • < input ="MyArray[]" />
  • < input name="MyArray[]" />
  • < input MyArray[] />
View Answer
< input name="MyArray[]" />

Q21. What is the purpose of $_SESSION[]?

  • Used to register a global variable
  • Used to initialize a session.
  • Used to store variables of the current session
  • none of the above
View Answer
Used to store variables of the current session

Q22. What is the difference between echo and print?

  • They both behave the same.
  • Print can take multiple parameters where as echo can not
  • Echo can take multiple parameters where as print can not
  • Print is a function where as echo is not.
View Answer
Echo can take multiple parameters where as print can not

Q23. Who is known as the father of PHP?

  • Willam Makepiece
  • Drek Kolkevi
  • Rasmus Lerdorf
  • List Barely
View Answer
Rasmus Lerdorf

Q24. PHP scripts are enclosed within _______

  • <php> . . . </php>
  • ?php . . . ?php
  • <p> . . . </p>
  • <?php . . . ?>
View Answer
<?php . . . ?>

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

  • Get
  • Post
  • Both
  • None

Q26. Which loop evaluates condition expression as Boolean, if it is true, it executes statements and when it is false it will terminate?

  • For loop
  • For each loop
  • While loop
  • All of them
View Answer
While loop

Q27. Unbounded loops repeats until some condition becomes

  • TRUE
  • False
  • Zero
  • Both A and B
View Answer
Both A and B

Q28. Loops that iterate for fixed number of times is called

  • Unbounded loops
  • Bounded loops
  • While loops
  • For loops
View Answer
Bounded loops

Q29. PHP files have a default file extension of.

  • .html
  • .xml
  • .php
  • .ph

Q30. A function in PHP which starts with __ (double underscore) is known as __________

  • Inbuilt Function
  • Magic Function
  • Default Function
  • User Defined Function
View Answer
Magic Function

About Author :

  • Author of PHP MCQ

    Sharad Jaiswal

    Sharad Jaiswal is Sr. Web Developer from Noida area. He have rich experience in PHP, Angular Js, React, javascript and Node .If you any query or project on these programming you can drop your enquiry in comment section.

Leave A Comment :

Valid name is required.

Valid name is required.

Valid email id is required.