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?

  1. The strpos() function is used to search for the spaces in a string
  2. The strpos() function is used to search for a number in a string
  3. The strpos() function is used to search for a character/text in a string
  4. The strpos() function is used to search for a capitalize character in a string

Answer: (c) 

 

2) What does PEAR stands for?

  1. PHP extension and application repository
  2. PHP enhancement and application reduce
  3. PHP event and application repository
  4. None of the above

Answer: (a)

 

3) Which of the following is the correct way to create a function in PHP?

  1. Create myFunction()
  2. New_function myFunction()
  3. function myFunction()
  4. None of the above

Answer: (c) 

 

4) Which of the following PHP function is used to generate unique id?

  1. id()
  2. mdid()
  3. uniqueid()
  4. None of the above

Answer: (c)

 

5) Which of the following is the correct way of defining a variable in PHP?

  1. $variable name = value;
  2. $variable_name = value;
  3. $variable_name = value
  4. $variable name as value;

Answer: (b)

 

6) Which of the following is the correct use of the strcmp() function in PHP?

  1. The strcmp() function is used to compare the strings excluding case
  2. The strcmp() function is used to compare the uppercase strings
  3. The strcmp() function is used to compare the lowercase strings
  4. The strcmp() function is used to compare the strings including case

Answer: (d) 

 

7) What is the use of fopen() function in PHP?

  1. The fopen() function is used to open folders in PHP
  2. The fopen() function is used to open remote server
  3. The fopen() function is used to open files in PHP
  4. None of the above

Answer: (c)

 

8) What is the use of isset() function in PHP?

  1. The isset() function is used to check whether variable is set or not
  2. The isset() function is used to check whether the variable is free or not
  3. The isset() function is used to check whether the variable is string or not
  4. None of the above

Answer: (a)

 

9) What is the use of sprintf() function in PHP?

  1. The sprintf() function is used to print the output of program
  2. The sprintf() function is used to send output to variable
  3. Both of the above
  4. None of the above

Answer: (b)

 

10) Which of the following is the correct way to open the file "sample.txt" as readable?

  1. fopen("sample.txt", "r");
  2. fopen("sample.txt", "r+");
  3. fopen("sample.txt", "read");
  4. fopen("sample.txt");

Answer: (a)

Top articles
How to check version of php Published at:- Definition and Type of Python Comment Published at:- Pass by reference vs value Published at:- Python - Network Programming Published at:- PHP Installation on Mac OS X with Apache Published at:- PHP Installation on Windows XP 2000 and XP with IIS Published at:- PHP Installation on Windows XP 2000 & XP with Apache Published at:- PHP MCQ Quiz Question with Answer Published at:- PHP MCQ Quiz Question with Answer (set 2) Published at:- 5 Laravel Development Tools Developers Must Use Published at:- PHP and its use Published at:-
R4Rin Team
The content on R4Rin.com website is created by expert teams.