Pass the C++ Institute C++ Institute Certification CLA-11-03 Questions and answers with CertsForce

Viewing page 2 out of 2 pages
Viewing questions 11-20 out of questions
Questions # 11:

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


Expert Solution
Questions # 12:

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


Expert Solution
Viewing page 2 out of 2 pages
Viewing questions 11-20 out of questions