Deal of The Day! 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
4 months ago
32769 seems way off, it's gotta be D.
upvoted 0 times
...
Broderick
5 months ago
I thought it would just print once, but I guess not!
upvoted 0 times
...
Pamella
5 months ago
Wait, how does it even know when to stop?
upvoted 0 times
...
Derrick
5 months ago
Definitely D, no doubt about it!
upvoted 0 times
...
Mollie
5 months ago
It'll print "HELLO" until the stack overflows.
upvoted 0 times
...
Shanda
6 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
6 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
6 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
6 months ago
I think the program will keep calling main() recursively until the stack overflows, so it might be D.
upvoted 0 times
...
Brianne
6 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
6 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
6 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
6 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
11 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
10 months ago
I'm going with option D, till stack overflows.
upvoted 0 times
...
Gilma
10 months ago
I believe it will print 'HELLO' till the stack overflows.
upvoted 0 times
...
Rosann
10 months ago
Yes, I agree. It will keep printing 'HELLO' until the stack overflows.
upvoted 0 times
...
Veronika
10 months ago
I believe it will print 'HELLO' until the stack overflows as well.
upvoted 0 times
...
Leota
10 months ago
I think it will print 'HELLO' till the stack overflows.
upvoted 0 times
...
Theron
11 months ago
I think it will print 'HELLO' until the stack overflows.
upvoted 0 times
...
...
Mabel
12 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
10 months ago
D) Till stack overflows
upvoted 0 times
...
Rosamond
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
...
Suzi
10 months ago
D) Till stack overflows
upvoted 0 times
...
Dortha
10 months ago
C) 1
upvoted 0 times
...
Billi
10 months ago
B) 32769
upvoted 0 times
...
Wilda
10 months ago
A) 65536
upvoted 0 times
...
Glynda
10 months ago
Definitely, option D is the correct choice.
upvoted 0 times
...
Vilma
11 months ago
You're right, it's a classic stack overflow scenario.
upvoted 0 times
...
Xuan
11 months ago
No way, it will print 'HELLO' till the stack overflows.
upvoted 0 times
...
Alison
11 months ago
I think it will print 'HELLO' 32769 times.
upvoted 0 times
...
...
Raina
12 months ago
I am not sure, but I think it will print 'HELLO' 65536 times.
upvoted 0 times
...
Julianna
12 months ago
I believe it will print 'HELLO' till stack overflows.
upvoted 0 times
...
Zana
1 year 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
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
...
Catina
11 months ago
D) Till stack overflows
upvoted 0 times
...
Jacinta
11 months ago
C) 1
upvoted 0 times
...
Jerilyn
11 months ago
B) 32769
upvoted 0 times
...
Bobbye
11 months ago
A) 65536
upvoted 0 times
...
...
Elise
1 year 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
10 months ago
Yes, that's the correct answer.
upvoted 0 times
...
Ivan
10 months ago
So, the correct option is D) Till stack overflows.
upvoted 0 times
...
Jospeh
11 months ago
I agree, the program will keep calling main() indefinitely.
upvoted 0 times
...
Verlene
12 months ago
I think it will print 'HELLO' till the stack overflows.
upvoted 0 times
...
...
Erin
1 year ago
I think it will print 'HELLO' 32769 times.
upvoted 0 times
...

Save Cancel