Explore topic-wise MCQs in Php.

This section includes 16 Mcqs, each offering curated multiple-choice questions to sharpen your Php knowledge and support exam preparation. Choose a topic below to get started.

1.

What will be the output of the following PHP code ?
<?php
$Country1 = "INDIA";
$Country2 = "1";
$Country3 = "USA";
echo "$Country1" + "$Country2" . "$Country3";
?>

A. USA
B. INDIA
C. INDIA1
D. 1
E. 1USA
Answer» F.
2.

What will be the output of the following PHP code ?
<?php
$Country1 = "1";
$Country2 = "1";
echo "$Country1" + "$Country2";
?>

A. 2
B. 11
C. 0
D. 1
E. None of these
Answer» B. 11
3.

What will be the output of the following PHP code ?
<?php
$Country1 = "INDIA";
$Country2 = "1";
echo "$Country1" + "$Country2";
?>

A. INDIA
B. 1
C. INDIA 1
D. 0
E. None of these
Answer» C. INDIA 1
4.

What will be the output of the following PHP code ?
<?php
$Country1 = "INDIA";
$Country2 = "INDIA";
echo "$Country1" + "$Country2";
?>

A. INDIA
B. INDIA INDIA
C. Error
D. 0
E. None of these
Answer» E. None of these
5.

What will be the output of the following PHP code ?
<?php
$Country1 = "INDIA";
$Country2 = "USA";
echo "$Country1" + "$Country2";
?>

A. INDIA
B. 0
C. Error
D. USA
E. None of these
Answer» C. Error
6.

What will be the output of the following PHP code ?
<?php
$Team1 = "Chennai Super King";
$Team2 = "Mumbai Indian";
echo "$Team1 " . "$Team2";
?>

A. Chennai Super King
B. Error
C. Mumbai Indian
D. Nothing
E. Chennai Super King Mumbai Indian
Answer» F.
7.

What will be the output of the following PHP code ?
<?php
$name1= Ajit;
$name2= Rahul;
echo "$name1"."$name2";
?>

A. Ajit
B. Rahul
C. AjitRahul
D. Nothing
E. Error
Answer» F.
8.

What will be the output of the following PHP code ?
<?php
$Name = "Rahul";
$Name = "Ajit";
echo "$Name";
?>

A. Error
B. Rahul
C. Ajit
D. Nothing
E. None of these
Answer» D. Nothing
9.

What will be the output of the following PHP code ?
<?php
$Country= India;
echo "$Country" . India;
?>

A. nothing
B. error
C. India
D. IndiaIndia
E. None of these
Answer» C. India
10.

What will be the output of the following PHP code ?
<?php
$Name= Ajit;
echo " $Name";
?>

A. Ajit
B. Error
C. $Name
D. Nothing
E. None of these
Answer» D. Nothing
11.

What will be the output of the following PHP code ?
<?php
<?php
echo "Hello Interview Mania";
?>
?>

A. Nothing
B. Hello
C. Error
D. Hello Interview Mania
E. None of these
Answer» D. Hello Interview Mania
12.

What will be the output of the following PHP code ?
<?php
echo "echo "Hello Interview Mania"";
?>

A. Error
B. Hello Interview Mania
C. echo "Hello Interview Mania"
D. echo Hello Interview Mania
E. None of these
Answer» B. Hello Interview Mania
13.

What will be the output of the following PHP code ?
<?php
echo "Hello Interview Mania"
?>

A. Hello Interview Mania
B. Error
C. Nothing
D. Hello Interview Mania in italics
E. None of these
Answer» E. None of these
14.

What will be the output of the following PHP code ?
<?php
$country = "India";
echo "$country";
echo "$COUNTRY";
echo "$Country";
?>

A. Error
B. India
C. IndiaIndiaIndia
D. IndiaIndia
E. None of these
Answer» C. IndiaIndiaIndia
15.

What will be the output of the following PHP code ?
<?php
print_r "Hello Interview Mania"
?>

A. Hello Interview Mania
B. Missing semicolon error
C. Error
D. Nothing
E. None of these
Answer» D. Nothing
16.

What will be the output of the following PHP code ?
<?php
"Hello Interview Mania"
?>

A. Nothing
B. Hello Interview Mania
C. Missing semicolon error
D. Error
E. None of these
Answer» B. Hello Interview Mania