0% found this document useful (0 votes)
391 views

PHP

The document is a quiz on PHP programming concepts with 25 multiple choice questions. Some of the questions cover PHP basics like what PHP stands for, PHP file extensions, PHP tags, PHP code editors, PHP versions, variables, operators, functions, conditional statements, and more. The correct answers to each question are also provided.

Uploaded by

skarthiphd
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
391 views

PHP

The document is a quiz on PHP programming concepts with 25 multiple choice questions. Some of the questions cover PHP basics like what PHP stands for, PHP file extensions, PHP tags, PHP code editors, PHP versions, variables, operators, functions, conditional statements, and more. The correct answers to each question are also provided.

Uploaded by

skarthiphd
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 14

Quiz Competition On

PHP Programming
Quiz Masters
BCA II Yrs.
1. What does PHP stand for?
i) Personal Home Page
ii) Hypertext Preprocessor
iii) Pretext Hypertext Processor
iv) Preprocessor Home Page

a) Both i) and iii)


b) Both ii) and iv)
c) Only ii)
d) Both i) and ii)

2. PHP files have a default file extension


of_______

a) .html
b) .xml
c) .php
d) .ph
3. A PHP script should start with
___ and end with ___
a) < php >
b) < ? php ?>
c) <? ?>
d) <?php ?>

4. Which of the following is/are a


PHP code editor?
i) Notepad
ii) Notepad++
iii) Adobe Dreamweaver
iv) PDT
a) Only iv)
b) All of the mentioned.
c) i), ii) and iii)
d) Only iii)
5. Which of the following must be
installed on your computer so as to
run PHP script?
i) Adobe Dreamweaver
ii) PHP
iii) Apache
iv) IIS
a) All of the mentioned.
b) Only ii)
c) ii) and iii)
d) ii), iii) and iv)

6. Which version of PHP introduced


Try/catch Exception?
a) PHP 4
b) PHP 5
c) PHP 5.3
d) PHP 6
7. We can use ___ to comment a single line?
i) /?
ii) //
iii) #
iv) /* */

a) Only ii)
b) i), iii) and iv)
c) ii), iii) and iv)
d) Both ii) and iv)

8. Which of the following php


statement/statements will store 111 in variable
num?
i) int $num = 111;
ii) int mum = 111;
iii) $num = 111;
iv) 111 = $num;

a) Both i) and ii)


b) All of the mentioned
c) Only iii)
d) Only i)
9. What will be the output of the following php
code?

<?php
$num = 1;
$num1 = 2;
print $num . "+". $num1;
?>

a) 3
b) 1+2
c) 1.+.2
d) Error

10. What will be the output of the following php


code?
advertisement

<?php
$num = "1";
$num1 = "2";
print $num+$num1;
?>

a) 3
b) 1+2
c) Error
d) 12
11. Which of following variables can be assigned a
value to it?
i) $3hello
ii) $_hello
iii) $this
iv) $This

a) All of the mentioned


b) Only ii)
c) ii), iii) and iv)
d) ii) and iv)

12. What will be the output of the following code?

<?php
$foo = 'Bob';
$bar = &$foo;
$bar = "My name is $bar";
echo $bar;
echo $foo;
?>

a) Error
b) My name is BobBob
c) My name is BobMy name is Bob
d) My name is Bob Bob
13. Which of the following PHP statements will
output Hello World on the screen?
i) echo (“Hello World”);
ii) print (“Hello World”);
iii) printf (“Hello World”);
iv) sprintf (“Hello World”);

a) i) and ii)
b) i), ii) and iii)
c) All of the mentioned
d) i), ii) and iv)

14. What will be the output of the following


PHP code?

<?php
$color = "maroon";
$var = $color[2];
echo "$var";
?>

a) a
b) Error
c) $var
d) r
15. What will be the output of the following PHP code?

<?php
$score = 1234;
$scoreboard = (array) $score;
echo $scoreboard[0];
?>

a) 1
b) Error
c) 1234
d) 2

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


advertisement

<?php
$total = "25 students";
$more = 10;
$total = $total + $more;
echo "$total";
?>

a) Error
b) 35 students
c) 35
d) 25 students
17. Which of the below
statements is equivalent to
$add += $add ?

a) $add = $add
b) $add = $add +$add
c) $add = $add + 1
d) $add = $add + $add + 1

18. Which statement will


output $x on the screen?

a) echo “\$x”;
b) echo “$$x”;
c) echo “/$x”;
d) echo “$x;”;
19. What will be the output of the following code?

<?php
function track() {
static $count = 0;
$count++;
echo $count;
}
track();
track();
track();
?>

a) 123
b) 111
c) 000
d) 011

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

<?php
$a = "clue";
$a .= "get";
echo "$a";
?>

a) get
b) true
c) false
d) clueget
21. What will be the output of the
following PHP code?

<?php
$a = 5;
$b = 5;
echo ($a === $b);
?>

a) 5 === 5
b) Error
c) 1
d) False

22. Which of the below symbols is a


newline character?
a) \r
b) \n
c) /n
d) /r
23. What will be the output of the following PHP
code?

<?php
$num = 10;
echo 'What is her age? \n She is $num years
old';
?>

a) What is her age? \n She is $num years old


b) What is her age?
She is $num years old
c) What is her age? She is 10 years old
d) What is her age?
She is 10 years old

24. Which of the conditional statements is/are


supported by PHP?
i) if statements
ii) if-else statements
iii) if-elseif statements
iv) switch statements

a) Only i)
b) i), ii) and iv)
c) ii), iii) and iv)
d) All of the mentioned.
25. What will be the output of the following PHP
code?

<?php
$team = "arsenal";
switch ($team) {
case "manu":
echo "I love man u";
case "arsenal":
echo "I love arsenal";
case "manc":
echo "I love manc"; }
?>

a) I love arsenal
b) Error
c) I love arsenalI love manc
d) I love arsenalI love mancI love manu

You might also like