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