EX2CPP
EX2CPP
EX2CPP
123,456
123_456
123456
123.456
08
1000
10
0x8
10
1000
Monte-Carlo
Monte Carlo
Monte_Carlo
Monte@Carlo
_0
0_
___
_0_
Yes
No
What is the value of the var variable at the end of the following snippet?
int var;
var = 2;
var = var * var;
var = var + var;
var = var / var;
var = var var;
16
What is the value of the var variable at the end of the following snippet?
int var;
var = 2;
var = var * var;
var = var + var;
/*
var = var / var;
var = var var;
*/
16
Which of the following strings is a proper floating-point number (in the C language sense)?
Select correct answer (single choice)
123,456
123.456
123_456
123456
0.8765
8.765
87.65
What is the value of the x variable at the end of the following snippet?
int x;
x = 1 / 2;
0.5
What is the value of the x variable at the end of the following snippet?
int x;
x = 1 / 2 * 3;
/***
Select correct answer (single choice)
1.5
What is the value of the x variable at the end of the following snippet?
float x;
x = 1. / 2 * 3;
/***
Select correct answer (single choice)
1.5
What is the value of the k variable at the end of the following snippet?
int i,j,k;
i = 4;
j = 5;
k = --i * j++;
15
12
18
What is the value of the k variable at the end of the following snippet?
int i,j,k;
i = 4;
j = 5;
k = i-- * ++j;
21
24
18
28
What is the value of the k variable at the end of the following snippet?
int i,j,k;
i = 3;
j = -3;
k = i * j;
k += j;
k /= i;
-8
-4
What is the value of the c variable at the end of the following snippet?
char c;
c = '\';
\0
'
What is the value of the c variable at the end of the following snippet?
char c;
c = 'a';
c -= ' ';
\0
What is the value of the k variable at the end of the following snippet?
int i,j,k;
i = 3;
j = -3;
k = (i >= i) + (j <= j) + (i == j) + (i > j);
k = i + j;
printf("%d",k);
return 0;
}
switch(i + 2) {
case 1: j++;
case 2: j++;
default:j = 0;
case 0: j++; break;
}
printf("%d",j);
return 0;
}
t[0] = 0;
for(i = 1; i < 5; i++)
t[i] = t[i - 1] + i;
printf("%d",t[4]);
return 0;
}
t[4] = 0;
for(i = 3; i >= 0; i--)
t[i] = t[4] * i;
printf("%d",t[0]);
return 0;
}
t[0] = 1; t[1] = 0;
printf("%d",t[t[t[t[t[0]]]]]);
return 0;
}
s = 1;
for(i = 2; i < 6 ; i += i + 1)
s += t[i];
printf("%d",s);
return 0;
}
printf("%d",**k);
return 0;
}
printf("%d",sizeof(t) - sizeof(t[0]));
return 0;
}
printf("%d",sizeof(t) / sizeof(int));
return 0;
}
p += *p;
printf("%d",*p);
return 0;
}
p += 2;
p += p[-1];
printf("%d",*p);
return 0;
}
printf("%c",'A' + s[3]);
return 0;
}
strcpy(s + 2, "ABCDE");
printf("%d", s[0] - s[2]);
return 0;
}
#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;
}
#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;
}