Explore topic-wise MCQs in Php.

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

51.

What will be the output of the following PHP code?
<?php
function Add($n1, $n2)
{
$total = $n1 + $n2;
echo chr($total);
}
$var = "Add";
$var(14, 41);
?>

A. 7
B. 41
C. 14
D. 55
E. None of these
Answer» B. 41
52.

What will be the output of the following PHP code?
<?php
function Add($n1, $n2)
{
$total = $n1 + $n2;
echo cos($total);
}
Add(10,-10);
?>

A. 0
B. 1
C. Error
D. Nothing
E. None of these
Answer» C. Error
53.

What will be the output of the following PHP code?
<?php
define("GREETING1","Welcome to interview mania!");
define("GREETING2","Welcome to interview mania!");
define("GREETING3","Welcome to interview mania!");
echo defined("GREETING");
?>

A. "GREETING Welcome to interview mania! " 3 times
B. Error
C. "Welcome to interview mania!" 3 times
D. Nothing
E. None of these
Answer» E. None of these
54.

What will be the output of the following PHP code?
<?php
echo lcfirst("HELLO FRIENDS");
?>

A. HELLO FRIENDS
B. hello friends
C. Hello Friends
D. hELLO FRIENDS
E. None of these
Answer» E. None of these
55.

What will be the output of the following PHP code?
<?php
echo lcfirst("WELCOME TO INTERVIEW MANIA!");
?>

A. WELCOME TO INTERVIEW MANIA!
B. welcome to interview mania!
C. Welcome To Interview Mania!
D. WELCOME to interview mania!
E. wELCOME TO INTERVIEW MANIA!
Answer» F.
56.

What will be the output of the following PHP code?
<?php
function fun($message)
{
echo "$message";
}
$var = "fun";
$var("Executed...");
?>

A. message
B. Error
C. Nothing
D. Executed...
E. None of these
Answer» E. None of these
57.

What will be the output of the following PHP code?
function fun($msg)
{
echo "$msg";
}
$var = "fun";
$var("This will execute...");
?>

A. $msg
B. This will execute...
C. Error
D. 0
E. None of these
Answer» C. Error