New Year Special 70% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: save70

Complete CLA-11-03 C++ Institute Materials

Page: 2 / 3
Total 40 questions

CLA - C Certified Associate Programmer Questions and Answers

Question 5

What happens if you try to compile and run this program?

#define ALPHA 0

#define BETA ALPHA-1

#define GAMMA 1

#define dELTA ALPHA-BETA-GAMMA

#include

int main(int argc, char *argv[]) {

printf ("%d", DELTA);

return 0;

Choose the right answer:

Options:

A.

The program outputs 2

B.

The program outputs -2

C.

The program outputs 1

D.

Compilation fails

E.

The program outputs -1

Question 6

What happens if you try to compile and run this program?

#include

int main (int argc, char *argv[]) {

int i = 1;

for(;i > 128;i *= 2);

printf("%d", i) ;

return 0;

}

-

Choose the right answer:

Options:

A.

The program enters an infinite loop

B.

Compilation fails

C.

The program outputs a value less than 128

D.

The program outputs 128

E.

The program outputs a value greater than 128

Question 7

What happens if you try to compile and run this program?

#include

int i = 0;

int main (int argc, char *argv[]) {

for(i; 1; i++);

printf("%d", i);

return 0;

}

Choose the right answer:

Options:

A.

The program outputs 0

B.

Compilation fails

C.

The program executes an infinite loop

D.

The program outputs 2

E.

The program outputs 1

Question 8

What happens if you try to compile and run this program?

#include

int main (int argc, char *argv[]) {

char *t = "abcdefgh";

char *p = t + 2;

int i;

p++;

p++;

printf("%d ", p[2] - p[-1]);

return 0;

}

Choose the right answer:

Options:

A.

The program outputs 3

B.

The program outputs 4

C.

Execution fails

D.

The program outputs 2

E.

Compilation fails

Page: 2 / 3
Total 40 questions