Ask Question

What does $message contain after the following code executes?

$age = 19;

$score = 750;

if ($age > = 21 && $score > = 700) {

$message = 'Loan approved';

} else if ($age > = 21 && $score > = 650) {

$message = 'Cosigner needed.';

} else if ($age > = 18 && $score > = 680) {

$message = 'Two cosigners needed.';

} else {

$message = 'Loan denied.';

}

a. Loan approved.

b. Cosigner needed.

c. Two cosigners needed.

d. Load denied.

+2
Answers (1)
  1. 30 May, 09:00
    0
    c. Two cosigners needed.

    Explanation:

    In the first if condition,

    if ($age > = 21 && $score > = 700)

    The age variable is set to 19, which is not >=21, so this condition is false.

    In the second condition,

    else if ($age > = 21 && $score > = 650)

    Same story, age variable is equal to 19, which is not >=21, this condition is also false.

    In the third condition,

    else if ($age > = 18 && $score > = 680)

    age condition is true because 19 is >=18, and score condition is also true, because 750 is >=680. So this condition is true.

    Henceforth, variable message will contain the string "Two cosigners needed."
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “What does $message contain after the following code executes? $age = 19; $score = 750; if ($age > = 21 && $score > = 700) { $message = ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers