Web Application Development MCQs with Answers
Practice important Web Application Development MCQs with answers and explanations.
Multiple Choice Questions
Q21: What data type is represented by $x = 10.365; in PHP?
- A: Integer
- B: Float
- C: String
- D: Boolean
View Answer
B
Q22: Fill in the blank: A PHP float number can be specified in _______ form.
- A: decimal, hexadecimal, octal
- B: only decimal
- C: only hexadecimal
- D: only octal
View Answer
A
Q23: Which statement about PHP objects is true?
- A: An object must be explicitly declared
- B: Objects are not used in PHP
- C: Objects are declared using var
- D: PHP objects are not allowed
View Answer
A
Q24: What will be the output of <?php $COLOR = "blue"; echo $color; ?>?
- A: blue
- B: Blue
- C: Nothing
- D: Error
View Answer
A
Q25: Fill in the blank: PHP supports data types such as string, integer, float, boolean, _______.
- A: array
- B: object
- C: NULL
- D: all of the above
View Answer
D
Q26: What is the purpose of the var_dump() function in PHP?
- A: To output variables with their type information
- B: To print strings
- C: To define variables
- D: To create objects
View Answer
A
Q27: What is the correct way to declare a PHP class?
- A: class ClassName {}
- B: declare class ClassName {}
- C: class ClassName()
- D: new ClassName {}
View Answer
A
Q28: What is the main feature of PHP as a loosely typed language?
- A: It requires explicit type declaration
- B: It automatically converts variable data types
- C: It uses static typing
- D: It requires manual type conversion
View Answer
B
Q29: Which keyword is used to access global variables within a function in PHP?
- A: local
- B: static
- C: global
- D: var
View Answer
C
Q30: What will be the output of <?php $x = "Pakistan"; echo $x; ?>?
- A: Pakistan
- B: Error
- C: 5
- D: Nothing
View Answer
A