Q. what is the output of below program?

Code:
<?php
    $numb = 0;
    while ( $numb <= 10 ){
        if ($numb % 2 == 0){
            echo "{$numb} Even . ";
        }else{
            echo  "{$numb} Odd . ";
        }
         $numb++;
    }

?>
  • (A) 0 Error. 1 Odd . 2 Even . 3 Odd . 4 Even . 5 Odd . 6 Even . 7 Odd . 8 Even . 9 Odd ..
  • (B) 0 Even . 1 Odd . 2 Even . 3 Odd . 4 Even . 5 Odd . 6 Even . 7 Odd . 8 Even . 9 Odd . 10 Even .
  • (C) 0 Even . 1 Odd . 2 Even . 3 Odd . 4 Even . 6 Even . 7 Odd . 8 Even . 9 Odd . 10 Even .
  • (D) 0 Odd . 1 Even . 2 Odd . 3 Even . 4 Odd . 5 Even . 6 Odd . 7 Even . 8 Odd . 9 Even .
πŸ’¬ Discuss
βœ… Correct Answer: (B) 0 Even . 1 Odd . 2 Even . 3 Odd . 4 Even . 5 Odd . 6 Even . 7 Odd . 8 Even . 9 Odd . 10 Even .

Q. what is the output of below program?

Code:
<?php
    function simple_interest ( $principal , $rate , $time){
        $result = $principal * $rate * $time / 100;
        echo $result;
        return $result;
    }
    simple_interest(2 , 2, 2)
  • (A) 8
  • (B) 80
  • (C) 0.08
  • (D) 0.008
πŸ’¬ Discuss
βœ… Correct Answer: (C) 0.08

Q. what is the output of below program?

Code:
<?php
$a=0;
$b=0;

for($i=0;$i<10;$i++)
{
      if(++$a<5 || $b++<7){  }
}
echo $a." ".$b;
?>
  • (A) 6 10
  • (B) 10 6
  • (C) 4 6
  • (D) 10 10
πŸ’¬ Discuss
βœ… Correct Answer: (B) 10 6

Q. what is the output of below program?

Code:
<?php
$a=0;
$b=0;

for($i=0;$i<10;$i++)
{
      if(++$a<5 && $b++<7){  }
}
echo $a." ".$b;
?>
  • (A) 6 4
  • (B) 4 10
  • (C) 10 4
  • (D) 10 10
πŸ’¬ Discuss
βœ… Correct Answer: (C) 10 4

Q. Which method is used to check the validation of a email address?

  • (A) CheckMail
  • (B) CheckAddress
  • (C) ValidateMail
  • (D) validateAddress
πŸ’¬ Discuss
βœ… Correct Answer: (D) validateAddress

Q. what is the output of below program?

Code:
<?php
$x = 4/5*3;
$y = 1/.3;
$x ^= $y;
$y ^= $x;
$x ^= $y;
echo "$x, $y";
?>
  • (A) 0, 3
  • (B) 0, 4
  • (C) 2, 3
  • (D) 3, 2
πŸ’¬ Discuss
βœ… Correct Answer: (D) 3, 2

Q. find the output of below code

Code:
<?php
class cppbuzz {
    public $var;

    function __construct() {
        return "cppbuzz";
    }
}

$cppbuzz = new cppbuzz;
echo $cppbuzz->var;
?>
  • (A) cppbuzz
  • (B) "cppbuzz"
  • (C) ""
  • (D) Nothing is printed
πŸ’¬ Discuss
βœ… Correct Answer: (D) Nothing is printed

Q. what is the output of below program?

Code:
<?php
function hello(){
    echo "hello";
    hello();
}

hello();
?>
  • (A) hello
  • (B) hello hello
  • (C) hello is printed infinite times
  • (D) Compilation Error
πŸ’¬ Discuss
βœ… Correct Answer: (C) hello is printed infinite times

Q. what is the output of below program?

Code:
<?php
$cars=array("Maruti","Honda","BMW");
echo strlen($cars[0]);
?>
  • (A) 1
  • (B) 3
  • (C) 6
  • (D) 8
πŸ’¬ Discuss
βœ… Correct Answer: (C) 6

Q. what is the output of below program?

Code:
<?php
$cars=array("Maruti","Honda","BMW");
echo strlen($cars);
?>
  • (A) 0
  • (B) 3
  • (C) 14
  • (D) Error
πŸ’¬ Discuss
βœ… Correct Answer: (D) Error