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 CPA-21-02 Exam - Topic 8 Question 32 Discussion

Actual exam question for C++ Institute's CPA-21-02 exam
Question #: 32
Topic #: 8
[All CPA-21-02 Questions]

How many times will the program print "HELLO" ?

#include

using namespace std;

int main()

{

cout<<"HELLO";

main();

return 0;

}

Show Suggested Answer Hide Answer
Suggested Answer: B

Contribute your Thoughts:

0/2000 characters
Mariko
3 months ago
32769 seems way off, it's gotta be D.
upvoted 0 times
...
Broderick
3 months ago
I thought it would just print once, but I guess not!
upvoted 0 times
...
Pamella
3 months ago
Wait, how does it even know when to stop?
upvoted 0 times
...
Derrick
4 months ago
Definitely D, no doubt about it!
upvoted 0 times
...
Mollie
4 months ago
It'll print "HELLO" until the stack overflows.
upvoted 0 times
...
Shanda
4 months ago
I feel like it just prints "HELLO" once and then exits, but that doesn't seem right. I might be overthinking it.
upvoted 0 times
...
Major
4 months ago
This kind of question reminds me of a practice one where we had to calculate the depth of recursion. I think it could be a huge number like A or B, but I'm leaning towards D.
upvoted 0 times
...
Lottie
4 months ago
I remember something about recursion limits, but I'm not sure how many times it actually prints "HELLO" before that happens.
upvoted 0 times
...
Tomas
5 months ago
I think the program will keep calling main() recursively until the stack overflows, so it might be D.
upvoted 0 times
...
Brianne
5 months ago
I'm pretty confident the answer is D. Recursively calling main() like that will just keep going until the system runs out of memory and crashes.
upvoted 0 times
...
Tracey
5 months ago
Okay, I think I've got this. The program will keep printing "HELLO" until the stack overflows, so the answer is D.
upvoted 0 times
...
Chantay
5 months ago
Hmm, I'm a bit confused by this. Calling main() inside main() seems like it could cause an infinite loop, but I'm not sure exactly how that would play out.
upvoted 0 times
...
Erinn
5 months ago
This looks like a tricky one! I'll need to think it through carefully to avoid a silly mistake.
upvoted 0 times
...
Chandra
10 months ago
Hmm, I'm not too sure about this one. Maybe I should just ask the professor for the answer. Or maybe I can bribe the exam proctor? Just kidding, I'll go with option D.
upvoted 0 times
Rosann
8 months ago
I'm going with option D, till stack overflows.
upvoted 0 times
...
Gilma
8 months ago
I believe it will print 'HELLO' till the stack overflows.
upvoted 0 times
...
Rosann
9 months ago
Yes, I agree. It will keep printing 'HELLO' until the stack overflows.
upvoted 0 times
...
Veronika
9 months ago
I believe it will print 'HELLO' until the stack overflows as well.
upvoted 0 times
...
Leota
9 months ago
I think it will print 'HELLO' till the stack overflows.
upvoted 0 times
...
Theron
9 months ago
I think it will print 'HELLO' until the stack overflows.
upvoted 0 times
...
...
Mabel
10 months ago
Haha, this is a classic stack overflow question. The program will just keep printing 'HELLO' until it crashes the system. Option D all the way!
upvoted 0 times
Osvaldo
8 months ago
D) Till stack overflows
upvoted 0 times
...
Rosamond
8 months ago
Haha, this is a classic stack overflow question. The program will just keep printing 'HELLO' until it crashes the system. Option D all the way!
upvoted 0 times
...
Suzi
9 months ago
D) Till stack overflows
upvoted 0 times
...
Dortha
9 months ago
C) 1
upvoted 0 times
...
Billi
9 months ago
B) 32769
upvoted 0 times
...
Wilda
9 months ago
A) 65536
upvoted 0 times
...
Glynda
9 months ago
Definitely, option D is the correct choice.
upvoted 0 times
...
Vilma
9 months ago
You're right, it's a classic stack overflow scenario.
upvoted 0 times
...
Xuan
9 months ago
No way, it will print 'HELLO' till the stack overflows.
upvoted 0 times
...
Alison
10 months ago
I think it will print 'HELLO' 32769 times.
upvoted 0 times
...
...
Raina
10 months ago
I am not sure, but I think it will print 'HELLO' 65536 times.
upvoted 0 times
...
Julianna
10 months ago
I believe it will print 'HELLO' till stack overflows.
upvoted 0 times
...
Zana
11 months ago
I think the answer is B. The program will keep printing 'HELLO' until it hits the maximum signed integer value, which is 32769.
upvoted 0 times
Florinda
9 months ago
I think the answer is B. The program will keep printing 'HELLO' until it hits the maximum signed integer value, which is 32769.
upvoted 0 times
...
Catina
9 months ago
D) Till stack overflows
upvoted 0 times
...
Jacinta
9 months ago
C) 1
upvoted 0 times
...
Jerilyn
10 months ago
B) 32769
upvoted 0 times
...
Bobbye
10 months ago
A) 65536
upvoted 0 times
...
...
Elise
11 months ago
This is an infinite recursion problem! The program will keep calling `main()` until the stack overflows. I'm going with option D.
upvoted 0 times
Joye
9 months ago
Yes, that's the correct answer.
upvoted 0 times
...
Ivan
9 months ago
So, the correct option is D) Till stack overflows.
upvoted 0 times
...
Jospeh
10 months ago
I agree, the program will keep calling main() indefinitely.
upvoted 0 times
...
Verlene
10 months ago
I think it will print 'HELLO' till the stack overflows.
upvoted 0 times
...
...
Erin
11 months ago
I think it will print 'HELLO' 32769 times.
upvoted 0 times
...

Save Cancel