

MCQOPTIONS
Saved Bookmarks
1. |
Consider the following pseudo-code fragment, where a and b are integer variables that havebeen initialized:/* Pre-conditions : (a > 1 ∧ a < b) *//* Assume that overflow never occurs */int x = 0; int p = 1;while (p < b) {p = p * a;x = x + 1;}When the while loop terminates, what will be the value of x in terms of a and b ? |
A. | ab |
B. | ba |
C. | \(\left[ {\log _a^b/*} \right]\left[ \; \right]means\;floor*/\) |
D. | \(\left[ {\log _a^b/*} \right]\left[ \; \right]means\;ceil*/\) |
Answer» E. | |