CommerceBasic 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.
- A. True
- B. False
Correct Answer: B
String values must be enclosed in ......
- A. single quotes
- B. double quotes
- C. both A and B
- D. none of above
Correct Answer: C
When a simple data type is casted to an array, an array is created with the original value in the first element.
- A. True
- B. False
Correct Answer: A
If you echo a Boolean variable, the value FALSE displays as a .... and the value TRUE echoes as a .....
- A. 0, 1
- B. blank string, 2
- C. empty variable, 1
- D. blank string, 1
Correct Answer: D
Assigning the empty string (like ' ') to a variable automatically renders it empty.
- A. True
- B. False
Correct Answer: B
You can test the type of any variable with the ..... function.
- A. whattype()
- B. showtype()
- C. gettype()
- D. settype()
Correct Answer: C
PHP runs on different platforms (Windows, Linux, Unix, etc.)
- A. True
- B. False
Correct Answer: A
Which of the following is not valid PHP code?
- A. $_10
- B. ${“MyVar”}
- C. &$something
- D. $10_somethings E. $aVaR
Correct Answer: D
PHP is an open source software.
- A. True
- B. False
Correct Answer: A
Variables always start with a ........ in PHP
- A. Pond-sign
- B. Yen-sign
- C. Dollar-sign
- D. Euro-sign
Correct Answer: C
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 parameter is being declared as passed by reference
- D. When the function contains only one parameter E. Never
Correct Answer: C
How does the identity operator === compare two values?
- A. It converts them to a common compatible data type and then compares the resulting values
- B. It returns True only if they are both of the same type and value
- C. If the two values are strings, it performs a lexical comparison
- D. It bases its comparison on the C strcmp function exclusively E. It converts both values to strings and compares them
Correct Answer: A