Consider the following C declarations:
int a[4] = {1,1,2,2};
int b[4] = {2,2,3,3};
int *p[4] = {&a[0], &b[0], &a[2], &b[2]};
Given these declarations and initial values, which of the following snippets will not access out-of-bounds memory, create a pointer to out-of-bounds memory, or otherwise cause an error? Select all that apply.
This was originally erronenously not a select-all-that-apply question, so dropped.
Consider the following Makefile:
all: a b c
a: e f g
buildA
b: a
buildB
c: a b d
buildC
Assume:
buildA, buildB, and buildC commands modify a, b, and c respectivelyWhich of the following executions are valid after running make?
Select all that apply.
Consider the file /etc/config.txt which has owner 10, group 134, and
permissions (represented in octal) 000.
The system storing that file has the following group membership table:
| group id | user id |
| 134 | 10 |
| 134 | 99 |
| 145 | 1311 |
| 145 | 10 |
User 10 runs the following commands:
$ chmod 640 /etc/config.txt
$ chmod u+w /etc/config.txt
$ chmod g-e /etc/config.txt
Which of the following executions are possible? Select all that are possible.
Suppose one is using a single-core Linux system and running the following C snippet in process A:
unsigned int x = fgetc(stdin);
unsigned int y = fgetc(stdin);
for (int i = 0; i < 100000000; i += 1) {
x += y;
}
printf("%u\n", x);
After one provides input to the program and before it computes the final value of x,
another process, process B, on the system outputs a message to the terminal
and exits. Then, process A finishes its computation and outputs the final value of x.
Which of the following is true about this situation? Select all that apply.