ProgrammingHardTCS NQT · Infosys
What is printed?
What is printed?
#include <stdio.h>
int main(void) {
printf("%c", 'Z' - 'A' + 'a');
}- A. z
- B. {
- C. y
- D. a
Correct answer: A. z
'Z' - 'A' = 25, and 25 + 'a' = 122, which is the ASCII code for z.
More C Programming questions
- What is printed? c #include <stdio.h> #include <stdlib.h> int nd(int n) { int c = 0; for (int d = 1; d <= n; d++) if (n % d == 0) c++…
- How many binary strings of length 4 have exactly two 1s? The program counts them recursively. What is printed? c #include <stdio.h> int…
- What is printed? c #include <stdio.h> int v[] = {1, 2, 3}; int cnt(int i, int s) { if (i == 3) return s % 2 == 0; return cnt(i + 1, s) +…
- What is printed? c #include <stdio.h> int used[3]; int count(int d) { if (d == 3) return 1; int t = 0; for (int i = 0; i < 3; i++) { if…
- What is printed? Assume uint8t is 8 bits. c #include <stdint.h> #include <stdio.h> int main(void) { uint8t x = 0x0F; uint8t r =…
- How many set bits does this loop count in 0xFFFF0000? c #include <stdio.h> int main(void) { unsigned x = 0xFFFF0000u; int c = 0; while (x)…