BLACK FRIDAY SALE – Unlock Up to 25% OFF on All Exam Prep! - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

C++ Institute CLA-11-03 Exam - Topic 3 Question 5 Discussion

Posted by Emiko on Sep 27, 2026 at 01:47 AM

What happens if you try to compile and run this program?

#include

int main (int argc, char *argv[]) {

char i = 20 + 020 + 0x20;

printf("%d",i);

return 0;

}

Choose the right answer:

Suggested Answer: A

* The program is a valid C program that can be compiled and run without errors.

* The variable i is declared as a char, which is an 8-bit signed integer type that can store val-ues from -128 to 127.

* The expression 20 + 020 + 0x20 evaluates to 68, because:

o 20 is a decimal literal with the value 20

o 020 is an octal literal with the value 16 (8^1 * 2 + 8^0 * 0)

o 0x20 is a hexadecimal literal with the value 32 (16^1 * 2 + 16^0 * 0)

o The + operator performs arithmetic addition on the operands and returns the sum

* The printf function prints the value of i as a decimal integer using the %d format specifier.

* The output of the program is 68.


Get Premium CLA-11-03 Questions as Interactive Web-Based Practice Test or PDF Real Exam Format Detailed Explanations Instant Access Get Your Practice Test
13 comments · newest first
IS
Isaiah 2 days ago
I thought it would be 60, but I guess not!
DI
Dierdre 7 days ago
Wait, how does 20 + 020 + 0x20 equal 68?
BO
Bo 12 days ago
Totally agree, it's A for sure!
OZ
Ozell 17 days ago
The expression evaluates to 68.
CH
Cherry 22 days ago
I thought it would fail to compile!
RO
Rosalia 27 days ago
Isn't 020 an octal?
RE
Reyes 1 month ago
Wait, how does that add up?
LA
Lai 1 month ago
Totally agree, it's 68!
MO
Mozelle 1 month ago
The program outputs 68.
LI
Lindsey 2 months ago
I’m confused about the char type here. Does it affect the output if the value exceeds the typical range? I feel like it could fail to compile.
AL
Alfreda 2 months ago
I practiced a similar question where the output was affected by base conversions. I think this one might compile but give an unexpected result.
BU
Buddy 2 months ago
I remember something about octal and hexadecimal, but I can't recall how they convert to decimal. I feel like it might be 68.
SH
Sherman 2 months ago
I think the program will compile fine, but I'm not sure what the output will be since it has different number bases.
0/2000 characters

Save Cancel