What will the following function call print?
printf('%010.6f', 22);
Suggested Answer: C
Get Premium 200-710 Questions
as Interactive Web-Based Practice Test or PDF
Real Exam Format
Detailed Explanations
Instant Access
Get Your Practice Test
37 comments · newest first
BA
Barbra
11 months ago
No way, it should just be 22!
EL
Eliseo
12 months ago
Wait, why does it have leading zeros?
HI
Hillary
12 months ago
I thought it would be C at first.
LE
Leota
1 year ago
Definitely option D!
TA
Tamar
1 year ago
It will print 22.000000.
CA
Caitlin
1 year ago
I feel like it should be "22.000000" since the total width is 10, but I can't recall if the leading zeros apply to the whole number or just the integer part.
TA
Tayna
1 year ago
I'm a bit confused about the leading zeros. Does it mean it will print "022.000000"? That sounds familiar.
EL
Elvera
1 year ago
I remember practicing something similar, and I think it might print "22.000000" because of the .6f specifier.
LI
Lizette
1 year ago
I think the function call will format the number with leading zeros, but I'm not sure if it will include the decimal part.
PO
Portia
1 year ago
I've got this! The answer is D. The printf function will convert the integer 22 to a floating-point number and print it with 6 decimal places, padded with zeros to make it 10 characters wide.
MA
Marnie
1 year ago
Wait, is the answer C? I'm a bit confused, I thought the printf function would just print the integer value as is.
JE
Jeannetta
1 year ago
Okay, I think I know this one. The format specifier '%010.6f' will print the number with 10 total characters, including 6 decimal places, and pad the left side with zeros.
DO
Dorothy
1 year ago
Hmm, this looks like a formatting question. I'll need to think carefully about the printf format specifier and how it will handle the integer value of 22.
NI
Nieves
2 years ago
Ah, the age-old question: how many zeros can you fit in front of a number before it becomes a completely different number? The answer is 'as many as you want, as long as you're feeling lucky'.
RI
Rickie
2 years ago
Wait, why are we printing the value of '22' to 6 decimal places? Is this some kind of secret code to unlock the secrets of the universe?
YO
Youlanda
2 years ago
D) 22.000000
RO
Royce
2 years ago
C) 022.000000
RE
Reita
2 years ago
B) 22.00
JI
Jillian
2 years ago
D) 22.000000
LA
Lavonda
2 years ago
C) 022.000000
YV
Yvonne
2 years ago
A) 22
TA
Tandra
2 years ago
B) 22.00
MI
Milly
2 years ago
A) 22
TA
Tayna
2 years ago
I'm not sure, but I think it's A) 22
OZ
Ozell
2 years ago
Hold on, is this a trick question? What if the function is actually supposed to print '22.000000' but the formatting is just really weird? I'll go with B, just to be safe.
NA
Natalie
2 years ago
I believe it will print 022.000000
LO
Lovetta
2 years ago
I'm not sure, but I think it will print 22.00
JO
Joaquin
2 years ago
I think it will print 22.000000
NI
Nickolas
2 years ago
This is too easy. The answer is clearly C. Who even needs to think about this?
PE
Peter
2 years ago
I believe it will print D) 22.000000
AD
Adolph
2 years ago
I think the answer is C) 022.000000
JU
Julio
2 years ago
I'm going with D. The function call is clearly asking for the value to be printed to 6 decimal places, and 22 is the correct answer.
RO
Rosann
2 years ago
Definitely C! That's the only option that matches the formatting specified in the function call.
BR
Brynn
2 years ago
D) 22.000000
WI
Wilda
2 years ago
C) 022.000000
SU
Sue
2 years ago
B) 22.00
LA
Lachelle
2 years ago
A) 22