Web Application Development MCQs with Answers

Practice important Web Application Development MCQs with answers and explanations.

Multiple Choice Questions

Q31: Fill in the blank: A variable declared inside a function has _______ scope.
  • A: global
  • B: static
  • C: local
  • D: global
View Answer
C

Q32: Which function returns the length of a string in PHP?
  • A: str_word_count
  • B: strlen
  • C: strrev
  • D: strpos
View Answer
B

Q33: What will be the output of <?php echo strrev("Hello world!"); ?>?
  • A: Hello world!
  • B: !dlrow olleH
  • C: Error
  • D: Nothing
View Answer
B

Q34: Fill in the blank: To replace text within a string, which PHP function is used?
  • A: str_word_count
  • B: str_replace
  • C: strrev
  • D: strlen
View Answer
B

Q35: What is the purpose of the strpos() function in PHP?
  • A: To replace text within a string
  • B: To find the position of a substring in a string
  • C: To reverse a string
  • D: To count words in a string
View Answer
B

Q36: Which of the following is true about PHP's local variables?
  • A: They can be accessed from any part of the script
  • B: They are deleted when the function completes
  • C: They can be accessed globally
  • D: They are not used in PHP
View Answer
B

Q37: Fill in the blank: The define() function is used to create a _______ in PHP.
  • A: variable
  • B: constant
  • C: function
  • D: class
View Answer
B

Q38: What will the output be if <?php $x = 5; function myTest() { global $x; $x = 10; } myTest(); echo $x; ?> is executed?
  • A: 5
  • B: 10
  • C: Error
  • D: Nothing
View Answer
B

Q39: Which function counts the number of words in a string in PHP?
  • A: str_word_count
  • B: strlen
  • C: strrev
  • D: strpos
View Answer
A

Q40: Fill in the blank: To declare a PHP constant that is case-insensitive, use the define() function with the _______ parameter set to true.
  • A: name
  • B: case-insensitive
  • C: value
  • D: global
View Answer
B

Test Your Knowledge

Take a timed quiz on Web Application Development

🚀 Start Quiz Now