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