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 4 Question 19 Discussion

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

How many times will "HELLO" be printed?

#include

using namespace std;

int main()

{

for(int i=?1; i<=10; i++)

{

if(i < 5)

continue;

else

break;

cout<<"HELLO";

}

return 0;

}

Show Suggested Answer Hide Answer
Suggested Answer: A, B

Contribute your Thoughts:

0/2000 characters
Adelle
3 months ago
0 is definitely the right answer here.
upvoted 0 times
...
Thora
4 months ago
Yup, the continue statement skips everything below it for i < 5.
upvoted 0 times
...
Kristel
4 months ago
Wait, are you sure? I thought it would print at least once.
upvoted 0 times
...
Regenia
4 months ago
Totally agree, the loop breaks before printing!
upvoted 0 times
...
Merlyn
4 months ago
It will print "HELLO" 0 times.
upvoted 0 times
...
Goldie
5 months ago
I feel like it might print "HELLO" twice if the loop starts at 1, but I need to double-check how the break works in this context.
upvoted 0 times
...
Tracey
5 months ago
If I remember correctly, the continue statement skips the rest of the loop for values less than 5, so maybe "HELLO" won't be printed at all?
upvoted 0 times
...
Tandra
5 months ago
I remember practicing a similar question where the loop had a break statement, but I can't recall how it affected the output here.
upvoted 0 times
...
Ruthann
5 months ago
I think "HELLO" will be printed only once, but I'm not entirely sure about the loop conditions.
upvoted 0 times
...
Rosio
5 months ago
I'm not sure about this one. The loop condition and the "continue" and "break" statements are making me a bit uncertain. I'll need to carefully step through the code to figure out the correct answer.
upvoted 0 times
...
Portia
5 months ago
This seems straightforward. The loop runs 10 times, but the "continue" statement skips the first 4 iterations, and the "break" statement exits the loop after the 5th iteration. So the answer is 2.
upvoted 0 times
...
Desire
5 months ago
Okay, I think I've got it. The loop runs 10 times, but the "continue" statement skips the first 4 iterations, and the "break" statement exits the loop after the 5th iteration. So "HELLO" will be printed 1 time.
upvoted 0 times
...
Wynell
5 months ago
This looks like a tricky one. I'll need to carefully trace the loop and conditional logic to figure out how many times "HELLO" will be printed.
upvoted 0 times
...
Lili
5 months ago
Hmm, I'm a bit confused by the loop condition. Does the "i < 5" check mean the loop will only run 5 times? I'll need to double-check that.
upvoted 0 times
...
Thurman
5 months ago
Hmm, this seems like a tricky one. I'll need to think through the different Outlook views and how they impact the alphabetical index.
upvoted 0 times
...
Pedro
5 months ago
I'm not totally sure about this, but I think unbuffered queries return the first data faster and use less memory. I'll give that a try and see.
upvoted 0 times
...
Brice
5 months ago
Okay, I've got a strategy. I'll start by identifying the correct statements about how big data could provide a small company with useful information and new opportunities.
upvoted 0 times
...
Val
10 months ago
Ah, the age-old battle of off-by-one errors. I bet the exam writer is having a good laugh at our expense right now.
upvoted 0 times
...
Reta
10 months ago
20? Are you kidding me? The loop runs from i=5 to i=10, and 'HELLO' is printed only once. This is clearly a joke answer. I'm going with B as the correct response.
upvoted 0 times
...
Shanice
10 months ago
This is a tricky one! The loop initializes i to some value, but the question doesn't specify what that value is. So, I'm not sure if the loop will even run. I'll go with C as the safest option.
upvoted 0 times
...
Goldie
10 months ago
Wait, what? The loop runs from i=5 to i=10, but the 'else' block with 'break' is executed as soon as i reaches 5. So, 'HELLO' is printed only once. I guess B is the right answer.
upvoted 0 times
Nan
9 months ago
You're right, it will only be printed once.
upvoted 0 times
...
Elina
9 months ago
Oh, I see. So the correct answer is B) 2
upvoted 0 times
...
Detra
9 months ago
No, it's actually B) 2
upvoted 0 times
...
Dorcas
9 months ago
I think the answer is A) 1
upvoted 0 times
...
Derick
9 months ago
No, it will only be printed once.
upvoted 0 times
...
Sonia
10 months ago
I think it will be printed twice.
upvoted 0 times
...
...
Eliseo
11 months ago
Hmm, let's see. The loop runs from i=5 to i=10, and 'HELLO' is printed in each iteration, so the answer must be 6. Looks like C is the correct choice.
upvoted 0 times
Florinda
9 months ago
Yes, the answer is 6.
upvoted 0 times
...
Arlyne
9 months ago
I agree, it should be 6 times.
upvoted 0 times
...
Heike
10 months ago
I think it will be printed 6 times.
upvoted 0 times
...
...
Shanice
11 months ago
I'm not sure, but I think the answer is A) 1 as well
upvoted 0 times
...
Elena
11 months ago
I agree with Providencia, because the loop will only print 'HELLO' once when i=5
upvoted 0 times
...
Providencia
11 months ago
I think the answer is A) 1
upvoted 0 times
...

Save Cancel