Pre-Winter Sale- Special Discount Limited Time 65% Offer - Ends in 0d 00h 00m 00s - Coupon code: netdisc

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

Page: 1 / 4
Total 40 questions

CLA - C Certified Associate Programmer Questions and Answers

Question 1

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:

Options:

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

Question 2

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

#include

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

int i = 0;

printf ("%s", argv[i]);

return 0;

}

Choose the right answer:

Options:

A.

The program outputs an unpredictable string, or execution fails

B.

The program outputs a predictable non-empty string

C.

Execution fails

D.

The program outputs an empty string

E.

Compilation fails

Question 3

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 4

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

Question 5

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 6

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:

Options:

A.

The program outputs 1

B.

The program outputs 5

C.

The program outputs 3

D.

Compilation fails

E.

The program outputs 4

Question 7

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

#include

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

float f = 1e1 + 2e0 + 3e-1;

printf("%f ",f);

return 0;

}

Choose the right answer:

Options:

A.

The program outputs 1230.0000

B.

Compilation fails

C.

The program outputs 12300.000

D.

The program outputs 12.300000

E.

The program outputs 123.00000

Question 8

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 9

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

#include

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

int i = 10 - 2 / 5 * 10 / 2 - 1;

printf("%d",i);

return 0;

}

Choose the right answer:

Options:

A.

The program outputs 0

B.

The program outputs 4

C.

Compilation fails

D.

The program outputs 9

E.

The program outputs 15

Question 10

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:

Options:

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

Question 11

Assume that ints are 32-bit wide.

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

#include

typedef struct

int i;

int j;

int k;

} str;

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

str s = { 7, 7, 7 };

printf ("%d", sizeof (s.s));

return 0;

}

Choose the right answer:

Options:

A.

Execution fails

B.

The program outputs 16

C.

Compilation fails

D.

The program outputs 12

E.

The program outputs 4

Question 12

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

#include

fun (void) {

static int n = 3;

return --n;

}

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

printf("%d \n", fun() + fun());

return 0;

}

Select the correct answer:

Options:

A.

The program outputs 3

B.

The program outputs 0

C.

The program outputs 1

D.

The program outputs 2

E.

The program outputs 4

Page: 1 / 4
Total 40 questions