📚 Question Bank Q19 — Programming and Data Structure
Tags
Programming and Data Structure
Q19. Marks: +2.0 UGC NET Paper 2: Computer Science 2020
Consider the following pseudo-code fragment, where a and b are integer variables that have
been 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 ?
1.ab
2.ba
3.\(\left[ {\log _a^b/*} \right]\left[ \; \right]means\;floor*/\)
4.\(\left[ {\log _a^b/*} \right]\left[ \; \right]means\;ceil*/\) ✓ Correct
📄 All “Programming and Data Structure” questions across papers
🏷 Change Tag for this Question