PHP Questions and Answers – String – Part 2
This collection of PHP Multiple Choice Questions and Answers (MCQs): Quizzes & Practice Tests with Answer focuses on “String”.
1. Which function is used for replacing the entire string with an alternative string?
A Replace()
B Str_replace()
C Strrpos()
D Strstr()
2. Stristr() is same to Strstr() except that ______
A The comparison is case independent
B The comparison start from middle
C The comparison is case sensitive
D None of them
3. Which one of the following function is used to capitalize first letter of each word in a string?
A strtupper()
B strword()
C ucwords()
D ucfirst()
4. Strstr() function allow us to select a substring by its ______
A Position
B Numerical value
C Content
D None of them
5. Which one of the following function is used to remove blank space in a String?
A chop()
B rtrim()
C starts()
D Both A and B
6. If you want to check if a string is equal to another string which function you can use?
A strpos()
B str()
C strpid()
D All of them
7. What is the opposite function of explode()?
A str()
B impose()
C strtok()
D implode()
8. MD5 is not secure to store passwords because It__________
A generates output in hexadecimal values
B generates the same output string as given input string
C generates Boolean results
D None of them
9. A function that receives a filename as argument and returns a MD5 of that file
A md_file()
B md5()
C md5_file()
D digest_file()
10. Which one of the following function is used to receive a string as argument and returns a string that is stripped of all HTML and PHP tags?
A nl2br()
B strip()
C strip_tags()
D All of them