ProgrammingHard
int c = 0; const char *s = "Queue"; for (int i = 0; s[i]; i++) if (strchr("aeiou", tolower((unsigned char)s[i]))) c++; printf("%d", c); What is printed?
- A. 3
- B. 5
- C. 4
- D. 2
Correct answer: C. 4
The vowels in Queue are u, e, u and e, so the count is four.
More C Programming questions
- printf("%.s", 2, "hello"); What is printed?
- int n = snprintf(buf, sizeof buf, "%s", text); if (n >= (int)sizeof buf) puts("truncated"); What does the test detect?
- char src[] = "hey"; char dst[8]; memcpy(dst, src, strlen(src)); printf("%d", (int)strlen(dst)); What is the problem with this code?
- int arr[3] = {1, 2, 3}; int (pa)[3] = &arr; printf("%d", (pa)[2]); What is printed?
- int spiralcount = 4 5; printf("%d", spiralcount); For a 4 x 5 matrix, how many cells does a full spiral visit?
- A program climbs a staircase of 5 steps, each move going up one or two steps. How many distinct ways are there?