37.8k views
2 votes
B=1+4
echo $b
What's the output?
a) 5
b) 1+4
c) 4
d) Error

1 Answer

2 votes

Final answer:

The output of the given code is 1+4.

Step-by-step explanation:

The output of the given code is 1+4. When the code b=1+4 is executed, the value of b is assigned the sum of 1 and 4, which is 5. However, when we echo $b, it simply prints the value of b, that is, 1+4, as a string without evaluating it.

Therefore, the correct answer is (b) 1+4.

User Steve Pallen
by
8.2k points