PHP MCQ Questions

PHP MCQ Questions

  • Sharad Jaiswal
  • 22nd Nov, 2021

We are introducing here the best PHP MCQ Questions, which are very popular & cover the latest and important topics of PHP (PHP Hypertext Preprocessor). This PHP MCQ Test contains the top 35 PHP Multiple Choice Questions and Answers, so practice these questions to check your final preparation for PHP Exams, Interviews & Placement Drives. When you choose an option for these questions, the green color belongs to the right option & the red color belongs to the wrong option.

PHP MCQ Questions with Answers

1) PHP’s numerically indexed array begin with position __.

  • A. 1
  • B.2
  • C.Zero
  • D.-1

2) Which of the functions is used to sort an array in descending order?

  • A. sort()
  • B.asort()
  • C.rsort()
  • D.dsort()

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

  • A. this_array()
  • B.is_array()
  • C.do_array()
  • D.in_array()

4) Which of the following array represents an array containing one or more arrays?

  • A. Numeric Array
  • B.Associative Array
  • C.Multidimentional Array
  • D.None of the above.

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

  • A. array_reverse()
  • B.array_search()
  • C.array_shift()
  • D.array_slice()

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

  • A. func_get_argc()
  • B.func_get_argv()
  • C.get_argv()
  • D.get_argc()

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

  • A. bits
  • B.bytes
  • C.kilobytes
  • D.gigabytes

8) Which one of the following function is capable of reading a file into a string variable?

  • A. file_contents()
  • B.file_get_contents()
  • C.file_content()
  • D.file_get_content()

9) Which function sets the file filename’s last-modified and last-accessed times?

  • A. sets()
  • B.set()C.
  • C.touch()
  • D.touched()

10) How to define a function in PHP?

  • A. Function { function body }
  • B.Data type functionName(parameters) { function body }
  • C.FunctionName(parameters) { function body }
  • D.Function functionName(parameters) { function body }

11) The var_dump() function displays

  • A. the binary value of a variable
  • B.any PHP value in a human readable form
  • C.the whether a variable is empty or not
  • D.none of these above

12) Which function is used to compare strings as strings in PHP ?

  • A. startswith()
  • B.strcmp()
  • C.compare()
  • D.compareTo()

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

  • A. count($variable)
  • B.len($variable)
  • C.strcount($variable)
  • D.strlen($variable)

14) PHP function arguments are modified in function definition and

  • A. In a function call
  • B.In execution time
  • C.In deceleration time
  • D.None of them

15) How many ways that PHP offers to modify arguments of a function?

  • A. 1
  • B.2
  • C.3
  • D.4

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

  • A. A header tag
  • B.A footer tag
  • C.A Meta tag
  • D.None of them

17) Which is most important thing in configuration of PHP?

  • A. The php.ini file
  • B.Compile time options
  • C.Web server configuration
  • D.All of them

18) Which of the following is the way to create comments in PHP?

  • A. // commented code to end of line
  • B./* commented code here */
  • C.# commented code to end of line
  • D.all of the above

19) Which of the following differences are valid between PHP 4 and PHP 5?

  • A. Built-in native support for SQLite
  • B.Both a and c
  • C.improved MySQL support
  • D.Support for inheritance

20) How do I create PHP arrays in a HTML <form>?

  • A. < input name= MyArray[]/>
  • B.< input ="MyArray[]" />
  • C.< input name="MyArray[]" />
  • D.< input MyArray[] />

21) What is the purpose of $_SESSION[]?

  • A. Used to register a global variable
  • B.Used to initialize a session.
  • C.Used to store variables of the current session
  • D.none of the above

22) What is the difference between echo and print?

  • A. They both behave the same.
  • B.Print can take multiple parameters where as echo can not
  • C.Echo can take multiple parameters where as print can not
  • D.Print is a function where as echo is not.

23) Who is known as the father of PHP?

  • A. Willam Makepiece
  • B.Drek Kolkevi
  • C.Rasmus Lerdorf
  • D.List Barely

24) PHP scripts are enclosed within _______

  • A. <:php> . . . <:/php>
  • B.?php . . . ?php
  • C.<:p> . . . <:/p>
  • D.<:?php . . . ?>

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

  • A. Get
  • B.Post
  • C.Both
  • D.None

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

  • A. For loop
  • B.For each loop
  • C.While loop
  • D.All of them

27) Unbounded loops repeats until some condition becomes

  • A. TRUE
  • B.False
  • C.Zero
  • D.Both A and B

28) Loops that iterate for fixed number of times is called

  • A. Unbounded loops
  • B.Bounded loops
  • C.While loops
  • D.For loops

29) PHP files have a default file extension of.

  • A. .html
  • B..xml
  • C..php
  • D..ph

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

  • A. Inbuilt Function
  • B.Magic Function
  • C.Default Function
  • D.User Defined Function

31) Which sign is used to access variable of variable in php?

  • A. $
  • B.$$
  • C.$|
  • D.#@

32) Which of following is not a Superglobals in PHP?

  • A. $_ENV
  • B.$_PUT
  • C.$_FILES
  • D.$_SERVER

33) Which function is used to get ASCII value of character in PHP?

  • A. val( )
  • B.chr( )
  • C.asc()
  • D.ascii()

34) unset() is used to unset a variable in PHP.

  • A. True
  • B.False

35) Type Hinting was introduced in which version of PHP?

  • A. PHP 4
  • B.PHP 5
  • C.PHP 5.3
  • D.PHP 6

Leave A Comment :

Valid name is required.

Valid name is required.

Valid email id is required.

Related MCQ/Quiz

01st
Feb
CICS MCQ
01st
Nov
C# Mcq Questions