PAGETURNER
SOMECLEAN
ENCORE1
CLEAN
BOX
SOLUTION
GO
Let's pretend to be the C compiler
in solving this problem.
Assume that we are given 4 (four) variables:
char name[]; with value of c_class
int a; with value of 27
float b; with value of 137.6
char c; with value of K
Using the variable a as the argument,
please type in the result produced with
the format specifier %5d:
12345
Enter here:
That is correct!
You've got it on the 2nd try.
You've got it finally!
Think about it; the result is right-justified.
You should have 3 blanks followed by 27
12345
FORGET1
The correct choice is 27
12345
Using the variable a as the argument,
please type in the result produced with
the format specifier %7o:
1234567
Enter here:
That is correct!
You've got it on the 2nd try.
You've got it finally!
Think about it; the result is right-justified.
You should have 5 blanks followed by 33
1234567
FORGET2
The correct choice is 33
1234567
Using the variable a as the argument
please type in the result produced with
the format specifier %5x:
12345
Enter here:
That is correct!
You've got it on the 2nd try.
You've got it finally!
Think about it; what is the hex value of 27 decimal?
You should have 3 blanks followed by 1b
12345
FORGET3
The correct choice is 1b
12345
Using the variable a as the argument,
please type in the result produced with
the format specifier %5u:
12345
Enter here:
That is correct!
You've got it on the 2nd try.
You've got it finally!
Think about it; u stands for unsigned, i.e., integer
You should have 3 blanks followed by 27
12345
FORGET4
The correct choice is 27
12345
Using the variable b as the argument,
please type in the result produced with
the format specifier %10e:
123456789012
Enter here:
That is correct!
You've got it on the 2nd try.
You've got it finally!
Think about it; this is exponential notation.
You should have 1.37 with 0's ended with e+02
123456789012
FORGET5
The correct choice is 1.376000e+02
123456789012
Using the variable b as the argument,
please type in the result produced with
the format specifier %10.4f:
1234567890
Enter here:
That is correct!
You've got it on the 2nd try.
You've got it finally!
Think about it; the fractional part is 4 chars long.
You should have 2 blanks, 137. and the decimal part.
1234567890
FORGET6
The correct choice is 137.6000
1234567890
Using the variable b as the argument,
please type in the result produced with
the format specifier %5g:
1234567..
Enter here:
That is correct!
You've got it on the 2nd try.
You've got it finally!
Think about it; the result is left-justified.
The floating point representation, i.e. 137.6, is the shortest!
1234567..
FORGET7
The correct answer is 137.6
1234567..
Using the variable c as the argument,
please type in the result produced with
the format specifier %5c:
12345
Enter here:
That is correct!
You've got it on the 2nd try.
You've got it finally!
Think about it; the result is right-justified.
You should have 4 blanks followed by K.
12345
FORGET8
The correct choice is K
12345
Using the variable name as the argument,
please type in the result produced with
the format specifier %15s:
123456789012345
Enter here:
That is correct!
You've got it on the 2nd try.
You've got it finally!
Think about it; the result is right-justified.
You should have 8 blanks followed by c_class.
123456789012345
FORGET9
The correct choice is c_class
123456789012345