Looking for met1501s25-a.sg test answers and solutions? Browse our comprehensive collection of verified answers for met1501s25-a.sg at distance3.sg.digipen.edu.
Get instant access to accurate answers and detailed explanations for your course questions. Our community-driven platform helps students succeed!
Write if the following code fragment doesn't compile. Write if the code fragment's execution causes undefined behavior at run-time. Otherwise, write the exact value printed to standard output by the code fragment.
char *strs[] = { "how", "stunt", "ball", "dalq", 0}, **pps = strs;
int i = 0;
while (*pps) {
printf("%c", *(*pps+++i)+i);
++i;
}
Write if the following code fragment doesn't compile. Write if the code fragment's execution causes undefined behavior at run-time. Otherwise, write the exact value printed to standard output by the code fragment.
int b[][3] = {5, 3, 9, 4, 1, 2, 6, 7, 8}, m = 0;
for (int k = 0; k < 3; ++k) {
int j = 0;
for (int i = k; i >= 0; i--) {
m += b[i][j++];
}
}
printf("%d", m);
Write if the following code fragment doesn't compile. Write if the code fragment's execution causes undefined behavior at run-time. Otherwise, write the exact value printed to standard output by the code fragment.
int bar(int x) {
return x % 3;
}
printf("%d", bar(bar(bar(19))));
Given the following definitions:
// assume pc is assigned address 1000
int c[] = {5, 7, 10, 3, 1}, *pc = c;
determine whether each of the following expressions are legal or illegal. For legal expressions, compute the value resulting from the evaluation of the expression.
Write if the following code fragment doesn't compile. Write if the code fragment's execution causes undefined behavior at run-time. Otherwise, write the exact value printed to standard output by the code fragment.
int j = 0;
if (j++ == ++j) {
printf("1");
} else {
printf("2");
}
Write if the following code fragment doesn't compile. Write if the code fragment's execution causes undefined behavior at run-time. Otherwise, write the exact value printed to standard output by the code fragment.
int j = 0;
if (j++ && ++j) {
printf("1");
} else {
printf("2");
}
Given the following definitions
int i = 5, j = 6;
int const ci = 10, cj = 11;
int const *pci;
int *pi;
determine whether the subsequent assignment statements are legal or not.
Given the following definitions:
int i = 5, j = 10, *p = &i, *q = &j;determine whether each of the following assignment statements is legal [because the statement doesn't cause a compile-time error] or illegal [because the statement causes a compile-time error].
Given the definitions:
char animals[][10] = {"lion", "elephant", "tiger", "cat"}, arrc[] = "4.7", *pc = animals[0];
int arri[10] = {1, 2, 3};
write the value resulting from the evaluations of the following expressions.