Black Friday Biggest Discount Flat 70% Offer - Ends in 0d 00h 00m 00s - Coupon code: 70diswrap

C++ Institute CLA-11-03 Dumps

Page: 1 / 4
Total 40 questions

CLA - C Certified Associate Programmer Questions and Answers

Question 1

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 2

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

#include

#include

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

double x = 1234567890.0;

printf ("%f",x);

return 0;

}

Choose the most precise answer:

Options:

A.

The program outputs 1234567900.0

B.

Execution fails

C.

The program outputs 1234567890.0

D.

Compilation fails

E.

The program outputs a value greater than 1234500000.0 and less than 1234600000.0

Question 3

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 4

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

#include

#include

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

int a = 0, b = 1, c;

c = a++ && b++;

printf("%d",b);

return 0;

}

Choose the right answer:

Options:

A.

The program outputs 3

B.

The program outputs 1

C.

The program outputs 2

D.

Compilation fails

E.

The program outputs 0

Question 5

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:

Options:

A.

The program outputs 0

B.

The program outputs 4

C.

The program outputs 1

D.

The program outputs 2

E.

Compilation fails

Question 6

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

#include

struct s {

int i;

};

void fun(struct S st) {

st.i --;

int main (void) {

int k;

struct $ str1 = { 2 };

fun (str1) ;

k =str1.i;

printf("%d", k);

return 0;

}

-

Choose the correct answer:

Options:

A.

The program outputs 3

B.

Compilation fails

C.

The program outputs 1

D.

The program outputs 2

E.

The program outputs 0

Question 7

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 8

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 9

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 10

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 11

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 12

-

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

#include

int *f();

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

int *p;

p = f();

printf("%d",*p);

return 0;

}

int *f() {

static v = 1;

return &v;

}

Choose the right answer:

Options:

A.

The program outputs 1

B.

Compilation fails

C.

The program outputs 3

D.

The program outputs 2

E.

The program outputs 0

Page: 1 / 4
Total 40 questions