- 1. Which function returns the number of characters in a string?
A) Str_word_count() B) Strrev() C) Ucwords() D) Strlen()
- 2. Which function counts the number of words in a sentence or phrase?
A) Str_word_count() B) Strpos() C) Count() D) Lcfirst()
- 3. Which function reverses a string?
A) Strrev() B) Ucfirst() C) Strcmp() D) Implode()
- 4. Which function gives the position of a string in another string?
A) Strtolower() B) Ucwords() C) Count() D) Strpos()
- 5. Which function capitalizes the first letter of each word?
A) Ucfirst() B) Strtoupper() C) Ucwords() D) Strrev()
- 6. Which function converts a whole string to uppercase?
A) Implode() B) Strtoupper() C) Strtolower() D) Lcfirst()
- 7. Which function converts a whole string to lowercase?
A) Ucwords() B) Strtolower() C) Substr() D) Ucfirst()
- 8. Which function compares two strings for equality?
A) Strrev() B) Strlen() C) Count() D) Strcmp()
- 9. Which function extracts a portion of a string?
A) Strpos() B) Strtoupper() C) Ucwords() D) Substr()
- 10. Which function combines elements of an array into a string?
A) Strcmp() B) Implode() C) Count() D) Ucfirst()
- 11. Which function counts elements in an array?
A) Implode() B) Ucwords() C) Str_word_count() D) Count()
- 12. Which function makes only the first letter of a string lowercase?
A) Strtolower() B) Ucfirst() C) Ucwords() D) Lcfirst()
- 13. Which function makes only the first letter of a string uppercase?
A) Ucwords() B) Ucfirst() C) Strtoupper() D) Strrev()
- 14. Which loop type executes a block a fixed number of times?
A) for B) goto C) switch D) if
- 15. Which loop executes as long as a condition is true, checked before the first run?
A) while B) do...while C) if D) for
- 16. What is the result of this post-increment operation? $x = 5; $y = $x++;
A) $y = 6 B) $x = 3 C) $x = 4 D) $y = 5
- 17. What is the result of this post-decrement operation? $x = 10; $y = $x--;
A) $y = 11 B) $y = 9 C) $x = 10 D) $y = 10
- 18. What is the result of this pre-increment operation? $x = 3; $y = ++$x;
A) $y = 4 B) $y = 3 C) $y = 5 D) $x = 3
- 19. What is the result of this pre-decrement operation? $x = 10; $y = --$x;
A) $y = 9 B) $x = 9 C) $x = 10 D) $y = 10
|