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

GIAC Exam GPYC Topic 3 Question 67 Discussion

Actual exam question for GIAC's GPYC exam
Question #: 67
Topic #: 3
[All GPYC Questions]

What will be the value of the i variable when the while loop finishes its execution0

i = 0

while i != 0:

1 = 1-1

else:

i = i + 1

Show Suggested Answer Hide Answer
Suggested Answer: A

Contribute your Thoughts:

Annamae
4 days ago
Hmm, let me think about this. If the loop condition is false from the start, the else block will execute, and i will be incremented to 1. So, the final value of i will be 1. Wait, no, that's not right. The answer is B) 0!
upvoted 0 times
...
Lasandra
7 days ago
Haha, this code looks like it was written by a programmer who was just learning while loops. The answer is definitely B) 0, because the loop will never execute, and the else block will set i to 1.
upvoted 0 times
...
Ernie
15 days ago
This is a tricky one! If the loop condition i != 0 is false from the start, the else block will execute, and i will be incremented to 1. Therefore, the answer is B) 0.
upvoted 0 times
...
Nell
16 days ago
The variable i will be set to 1 because the loop condition i != 0 is true initially, and inside the loop, i is assigned the value 1-1, which is 0. So, the loop will execute once and the final value of i will be 1.
upvoted 0 times
Katie
2 days ago
The final value of i will be 1.
upvoted 0 times
...
Victor
10 days ago
A) 1
upvoted 0 times
...
...

Save Cancel