PHP MCQ Quiz Question with Answer (set 2)
Categories: PHP Interview questions and answers MCQ
PHP MCQ Quiz Question with Answer (set 2)
1) Which of the following is the use of strpos() function in PHP?
- The strpos() function is used to search for the spaces in a string
- The strpos() function is used to search for a number in a string
- The strpos() function is used to search for a character/text in a string
- The strpos() function is used to search for a capitalize character in a string
Answer: (c)
2) What does PEAR stands for?
- PHP extension and application repository
- PHP enhancement and application reduce
- PHP event and application repository
- None of the above
Answer: (a)
3) Which of the following is the correct way to create a function in PHP?
- Create myFunction()
- New_function myFunction()
- function myFunction()
- None of the above
Answer: (c)
4) Which of the following PHP function is used to generate unique id?
- id()
- mdid()
- uniqueid()
- None of the above
Answer: (c)
5) Which of the following is the correct way of defining a variable in PHP?
- $variable name = value;
- $variable_name = value;
- $variable_name = value
- $variable name as value;
Answer: (b)
6) Which of the following is the correct use of the strcmp() function in PHP?
- The strcmp() function is used to compare the strings excluding case
- The strcmp() function is used to compare the uppercase strings
- The strcmp() function is used to compare the lowercase strings
- The strcmp() function is used to compare the strings including case
Answer: (d)
7) What is the use of fopen() function in PHP?
- The fopen() function is used to open folders in PHP
- The fopen() function is used to open remote server
- The fopen() function is used to open files in PHP
- None of the above
Answer: (c)
8) What is the use of isset() function in PHP?
- The isset() function is used to check whether variable is set or not
- The isset() function is used to check whether the variable is free or not
- The isset() function is used to check whether the variable is string or not
- None of the above
Answer: (a)
9) What is the use of sprintf() function in PHP?
- The sprintf() function is used to print the output of program
- The sprintf() function is used to send output to variable
- Both of the above
- None of the above
Answer: (b)
10) Which of the following is the correct way to open the file "sample.txt" as readable?
- fopen("sample.txt", "r");
- fopen("sample.txt", "r+");
- fopen("sample.txt", "read");
- fopen("sample.txt");
Answer: (a)