Weekend Sale Special Limited Time 70% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: 70percent

C++ Institute CLA-11-03 CLA - C Certified Associate Programmer Exam Practice Test

Demo: 12 questions
Total 40 questions

CLA - C Certified Associate Programmer Questions and Answers

Question 1

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:

Options:

A.

The program outputs 2

B.

Compilation fails

C.

The program outputs 0

D.

The program outputs 1

E.

The program outputs an unpredictable value

Question 2

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:

Options:

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

Question 3

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

enum { A, B, C, D, E, F };

#include

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

printf ("%d", B + D + F);

return 0;

}

Choose the right answer:

Options:

A.

The program outputs 10

B.

The program outputs 7

C.

The program outputs 8

D.

Compilation fails

E.

The progham outputs 9

Question 4

Assume that ints are 32-bit wide.

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

#include

typedef union {

int i;

int j;

int k;

} uni;

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

uni s;

s.i = 3;

s.j = 2;

s.k = 1;

printf("%d",s.k * (s.i - s.j));

return 0;

}

Choose the right answer:

Options:

A.

The program outputs 9

B.

The program outputs 0

C.

Execution fails

D.

Compilation fails

E.

The program outputs 3

Question 5

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:

Options:

A.

The program outputs 68

B.

The program outputs 60

C.

Compilation fails

D.

The program outputs 86

E.

The program outputs 62

Question 6

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:

Options:

A.

The program outputs 24

B.

The program outputs 14

C.

The program outputs 20

D.

The program outputs 10

E.

Compilation fails

Question 7

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

Question 8

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

Options:

A.

The program outputs 1

B.

Compilation fails

C.

The program outputs 0

D.

The program outputs 0.5

Question 9

Assume that ints and floats are 32-bit wide.

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

#include

union uni {

float f, g;

int i, j;

};

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

union uni u;

printf ("%ld", sizeof (u) ) ;

return 0;

}

Choose the right answer:

Options:

A.

The program outputs 16

B.

The program outputs 8

C.

Compilation fails

D.

The program outputs 4

E.

The program outputs 24

Question 10

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

#include

#include

void fun (void) {

return 3.1415;

}

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

int i = fun(3.1415);

printf("%d",i);

return 0;

}

Choose the right answer:

Options:

A.

The program outputs 3

B.

The program outputs 3.1415

C.

The program outputs 4

D.

Execution fails

E.

Compilation fails

Question 11

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:

Options:

A.

The program outputs 545454

B.

Execution fails

C.

The program outputs 54

D.

The program outputs 0

E.

Compilation fails

Question 12

What is the meaning of the following declaration?

float ** p;

Choose the right answer:

Options:

A.

p is a float pointer to a float

B.

The declaration is erroneous

C.

p is a pointer to a float pointer

D.

p is a pointer to a pointer to a float

E.

p is a pointer to a float

Demo: 12 questions
Total 40 questions