PHP MCQ Questions and Answers

Take Exam

PHP MCQ Questions with Answers help candidates strengthen their programming fundamentals and web development logic through objective-style practice. These PHP programming questions and answers are essential for cracking technical interviews and online coding assessments conducted by top recruiters like TCS, Infosys, Cognizant, and Wipro. Each question tests key PHP concepts such as syntax, data types, arrays, functions, form handling, and error management. Practicing these programming MCQs not only enhances problem-solving speed but also builds confidence for real-time technical evaluations. Whether you are preparing for placement drives, semester exams, or web development roles, this PHP MCQ collection with explanations and solutions PDF will help you master PHP efficiently. Begin your programming test practice online now and ace your upcoming PHP interview round.

PHP MCQ

Showing 10 of 130 questions

31. A variable $word is set to "HELLO WORLD", which of the following script returns in title case?

  • echo ucwords($word)
  • echo ucwords(strtolower($word)
  • echo ucfirst($word)
  • echo ucfirst(strtolower($word)
Show Answer Report

32. The difference between include() and require()

  • are different how they handle failure
  • both are same in every aspects
  • is include() produced a Fatal Error while require results in a Warning
  • none of above
Show Answer Report

33. When a file is included the code it contains, behave for variable scope of the line on which the include occurs

  • Any variable available at that line in the calling file will be available within the called file from that point
  • Any variable available at that line in the calling file will not be available within the called file
  • Variables are local in both called and calling files
  • None of above
Show Answer Report

34. Which of the following method sends input to a script via a URL?

  • Get
  • Post
  • Both
  • None
Show Answer Report

35. Which of the following method is suitable when you need to send larger form submissions?

  • Get
  • Post
  • Both Get and Post
  • There is no direct way for larger form. You need to store them in a file and retrieve
Show Answer Report

36. Which of the following mode of fopen() function opens a file only for writing. If a file with that name does not exist, attempts to create anew file. If the file exist, place the file pointer at the end of the file after all other data.

  • W
  • W+
  • A
  • A+
Show Answer Report

37. The function setcookie( ) is used to

  • Enable or disable cookie support
  • Declare cookie variables
  • Store data in cookie variable
  • All of above
Show Answer Report

38. The function setcookie( ) is used to

  • To work with remote files in PHP you need to enable
  • allow_url_fopen
  • allow_remote_files
  • both of above
Show Answer Report

39. fopen($file_doc,"r+"Wink opens a file for

  • reading
  • writing
  • none of above
  • both of above
Show Answer Report

40. In mail($param2, $param2, $param3, $param4), the $param2 contains:

  • The message
  • The recipient
  • The header
  • The subject
Show Answer Report
Questions and Answers for Competitive Exams Various Entrance Test