23rd
Jan
PHP MCQ

PHP MCQ

  • Admin
  • 23rd Jan, 2021
  • 462 Followers

PHP MCQ Quiz & Online Test

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

  • A. TRUE
  • B. FALSE

2) PHP is an open source software

  • A. FALSE
  • B. TRUE

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

  • A. FALSE
  • B. TRUE

4) What function computes the difference of arrays?

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

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

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

6) 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

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

  • A. TRUE
  • B. FALSE

8) 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

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

  • A. Local
  • B. Global

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) What functions count elements in an array?

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

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

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

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

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

14) What PHP stands for?

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

15) 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

16) session_destroy() erases all session variable

  • A. FALSE
  • B. TRUE

17) 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

18) 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

19) 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

20) 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

21) 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

22) 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()

23) 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

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

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

25) 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

26) 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()

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) 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

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

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

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

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

Leave A Comment :

Valid name is required.

Valid name is required.

Valid email id is required.

Related MCQ/Quiz

01st
Dec
Laravel MCQ
01st
Dec
React JS MCQ
01st
Jan
AngularJs MCQ
01st
Jul
Node js MCQ
01st
Jul
Angular 2 MCQ
01st
Jul
JSON MCQ