Questions
Questions

Introduction To Object Oriented Programming (082025-CMM)

Single choice

Consider the following code : int i = 0; while (i < 5) { MessageBox.Show(i.ToString()); i++; } Which of the following is correct?

Options
A.a. The loop will only run once
B.b. The loop will run indefinitely
C.c. The loop will display numbers 1 to 5
D.d. The loop will display numbers 0 to 4
Question Image
View Explanation

View Explanation

Verified Answer
Please login to view
Step-by-Step Analysis
To analyze what the loop does, I’ll step through how the code executes on each iteration. First, the variable i is initialized to 0. The while condition checks i < 5 before each iteration, so the loop will run as long as i is less than 5. Inside the loop, the current value of i is shown via MessageBox.Show(i.ToSt......Login to view full explanation

Log in for full answers

We've collected over 50,000 authentic exam questions and detailed explanations from around the globe. Log in now and get instant access to the answers!

More Practical Tools for Students Powered by AI Study Helper

Join us and instantly unlock extensive past papers & exclusive solutions to get a head start on your studies!