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