What happens if you try to compile and run this program?
#include
int main (int argc, char *argv[]) {
int i = 20;
printf("%x", i);
return 0;
}
-
Choose the right answer:
What happens when you compile and run the following program?
#include
#define SYM
#define BOL 100
#undef SYM
int main (void) {
#ifdef SYM
int i = 100;
#else
int i= 200;
#endif
int j = i + 200;
printf("%d",i+j);
return 0;
}
Select the correct 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
#include
struct STR {
int i;
char c[20];
float f;
};
int main (int argc, char *argv[]) {
struct STR str = { 1, "Hello", 3 };
printf("%d", str.i + strlen(str.c));
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 *p = "John" " " "Bean";
printf("[%s]", p) ;
return 0;
}
Choose the right answer:
What happens if you try to compile and run this program?
#include
#include
int main (int argc, char *argv[]) {
int a = 0, b = 1, c;
c = a++ && b++;
printf("%d",b);
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 = 1;
for( ;; i/=2)
if(i)
break ;
printf("%d",i);
return 0;
}
Choose the right answer:
The program executes an infinite loop
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:
What happens if you try to compile and run this program?
#include
int main (int argc, char *argv[]) {
char *s = "\\\"\\\\";
printf ("[%c]", s [1]);
return 0;
}
Choose the right answer: