Let's analyze it:
The function func takes two arguments: text and num.
Inside the function, there is a while loop that continues as long as num is greater than 0.
On each iteration, it prints text and decrements num by 1.
When num is no longer greater than 0, the loop exits.
When we call func('Hello', 3):
num is initially 3. "Hello" is printed, then num becomes 2.
num is 2. "Hello" is printed again, then num becomes 1.
num is 1. "Hello" is printed once more, then num becomes 0.
num is 0, so the loop exits.
So the output will be "Hello" printed three times:
Copy code
Hello
Hello
Hello
Therefore, the correct answer is:
B. 1 | Hello 2 | Hello 3 | Hello
upvoted 1 times
...
Log in to ExamTopics
Sign in:
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
Billybob0604
2 days, 19 hours agoCristinaDev
1 month, 4 weeks agoellene
5 months, 1 week ago