C++ Institute CLA-11-03 - CLA - C Certified Associate Programmer
What happens if you try to compile and run this program?
#include
int main (int argc, char *argv[]) {
int i = 'A' - 'B';
int j = 'b' - 'a';
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[]) {
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
#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[]) {
int i = 2;
int d= i << 2;
d /= 2;
printf ("%d", d) ;
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 main, Main, mAIN = 1;
Main = main = mAIN += 1;
printf ("%d", MaIn) ;
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 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 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[]) {
int i = 7 || 0 ;
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 = 1;
for( ;; i/=2)
if(i)
break ;
printf("%d",i);
return 0;
}
Choose the right answer:
The program executes an infinite loop