






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!







return 0; } A. d B. e C. f D. g E. h
A. C B. c C. H D. h E. None of the above
A. i && j && k B. i || j || k C. !(j-5) D. i<j || i==k && j<k E. i
return 0; } A. 1 2 3 B. 1 2 3 4 C. 2 3 4 D. 0 1 2 3 E. 0 1 2 3 4
A. The do/while() loop prints "0" and the while() loop doesn't print anything. B. Both print "0" C. The do/while() loop does not print anything and the while() loop prints "0" D. Both loops do no print anything E. Both are infinite loops
/non-recursive/ int factorial(int n) { int i, answer; answer = 1;
for(i = n; i >= 1; --i) answer = answer * i; return answer; }
/* recursive */ void factorialR(int n) { int answer; if (n==1) return 1;
/* recursive call */ ______________________ // fill out this line
return answer; }
A. answer = answer * n; B. answer = factorialR(n-1); C. answer = factorialR(n); D. answer = n * factorialR(n-1); E. answer = n * factorialR(n);
#include <stdio.h> int main(void) { int c; while ((c = getchar()) != EOF){ putchar(c);} return 0; } A. Ctrl + ‘O’ B. Ctrl + ‘x’ C. “EOF” D. Ctrl + ‘d’
D. double E. A and B
include <stdio.h>
int main(void) { char c = 'h'; printf ("%c", c + 1); printf ("%d", c + 2); return 0; } A. i B. j C. i D. j E. k
#include <stdio.h>
/* Assume we use ASCII character set*/ int main(void) { char a = 'J', b = 'F', c = 'M', d;
printf("%d ", a - 'A' < 0 || a - 'Z' > 0); printf("%c\n", (d = a > b? a : b) > c? d : c);
return 0; }