ProgrammingVery hardGATE CS · Campus placements
for (int i = 0; i < 10; i++) for (int j = 1; j < 10; j *= 2) count++; How many times does count increase?
- A. 40
- B. 45
- C. 50
- D. 100
Correct answer: A. 40
The inner loop runs for j = 1, 2, 4 and 8, which is 4 times for each of the 10 outer iterations, giving 40.
More C Programming questions
- What does printf("%d %d", 17 / 5, 17 % 5) print?
- int x = 0; if (x = 5) printf("y"); else printf("n"); What is printed?
- Which expression clears the lowest three bits of an unsigned char x?
- uint32t x = 0u; x -= 1; x = x / 2 + 1; What is x?
- int a[5]; int p = &a[4]; printf("%td", p - &a[0]); What is printed?
- What does printf("%d", '7' - '0' == 7) print?