11th
May
PHP MCQ

PHP MCQ

  • Admin
  • 11th May, 2021
  • 817 Followers

PHP MCQ Quiz & Online Test

Following are mostly asked Php MCQ test that are designed for professionals like you to crack you interviews. You can take this Php online test before appearing to you real interview. This Php quiz there are around 30+ multiple choice questions on Php with four options.

1) What PHP stands for?

  • A. Pre Hyper Processor
  • B. Pre Hypertext Processor
  • C. Hypertext Preprocessor
  • D. Pre Hypertext Process

2) How does the identity operator === compare two values?

  • A. It returns True only if they are both of the same type and value
  • B. If the two values are strings, it performs a lexical comparison
  • C. It bases its comparison on the C strcmp function exclusively
  • D. It converts them to a common compatible data type and then compares the resulting values

3) Under what circumstance is it impossible to assign a default value to a parameter while declaring a function?

  • A. When the parameter is Boolean
  • B. When the function is being declared as a member of a class
  • C. When the function contains only one parameter
  • D. When the parameter is being declared as passed by reference

4) Variables always start with a ........ in PHP

  • A. Pond-sign
  • B. Yen-sign
  • C. Euro-sign
  • D. Dollar-sign

5) PHP is an open source software

  • A. FALSE
  • B. TRUE
Download Free : PHP MCQ PDF

6) Which of the following is not valid PHP code?

  • A. $_10
  • B. ${?MyVar?}
  • C. &$something
  • D. $10_somethings

7) What is the difference between print() and echo()?

  • A. echo() can be used as part of an expression, while print() can?t
  • B. echo() can be used in the CLI version of PHP, while print() can?t
  • C. print() can be used in the CLI version of PHP, while echo() can?t
  • D. print() can be used as part of an expression, while echo() can?t

8) PHP runs on different platforms (Windows, Linux, Unix, etc.)

  • A. FALSE
  • B. TRUE

9) Array values are keyed by ______ values (called indexed arrays) or using ______ values (called associative arrays). Of course, these key methods can be combined as well.

  • A. String, Boolean
  • B. Even number, string
  • C. Positive number, negative number
  • D. Integer, string

10) Which array function checks if the specified key exists in the array

  • A. array_key_exist()
  • B. array_keys_exists()
  • C. arrays_key_exists()
  • D. array_key_exists()

11) There are three different kind of arrays:

  • A. Numeric array, String array, Multidimensional array
  • B. Numeric array, Associative array, Dimensional array
  • C. Const array, Associative array, Multidimensional array
  • D. Numeric array, Associative array, Multidimensional array

12) Absent any actual need for choosing one method over the other, does passing arrays by value to a read-only function reduce performance compared to passing them by reference?

  • A. Yes, because PHP must monitor the execution of the function to determine if
  • B. Yes, but only if the function modifies the contents of the array.
  • C. Yes, because the interpreter must always create a copy of the array before passing it to the function.
  • D. No

13) Assume you would like to sort an array in ascending order by value while preserving key associations. Which of the following PHP sorting functions would you use?

  • A. ksort()
  • B. sort()
  • C. usort()
  • D. asort()

14) What function computes the difference of arrays?

  • A. diff_array
  • B. arrays_diff
  • C. diff_arrays
  • D. array_diff

15) What functions count elements in an array?

  • A. Sizeof
  • B. Array_Count
  • C. Count_array
  • D. count

16) What array will you get if you convert an object to an array?

  • A. An array with properties of that array as the object's elements
  • B. An array with properties of that object as the Key elements
  • C. An array with keys of that object as the array's elements
  • D. An array with properties of that object as the array's elements

17) PHP sessions are created using the . . . . . function

  • A. session_starts()
  • B. sessions_start()
  • C. none of above
  • D. session_start()

18) When you want to store user data in a session use the . . . . array

  • A. SYS_SESSION
  • B. $SESSION
  • C. $_SESSIONS
  • D. $_SESSION

19) Sessions allow you to

  • A. store persistent user preference on a site
  • B. save user authentication information from page to page
  • C. create multipage forms
  • D. all of above

20) A snapshot of the session data can be taken at any time and written out to a file

  • A. FALSE
  • B. TRUE

21) When the session data is written to a file, it can be read back, decoded and applied to the current session using the . . . . function

  • A. session_encode()
  • B. session_get_cookie_params()
  • C. session_reset()
  • D. session_decode()

22) session_destroy() instantly destroy elements of the $_SESSION array

  • A. TRUE
  • B. FALSE

23) Appending session data to an absolute URL does not represent a security risk

  • A. TRUE
  • B. FALSE

24) If the php.ini register_globals directive is set, session data becomes available in the . . . . namespace

  • A. Local
  • B. Global

25) No expiry date is set in the cookie that PHP sets for the session. The session remains current only as long as the browser is active. When the browser is restarted the cookie is not stored. This behavior can be changed by altering . . . . . setting in php.ini file

  • A. cookie_lifetime
  • B. session.cookie_life_time
  • C. cookie_life_time
  • D. session.cookie_lifetime

26) session_destroy() erases all session variable

  • A. FALSE
  • B. TRUE

27) In PHP the integer 45 is stored exactly as 45. The floating point number 46.3 could be stored as

  • A. 46.3
  • B. 46.2999
  • C. none of above
  • D. 46

28) The static members in traits are linked to whichever . . . . uses them, rather than the trait itself

  • A. method
  • B. properties
  • C. none of above
  • D. class

29) There can be situations where a class uses two traits with the same method and this may cause the code to throw an error. To avoid errors like this, you can use the operator . . . . . .

  • A. identity
  • B. union
  • C. xor
  • D. insteadof

30) Traits can be further composed of other traits, even supporting the . . . . . . .

  • A. constants
  • B. abstract members
  • C. none of above
  • D. static members

Leave A Comment :

Valid name is required.

Valid name is required.

Valid email id is required.

Related MCQ/Quiz

01st
May
AngularJs MCQ
01st
May
jQuery MCQ
01st
May
Asp.Net Mcq
01st
May
GIT MCQ
01st
Apr
Xml MCQ