Commerce

Basic Php MCQs

Practice Basic Php MCQs for competitive exams.

Basic Php MCQs

Practice questions from this topic.

PHP does not support numbers written in hexadecimal, octal or scientific notation.

  1. A. True
  2. B. False
Report Error

String values must be enclosed in ......

  1. A. single quotes
  2. B. double quotes
  3. C. both A and B
  4. D. none of above
Report Error

When a simple data type is casted to an array, an array is created with the original value in the first element.

  1. A. True
  2. B. False
Report Error

If you echo a Boolean variable, the value FALSE displays as a .... and the value TRUE echoes as a .....

  1. A. 0, 1
  2. B. blank string, 2
  3. C. empty variable, 1
  4. D. blank string, 1
Report Error

Assigning the empty string (like ' ') to a variable automatically renders it empty.

  1. A. True
  2. B. False
Report Error

You can test the type of any variable with the ..... function.

  1. A. whattype()
  2. B. showtype()
  3. C. gettype()
  4. D. settype()
Report Error

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

  1. A. True
  2. B. False
Report Error

Which of the following is not valid PHP code?

  1. A. $_10
  2. B. ${“MyVar”}
  3. C. &$something
  4. D. $10_somethings E. $aVaR
Report Error

PHP is an open source software.

  1. A. True
  2. B. False
Report Error

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

  1. A. Pond-sign
  2. B. Yen-sign
  3. C. Dollar-sign
  4. D. Euro-sign
Report Error

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

  1. A. When the parameter is Boolean
  2. B. When the function is being declared as a member of a class
  3. C. When the parameter is being declared as passed by reference
  4. D. When the function contains only one parameter E. Never
Report Error

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

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