PHP Echo & Print MCQs

PHP Echo & Print MCQs : This section focuses on "Echo and Print" in PHP. These Multiple Choice Questions (mcq) should be practiced to improve the PHP skills required for various interviews (campus interview, walk-in interview, company interview), placements, entrance exams and other competitive examinations.

1. How many ways user can print output in PHP?

A. 1
B. 2
C. 3
D. 4

View Answer


2. print statement can take _____ argument?

A. 1
B. 2
C. 3
D. 4

View Answer


3. How many return value does echo statement has?

A. 1
B. 2
C. 3
D. 0

View Answer


4. Echo statement is written under parentheses?

A. True
B. False
C. Only for string it written under parentheses
D. Only for variable it written under parentheses

View Answer


5. Which statement is faster amoung echo and print?

A. echo
B. print
C. echo and print has same speed
D. None of the above

View Answer


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

<?php
echo "Hello world </br> I am learning PHP at letsfindcourse";
?>

A. Hello world
B. Hello world I am learning PHP at letsfindcourse
C. Hello world
I am learning PHP at letsfindcourse
D. Error

View Answer


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

<?php
$five = 5;
print($five);
print $five;
?>

A. 05
B. 55
C. 50
D. Error

View Answer


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

<?php
$a = "Hello";
$b = "World";
echo "$a"+"$b";
?>

A. HelloWorld
B. Hello+World
C. 0
D. Error

View Answer


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

<?php
$a = "hello";
$b = "world";
print($a$b);
?>

A. helloworld
B. hello
C. Nothing
D. error

View Answer


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

<?php
print("I"."am"."learning"."php");
?>

A. Iamlearningphp
B. I am learning php
C. Nothing
D. error

View Answer


11. which of the following is correct echo statement?

A. echo "<h2>PHP is Fun!</h2>";
B. echo "PHP is Fun!<br>";
C. echo "PHP ", "is ", "Fun!";
D. All of the above

View Answer


12. which of the following is correct print statement?

A. print "<h2>PHP is Fun!</h2>";
B. print "PHP is Fun!<br>";
C. print "PHP ", "is ", "Fun!";
D. All of the above

View Answer


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

<?php
echo "This is <i>Letsfindcourse</i>";
?>

A. This is Letsfindcourse
B. This is Letsfindcourse(Letsfindcourse in italic)
C. This is
D. Error

View Answer


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

<?php
$arr = array('0' => "Letsfindcourse", 
             '1' => "Computer",  
             '2' => "Science", 
             '3' => "Portal"); 

print_r($arr[-1]); 
?>

A. Portal
B. Letsfindcourse
C. Error
D. No Output

View Answer


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

<?php
$arr = array('0' => "Letsfindcourse", 
             '1' => "Computer",  
             '2' => "Science", 
             '3' => "Portal"); 

print_r($arr[0]); 
?>

A. Portal
B. Letsfindcourse
C. Error
D. No Output

View Answer


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

<?php
echo 'This is  "letsfindcourse"' ;
?>

A. This is letsfindcourse
B. This is "letsfindcourse"
C. Error
D. No Output

View Answer


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

<?php
echo "This is  "echo statement" ";
?>

A. This is "echo statement"
B. echo statement
C. Error
D. No Output

View Answer


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

<?php
echo "This","is"|"a","PHP"."MCQs";
?>

A. ThisisaPHPMCQs
B. ThisisPHPMCQs
C. Thisis a PHPMCQs
D. Thisis aPHPMCQS

View Answer


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

<?php
echo "This","is"&"a","PHP"."MCQs";
?>

A. ThisisaPHPMCQs
B. Thisis PHPMCQs
C. This aPHPMCQS
D. ThisaPHPMCQs

View Answer


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

<?php
echo "This","is"@"a","PHP"."MCQs";
?>

A. Thisis@aPHPMCQs
B. ThisaPHPMCQs
C. No Output
D. Error

View Answer





Also check :


Discussion



* You must be logged in to add comment.