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

Viewing page 1 out of 2 pages
Viewing questions 1-10 out of questions
Questions # 1:

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


Expert Solution
Questions # 2:

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


Expert Solution
Questions # 3:

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


Expert Solution
Questions # 4:

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


Expert Solution
Questions # 5:

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

#include

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

int i = 1, j = 0;

int 1 = !i + !! j;

printf("%d", 1);

return 0;

}

Choose the right answer:

Options:

A.

Compilation fails


B.

The program outputs 2


C.

The program outputs 3


D.

The program outputs 1


E.

The program outputs 0


Expert Solution
Questions # 6:

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


Expert Solution
Questions # 7:

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


Expert Solution
Questions # 8:

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

#include

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

int i = 2 / 1 + 4 / 2;

printf("%d",i);

return 0;

}

Choose the right answer:

Options:

A.

The program outputs 5


B.

Compilation fails


C.

The program outputs 3


D.

The program outputs 0


E.

The program outputs 4


Expert Solution
Questions # 9:

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

#include

#include

struct STR {

int i;

char c[20];

float f;

};

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

struct STR str = { 1, "Hello", 3 };

printf("%d", str.i + strlen(str.c));

return 0;

}

Choose the right answer:

Options:

A.

The program outputs 4


B.

The program outputs 1


C.

The program outputs 5


D.

The program outputs 6


E.

Compilation fails


Expert Solution
Questions # 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


Expert Solution
Viewing page 1 out of 2 pages
Viewing questions 1-10 out of questions