Last date for submission



Download 35 Kb.
Date16.08.2021
Size35 Kb.
#57200
homeworkca

Home Work – Computer Application

PHP


Last date for submission : 13.5.2020

  1. Find the output for the following php code.



$a = “Computer Application!”;

$b= 59135;

$c = 19.15;

$d = true;

$e = false;

$cars = array(“Computer”,”Laptop”,”Mobile”);

$f= null;

var_dump($a);

echo “
”;


var_dump($b);

echo “
”;


var_dump($c);

echo “
”;


var_dump($d);

echo “
”;


var_dump($e);

echo “
”;


var_dump($f);

echo “
”;


var_dump($cars);

?>
2.

< ?php

$num = 1;

$num1 = 2;

print $num . “+”. $num1 ;

?>

3.



$a=array(“A”,”Cat”,”Dog”,”A”,”Dog”);

$b=array(“A”,”A”,”Cat”,”A”,”Tiger”);

$c=array_combine($a,$b);

print_r(array_count_values($c));

?>

4.



$teacher_name=array(“Iniyan”, “Kavin”, “Nilani”);

echo “The students name are “ . $teacher_name[0] . “, “ . $$teacher_name[1] . “ and “ .

$teacher_name[2] . “.”;

?>

5.



$student=array(array(“Iniyan”,100,96),array(“Kavin”,60,59),array(“Nilani”,1313,139));

echo $$student[0][0].”: Tamil Mark: “.$student [0][1].”

, English mark: “.$student [0][2].”
”;


echo $$student[1][0].”: Tamil Mark: “.$student [1][1].”

, English mark: “.$student [1][2].”
”;


echo $$student[2][0].”: Tamil Mark: “.$student [2][1].”

, English mark: “.$student [2][2].”
”;


?>

6.



$Pass_Mark=35;

$first_class=60;

$Student_Mark=70;

if ($Student_Mark>= $first_class){

echo “The Student is eligible for the promotion with First Class”;

}

elseif ($Student_Mark>= $Pass_Mark){

echo “The Student is eligible for the promotion”;

}

else {

echo “The Student is not eligible for the promotion”;

} ?>
7.



$favcolor = “red”;

switch ($favcolor) {

case “red”:

echo “Your favorite color is red!”;

break;

case “blue”:

echo “Your favorite color is blue!”;

break;

case “green”:

echo “Your favorite color is green!”;

break;

default:

echo “Your favorite color is neither red, blue, nor green!”;

}

?>

8.



$x;

if ($x)

print “hi” ;

else

print “how are u”;

?>

9.



$x = 0;

if ($x++)

print “hi”;

else

print “how are u”;

?>

10.



$x;

if ($x == 0)

print “hi” ;

else

print “how are u”;

print “hello”

?>

11.



for ($counter = 10; $counter < 10;

$counter = $counter + 5)

{

echo “Hello”;

}

12.



$x = 10;

$y = 20;

if ($x > $y + $y != 3)

print “hi” ;

else

print “how are u”;

?>

13.



if (-100)

print “hi” ;

else

print “how are u”;

?>

14.



$count=12;

do{

printf(“%d squared=%d
”,


$count, pow($count,2));

} while($count<4);

?>
15.



for ($x = -1; $x < 10;--$x)

{

print $x;

}

?>
Download 35 Kb.

Share with your friends:




The database is protected by copyright ©ininet.org 2024
send message

    Main page