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