Consider the C program fragment below which is meant to divide x by y using repeated subtractions. The variables x, y, q and r are all unsigned int.
while (r >= y)
{
r = r – y;
q = q + 1;
}
Which of the following conditions on the variables x y, q and r before the execution of the fragment will ensure that the loop terminates in a state satisfying the condition x == (y * q + r) ?
Sign in to see the solution
Log in to view the explanation, track your attempts, and keep your progress.
Sign in to UnlockBrowse Practice Questions by Chapters / Topics in Browse Practice Questions by Chapters / Topics in GATE Computer Science
Total Questions
Attempted
% Attempted
Correct
% Correct
| Topic | Questions | Attempted | Correct | |
|---|---|---|---|---|
| C Programming and Data Structures | 142 | 0 | 0 | |
| Algorithms | 113 | 0 | 0 | |
| DBMS | 13 | 0 | 0 | |
| Operating Systems (OS) | 0 | 0 | 0 | |
| Computer Networks | 22 | 0 | 0 | |
| CDS | 10 | 0 | 0 | |
| C Programming & Data Structure | 22 | 0 | 0 | |
| 20 | 0 | 0 | 0 |