Teaching HPSC Lecturer (Technical) Mock Test 2024 Programming and Data Structure Programming in C While Loop
Consider the C program fragment below which is meant to divide x by y using repeated subtraction. The variables x, y, q and r are all unsigned int.
While (r >= y) {
r = r – y;
q = q + 1;
}
1
(q == r) && (r == 0)
2
(x > 0) && (r == x) && (y > 0)
3
(q == 0) && (r == x) && (y > 0)
4
(q == 0) && (y > 0)
5
Question Not Attempted