What happens when you compile and run the following program?
#include
int fun(void) {
static int i = 1;
i++;
return i;
}
int main (void) {
int k, l;
k = fun ();
l = fun () ;
printf("%d",l + k);
return 0;
}
Choose the right answer:
What happens if you try to compile and run this program?
#include
int main (int argc, char *argv[]) {
int i = 0;
printf ("%s", argv[i]);
return 0;
}
Choose the right answer:
What happens if you try to compile and run this program?
#include
int fun(int i) {
return i++;
}
int main (void) {
int i = 1;
i = fun(i);
printf("%d",i);
return 0;
}
Choose the correct answer:
What is the meaning of the following declaration?
float ** p;
Choose the right answer:
Assume that we can open a file called "file1".
What happens when you try to compile and run the following program?
#include
int main (void) {
FILE *f;
int i;
f = fopen("file1","wb");
fputs("545454",f);
fclose (f);
f = fopen("file1","rt");
fscanf(f,"%d ", &i);
fclose (f) ;
printf("%d",i);
return 0;
}
Choose the right answer:
What happens if you try to compile and run this program?
#include
int main (int argc, char *argv[]) {
int i =2, j = 1;
if(i / j)
j += j;
else
i += i;
printf("%d",i + j);
return 0;
}
Choose the right answer:
What happens if you try to compile and run this program?
#include
int main (int argc, char *argv[]) {
float f = 1e1 + 2e0 + 3e-1;
printf("%f ",f);
return 0;
}
Choose the right answer:
What happens if you try to compile and run this program?
#include
int main (int argc, char *argv[]) {
char i = 20 + 020 + 0x20;
printf("%d",i);
return 0;
}
Choose the right answer:
What happens if you try to compile and run this program?
#include
int main(int argc, char *argv[]) {
int i = 10 - 2 / 5 * 10 / 2 - 1;
printf("%d",i);
return 0;
}
Choose the right answer:
What happens when you compile and run the following program?
#include
int fun (void) {
static int i = 1;
i += 2;
return i;
}
int main (void) {
int k, 1;
k = fun ();
1 = fun () ;
printf ("%d", 1 - k);
return 0;
}
Choose the right answer:
Assume that ints are 32-bit wide.
What happens if you try to compile and run this program?
#include
typedef struct
int i;
int j;
int k;
} str;
int main (int argc, char *argv[]) {
str s = { 7, 7, 7 };
printf ("%d", sizeof (s.s));
return 0;
}
Choose the right answer:
What happens if you try to compile and run this program?
#include
fun (void) {
static int n = 3;
return --n;
}
int main (int argc, char ** argv) {
printf("%d \n", fun() + fun());
return 0;
}
Select the correct answer: