Web Programming (3160713) MCQs

MCQs of Server Side Programmingwith PHP

Showing 1 to 10 out of 49 Questions
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)
Answer:

Option (d)

2.
PHP files have a default file extension of_______
(a) .html
(b) .php
(c) .prepro
(d) .phpe
Answer:

Option (b)

3.
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) i), ii), iii) and iv)
(c) Only iii)
(d) Only i)
Answer:

Option (c)

4.
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
Answer:

Option (b)

5.
Which is the correct variable name : i) $3hello ii) $_hello iii) $this iv) $This
(a) Only ii)
(b) Only iii)
(c) ii), iii) and iv)
(d) ii) and iv)
Answer:

Option (d)

6.
"What will be the output of the following PHP 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
Answer:

Option (c)

7.
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
Answer:

Option (d)

8.
What will be the output of the following PHP code?
  <?php
    $total = "25 students";
    $more = 10;
    $total = $total + $more;
    echo "$total";
    ?>
(a) Error
(b) 35 students
(c) 35
(d) 25 students
Answer:

Option (c)

9.
What will be the output of the following PHP code?
   <?php
    $team = "rajkot";
    switch ($team) {
    case "ahemdabad":
        echo "I love ahemdabad";
    case "rajkot":
        echo "I love rajkot";
    case "morbi":
        echo "I love morbi"; }
    ?>
(a) I love rajkot
(b) I love morbi
(c) Error
(d) I love rajkot I love morbi
Answer:

Option (d)

10.
What will be the output of the following PHP code?
<?php
    $user = array("Ashley", "Bale", "Shrek", "Blank");
    for ($x=0; $x < count($user); $x++) {
        if ($user[$x] == "Shrek") continue;
            printf ($user[$x]); 
    }
    ?> 
(a) AshleyBale
(b) AshleyBaleBlank
(c) ShrekBlank
(d) Shrek
Answer:

Option (b)

Showing 1 to 10 out of 49 Questions