PHP MCQs with answers Page - 11

Here, you will find a collection of MCQ questions on PHP. Go through these questions to enhance your preparation for upcoming examinations and interviews.

To check the correct answer, simply click the View Answer button provided for each question.

Have your own questions to contribute? Click the button below to share your MCQs with others!

+ Add Question

A

Admin • 831.35K Points
Coach

Q. What will be the output of the following PHP code ?

Code:
<?php
$Country1 = "INDIA";
$Country2 = "USA";
echo "$Country1" + "$Country2";
?>
  • (A) INDIA
  • (B) 0
  • (C) Error
  • (D) USA

A

Admin • 831.35K Points
Coach

Q. What will be the output of the following PHP code ?

Code:
<?php
$Team1 = "Chennai Super King";
$Team2 = "Mumbai Indian";
echo "$Team1 " . "$Team2";
?>
  • (A) Chennai Super King
  • (B) Error
  • (C) Mumbai Indian
  • (D) Chennai Super King Mumbai Indian

A

Admin • 831.35K Points
Coach

Q. What will be the output of the following PHP code ?

Code:
<?php
$name1= Ajit;
$name2= Rahul;
echo "$name1"."$name2";
?>
  • (A) Ajit
  • (B) Rahul
  • (C) AjitRahul
  • (D) Error

A

Admin • 831.35K Points
Coach

Q. What will be the output of the following PHP code ?

Code:
<?php
$Name = "Rahul";
$Name = "Ajit";
echo "$Name";
?>
  • (A) Error
  • (B) Rahul
  • (C) Ajit
  • (D) Nothing

A

Admin • 831.35K Points
Coach

Q. What will be the output of the following PHP code ?

Code:
<?php
$Country= India;
echo "$Country" . India;
?>
  • (A) nothing
  • (B) error
  • (C) India
  • (D) IndiaIndia

A

Admin • 831.35K Points
Coach

Q. What will be the output of the following PHP code ?

Code:
/*
echo "Hello MCQ Buddy";
*/
?>
  • (A) Nothing
  • (B) /* Hello MCQ Buddy */
  • (C) Hello MCQ Buddy
  • (D) Error

A

Admin • 831.35K Points
Coach

Q. What will be the output of the following PHP code ?

Code:
<?php
$Name= Ajit;
echo "$Name";
?>
  • (A) Ajit
  • (B) Error
  • (C) $Name
  • (D) Nothing

A

Admin • 831.35K Points
Coach

Q. What will be the output of the following PHP code ?

Code:
<?php
<?php
echo "Hello MCQ Buddy";
?>
?>
  • (A) Nothing
  • (B) Hello
  • (C) Error
  • (D) Hello MCQ Buddy

A

Admin • 831.35K Points
Coach

Q. What will be the output of the following PHP code ?

Code:
<?php
echo "echo "Hello MCQ Buddy"";
?>
  • (A) Error
  • (B) Hello MCQ Buddy
  • (C) echo "Hello MCQ Buddy"
  • (D) echo Hello MCQ Buddy

A

Admin • 831.35K Points
Coach

Q. What will be the output of the following PHP code ?

Code:
<?php
echo "Hello MCQ Buddy"
?>
  • (A) Hello MCQ Buddy
  • (B) Error
  • (C) Nothing
  • (D) None of these

Add MCQ in this Category

If you want to share an MCQ question in this category, it's a great idea! It will be helpful for many other students using this website.

Share Your MCQ