Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Be mindful some of these questions have \"error\" as an answer. What will be the

ID: 3803632 • Letter: B

Question

Be mindful some of these questions have "error" as an answer.

What will be the output of the following php code?

$bye = "Bye";

print $hello;"$bye";

?>

---------------------------------------------------------

   var $two = 2;

   print "$one / $two * $one / $two * $two";

?>

------------------------------------------------------------------

$num1 = 2;

print $num . "+". $num1 ;

?>

--------------------------------------------

   $num1 = "2";

   print $num+$num1 ;

?>

------------------------------------------------

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)

A. Both (i) and (ii)

B. All of the mentioned.

C. Only (iii)

D. Only (i)

Explanation / Answer

1.

E_NOTICE : type 8 -- Undefined variable: hello --

2.

syntax error, unexpected 'var' (T_VAR).

because:

Keyword var is only used in classes (in PHP). In the plain scope variables are automatically declared as you mention them. Just erase it, and it should work.

3.

Undefined variable: num

4

Undefined variable: num.

5.C only(iii)

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote