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