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