PHP MCQs with answers Page - 10

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
echo "This","was"|"a","bad"."idea";
?>
  • (A) Thiswasabadidea
  • (B) Thiswasbadidea
  • (C) Thiswas a badidea
  • (D) Thiswas abadidea

A

Admin • 831.35K Points
Coach

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

Code:
<?php
$one = "Hello";
$two = "World";
echo $one, $two;
?>
  • (A) Hello World
  • (B) Hello
  • (C) World
  • (D) HelloWorld

A

Admin • 831.35K Points
Coach

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

Code:
<?php
$one = "Hello";
$two = "World";
echo "$one$two";
?>
  • (A) HelloWorld
  • (B) $one$two
  • (C) Hello
  • (D) Error

A

Admin • 831.35K Points
Coach

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

Code:
<?php
$one = "Hello";
$two = "World";
echo "$one"+"$two";
?>
  • (A) HelloWorld
  • (B) Hello+World
  • (C) 0
  • (D) Error

A

Admin • 831.35K Points
Coach

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

Code:
<?php
echo "This is India";
?>
  • (A) This is India
  • (B) This is India
  • (C) This is
  • (D) Error

A

Admin • 831.35K Points
Coach

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

Code:
<?php
$cars = array("Volvo", "BMW", "Toyota");
echo "My car is a {$cars[0]}";
?>
  • (A) My car is a Volvo
  • (B) My car is a BMW
  • (C) My car is a Toyota
  • (D) Error

A

Admin • 831.35K Points
Coach

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

Code:
<?php
$Country1 = "INDIA";
$Country2 = "1";
$Country3 = "USA";
echo "$Country1" + "$Country2" . "$Country3";
?>
  • (A) USA
  • (B) INDIA
  • (C) INDIA1
  • (D) 1USA

A

Admin • 831.35K Points
Coach

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

Code:
<?php
$Country1 = "1";
$Country2 = "1";
echo "$Country1" + "$Country2";
?>
  • (A) 2
  • (B) 11
  • (C) 0
  • (D) 1

A

Admin • 831.35K Points
Coach

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

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

A

Admin • 831.35K Points
Coach

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

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

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