New Year Sale 2026! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

C++ Institute CPP Exam - Topic 1 Question 32 Discussion

Actual exam question for C++ Institute's CPP exam
Question #: 32
Topic #: 1
[All CPP Questions]

What happens when you attempt to compile and run the following code?

#include

using namespace std;

int main()

{

cout.setf(ios::hex, ios::basefield);

cout<<100<<" ";

cout.unsetf(ios::hex);

cout<<100<<" ";

return 0;

}

Program outputs:

Show Suggested Answer Hide Answer
Suggested Answer: D

Contribute your Thoughts:

0/2000 characters
Carla
4 months ago
Are you sure about that output? Sounds off.
upvoted 0 times
...
Jeff
4 months ago
Wait, why does it show hex for the first 100?
upvoted 0 times
...
Janey
4 months ago
Definitely not a compilation error!
upvoted 0 times
...
Delisa
4 months ago
I think it should be 100 0x64.
upvoted 0 times
...
Maurine
5 months ago
It outputs 0x64 0x64.
upvoted 0 times
...
Malcom
5 months ago
Alright, let's do this! I've worked with zpool before, so I'm feeling confident about this question. I'll go through the options and see which ones match the output.
upvoted 0 times
...
Jospeh
5 months ago
I'm pretty confident that option D is the way to go here. Manually setting the inventory to a high number seems like the simplest and most straightforward solution.
upvoted 0 times
...

Save Cancel