Summer Sale Limited Time 65% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: ecus65

C++ Institute CLA-11-03 - CLA - C Certified Associate Programmer

Page: 1 / 2
Total 40 questions

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:

A.

Execution fails

B.

Compilation fails

C.

The program outputs 1

D.

The program outputs -1

E.

The program outputs 0

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:

A.

The program outputs 1

B.

The program outputs 5

C.

The program outputs 3

D.

Compilation fails

E.

The program outputs 4

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:

A.

The program outputs 4

B.

The program outputs 1

C.

The program outputs 5

D.

The program outputs 6

E.

Compilation fails

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:

A.

The program outputs 0

B.

The program outputs 4

C.

The program outputs 1

D.

The program outputs 2

E.

Compilation fails

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:

A.

The program outputs 1

B.

The program outputs 3

C.

Compilation fails

D.

The program outputs 2

E.

The program outputs an unpredictable value

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:

A.

The program outputs 68

B.

The program outputs 60

C.

Compilation fails

D.

The program outputs 86

E.

The program outputs 62

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:

A.

The program outputs 5

B.

The program outputs 2

C.

The program outputs 1

D.

The program outputs 4

E.

The program outputs 3

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:

A.

The program outputs 2

B.

The program outputs 4

C.

The program outputs 1

D.

The program outputs 0

E.

The program outputs 3

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:

A.

The program outputs -1

B.

The program outputs 7

C.

Compilation fails

D.

The program outputs 1

E.

The program outputs 0

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

A.

The program outputs 1

B.

Compilation fails

C.

The program outputs 0

D.

The program outputs 0.5