Vous êtes sur la page 1sur 13

1.What happens if you try to compile and run this program?

#include <stdio.h>

int main(void) {

int i = 3, j = i - 2;

switch(i - 2) {

case 1: j++;

case 2: j++;

case 0: j++; break;

default:j = 0;

printf("%d",j); .x.xxx

return 0;

Select correct answer (single choice)

the program outputs 4

the program outputs 2

the program outputs 1

the program outputs 3

2.What happens if you try to compile and run this program?

#include <stdio.h>

#include <stdio.h>

int main(void) {

int i = 3, j = i - 2;

switch(i + 2) {
case 1: j++;

case 2: j++;

default:j = 0;

case 0: j++; break;

printf("%d",j);

return 0;

Select correct answer (single choice)

the program outputs 4

the program outputs 1

the program outputs 3

the program outputs 2

3.What happens if you try to compile and run this program?

#include <stdio.h>

int main(void) {

int i, t[5];

t[0] = 0;

for(i = 1; i < 5; i++)

t[i] = t[i - 1] + i;

printf("%d",t[4]);

return 0;

}
Select correct answer (single choice)

the program outputs 10

the program outputs 9

the program outputs 8

the program outputs 11

4.What happens if you try to compile and run this program?

#include <stdio.h>

int main(void) {

int i, t[5];

t[4] = 0;

for(i = 3; i >= 0; i--)

t[i] = t[4] * i;

printf("%d",t[0]);

return 0;

Select correct answer (single choice)

the program outputs 0

the program outputs 2

the program outputs 1

the program outputs -1

5.What happens if you try to compile and run this program?


#include <stdio.h>

int main(void) {

int t[2];

t[0] = 1; t[1] = 0;

printf("%d",t[t[t[t[t[0]]]]]);

return 0;

Select correct answer (single choice)

the program outputs 0

the program outputs 1

the program outputs -1

the program outputs 2

6.What happens if you try to compile and run this program?

#include <stdio.h>

int main(void) {

int i,t[3];

for(i = 2; i >=0 ; i--)

t[i] = i - 1;

printf("%d",t[1] - t[t[0] + t[2]]);

return 0;

}
Select correct answer (single choice)

the program outputs 2

the program outputs 1

the program outputs -1

the program outputs 0

7.What happens if you try to compile and run this program?

#include <stdio.h>

int main(void) {

int i,t[4] = { 1, 2, 4, 8 };

for(i = 0; i < 2 ; i++)

t[i] = t[3 - i];

printf("%d",t[2]);

return 0;

Select correct answer (single choice)

the program outputs 2

the program outputs 1

the program outputs 8

the program outputs 4

8.What happens if you try to compile and run this program?

#include <stdio.h>

int main(void) {
int s,i,t[] = { 0, 1, 2, 3, 4, 5 };

s = 1;

for(i = 2; i < 6 ; i += i + 1)

s += t[i];

printf("%d",s);

return 0;

Select correct answer (single choice)

the program outputs 1

the program outputs 2

the program outputs 4

the program outputs 8

9.What happens if you try to compile and run this program?

#include <stdio.h>

int main(void) {

char t[] = { 'a', 'b', 'A', 'B' };

printf("%d",t[1] - t[0] + t[3] - t[2]);

return 0;

Select correct answer (single choice)

the program outputs 4


the program outputs 8

the program outputs 1

the program outputs 2

10.What happens if you try to compile and run this program?

#include <stdio.h>

int main(void) {

float t[5] = { 1E0, 1E1, 1E2, 1E3, 1E4 };

printf("%f",t[0] + t[2] + t[3]);

return 0;

Select correct answer (single choice)

the program outputs 1110.000000

the program outputs 1111.000000

the program outputs 1011.000000

the program outputs 1101.000000

11.What happens if you try to compile and run this program?

#include <stdio.h>

int main(void) {

int i = 1, *j = &i, **k = &j;

printf("%d",**k);

return 0;
}

Select correct answer (single choice)

the program outputs 1

the program outputs NULL

the program outputs 0

the program outputs nul

12.What happens if you try to compile and run this program?

#include <stdio.h>

int main(void) {

char t[3];

printf("%d",sizeof(t) - sizeof(t[0]));

return 0;

Select correct answer (single choice)

the program outputs 4

the program outputs 1

the program outputs 2

the program outputs 3

13.What happens if you try to compile and run this program?

#include <stdio.h>

int main(void) {
int t[6];

printf("%d",sizeof(t) / sizeof(int));

return 0;

Select correct answer (single choice)

the program outputs 4

the program outputs 8

the program outputs 6

the program outputs 2

14.What happens if you try to compile and run this program?

#include <stdio.h>

int main(void) {

int t[10] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }, *p = t + 4;

p += *p;

printf("%d",*p);

return 0;

Select correct answer (single choice)

the program outputs 8

the program outputs 10

the program outputs 9


the program outputs 7

15.What happens if you try to compile and run this program?

#include <stdio.h>

int main(void) {

int t[10] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }, *p = t;

p += 2;

p += p[-1];

printf("%d",*p);

return 0;

Select correct answer (single choice)

the program outputs 5

the program outputs 1

the program outputs 3

the program outputs 7

16.What happens if you try to compile and run this program?

#include <stdio.h>

int main(void) {

char s[] = "\0\1\2\3\4";

printf("%c",'A' + s[3]);

return 0;
}

Select correct answer (single choice)

the program outputs D

the program outputs A

the program outputs C

the program outputs B

17.What happens if you try to compile and run this program?

#include <stdio.h>

int main(void) {

printf("%c","ACEGIK"[3] - 1);

return 0;

Select correct answer (single choice)

the program outputs G

the program outputs E

the program outputs F

the program outputs H

18.What happens if you try to compile and run this program?

#include <stdio.h>

#include <string.h>

int main(void) {

char s[10] = "ABCDE";


strcpy(s + 2, "ABCDE");

printf("%d", s[0] - s[2]);

return 0;

Select correct answer (single choice)

the program outputs 0

the program outputs -1

the program outputs 1

the program outputs -2

19.What happens if you try to compile and run this program?

#include <stdio.h>

#include <string.h>

int main(void) {

char s[11] = "CABDE";

strcat(s + 2, "CABDE");

printf("%d", s[0] - s[2]);

return 0;

Select correct answer (single choice)


the program outputs1

the program outputs -2

the program outputs -1

the program outputs 0

20.What happens if you try to compile and run this program?

#include <stdio.h>

#include <string.h>

int main(void) {

char s[11] = "ABCDE";

strcat(s + 2, "ABCDE");

printf("%d", s[0] - s[2]);

return 0;

Select correct answer (single choice)

the program outputs -2

the program outputs -1

the program outputs 1

the program outputs

Vous aimerez peut-être aussi