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