Consider the following C snippet running on a system with 8-byte pointers and 8-byte longs:
long A[4] = {10, 20, 30, 40};
long B[4] = {50, 60, 70, 80};
long *C[2] = {&A[1], &B[2]};
long *D[2] = {&A[1], &B[2]};
B[2] = *C[1];
C[1] = &A[3];
*C[0] = B[0];
The arrays C and D contains addresses. Depending on where the arrays are stored in memory
the values of the addresses in C and D will vary.
For example, if A is located at address 0x1000 and B at 0x2000, then D[0] could contain
0x1008 and D[1] will contain 0x2010, but these values would be different if
A and B were at different locations.
For some placement of the arrays in memory, which of the following are possible values for the array C at the end of the code snippet above? Select all that apply.
C[0] = &A[1], C[1] = &A[3]
Consider the following Makefile:
a: b e
buildA
b: c
buildB
c: d f
buildC
Assume:
buildA, buildB, and buildC commands modify a, b, and c respectivelyWhich of the following should always cause buildB to run?
Select all that apply.
Changing the line a: b e to a: b e c in the Makefile would ____.
Suppose a C project has the following source files:
common.h, foo.h, and bar.hcommon.c, which #includes common.hfoo.c, which #includes foo.h and common.hbar.c, which #includes bar.h and common.hFrom these two programs foo and bar is built using
the following sequence of commands:
clang -Wall -g -Og -c foo.c -o foo.o
clang -Wall -g -Og -c bar.c -o bar.o
clang -Wall -g -Og -c common.c -o common.o
clang -Wall -g -Og -o bar bar.o common.o
clang -Wall -g -Og -o foo foo.o common.o
If bar.h is modified which command or commands should be rerun to handle these modifications?
Select all that apply.
Consider the directory hierarchy
foo/bar/baz
assuming that foo, bar, and baz are directories) and they have the following ownership (user ID), group ID, and permissions (represented in octal):
Users 612 and 1219 are both members of group 75, so all their processes run with that group ID.
Which of the following commands will fail due to a permission error (assuming that the commands are issued from the parent directory of foo)? Select all that apply.
The kill command-line utility invokes the kill system call, which can be used, among other things,
to make another process terminate.
When a user runs kill to terminate another process using its process ID,
at what point(s) does the processor switch into kernel (privileged) mode?
Select all that apply.