What is the output of the following code?
echo 0x33, ' monkeys sit on ', 011, ' trees.';
Suggested Answer: B
Get Premium 200-710 Questions
as Interactive Web-Based Practice Test or PDF
Real Exam Format
Detailed Explanations
Instant Access
Get Your Practice Test
29 comments · newest first
PA
Paola
11 months ago
Yeah, A is the right answer for sure!
GO
Goldie
12 months ago
Not sure about that, isn't 011 just 9 in decimal?
TI
Tien
12 months ago
Wait, how does 0x33 equal 33?
PA
Paris
1 year ago
I thought it would be B at first, but A makes more sense.
MA
Malissa
1 year ago
It's definitely A, 33 monkeys sit on 11 trees.
LY
Lynelle
1 year ago
I feel like the output should be straightforward, but I'm confused about how the numbers are being interpreted.
WI
Willis
1 year ago
I remember that `0x33` equals 51, but I can't recall how `011` converts. Could it be 9?
DE
Delila
1 year ago
I'm not sure about the `011` part. Is it octal? I feel like I've seen something similar in practice questions.
LA
Lajuana
1 year ago
I think the `0x33` is a hexadecimal number, so it should output 51, right?
EM
Emmett
1 year ago
Easy peasy! The hex value 0x33 is 51, and the octal value 011 is 9. So the output will be "51 monkeys sit on 9 trees."
PI
Pilar
1 year ago
Okay, I think I've got this. The hex value 0x33 is 51 in decimal, and the octal value 011 is 9 in decimal. So the output should be "51 monkeys sit on 9 trees."
CR
Craig
1 year ago
Hmm, I'm a bit confused by the mixed number formats. I'll need to double-check my understanding of how PHP handles different number representations.
ER
Erick
1 year ago
This looks like a tricky one. I'll need to carefully parse the hex and octal values to figure out the output.
JA
Jacklyn
2 years ago
I'm not sure, but I think the answer is B) 51 monkeys sit on 9 trees.
CR
Craig
2 years ago
I agree with Paulina, because 0x33 is equivalent to 51 in decimal and 011 is equivalent to 9.
DO
Dolores
2 years ago
Hmm, this is a tricky one. I'm leaning towards B, but I might need to phone a friend to be sure.
LU
Luke
2 years ago
C is the funniest answer, though not the right one. Where's the fun in just printing the numbers?
NI
Nina
2 years ago
C) monkeys sit on trees.
EL
Elly
2 years ago
B) 51 monkeys sit on 9 trees.
LA
Lajuana
2 years ago
A) 33 monkeys sit on 9 trees.
PA
Paulina
2 years ago
I think the output is A) 33 monkeys sit on 11 trees.
LY
Lyndia
2 years ago
D is the answer for sure. Hex and octal literals are printed as is, no conversion. I aced this type of question in my last exam!
RI
Ricarda
2 years ago
Nice job acing that type of question in your last exam!
AZ
Azalee
2 years ago
You're correct, D is the answer. Hex and octal literals are printed as is.
FA
Fannie
2 years ago
No, it's D) 0x33 monkeys sit on 011 trees.
AN
Andree
2 years ago
I think it's A) 33 monkeys sit on 11 trees.
FE
Felix
2 years ago
Option B seems correct, but I'm unsure about the hex and octal conversion. I'll have to double-check my notes on that.
DI
Dierdre
2 years ago
I'm not sure about the hex and octal conversion either. Let's review our notes.
TR
Truman
2 years ago
I think it's A) 33 monkeys sit on 11 trees.