Quiz
Week 8 - Quiz 2
Create a free account to finish this quiz
Save your progress and see your final score.
Already have an account? Sign in
Questions in this quiz (20)
1[Process2] Signals provide a way of handling ___ events
- Adeadlocked
- Bracing
- Casynchronous
- Dsynchronous
- Eidle-process
2
[Process2] A file ___ is normally small non-negative integer that the kernel uses to identify the files accessed by a process.- Abuffer
- Btable
- Cdescriptor
- Di-node
- Eentry
3[Process2] When a process calls this API call (or one of these API calls), that process is completely replaced by the new program, and the new program starts executing at its main function.
It merely replaces the current process its text, data, heap, and stack segments with a brand-new program from disk.- Afork
- Bexec
- Cpipe
- Ddup
- Esystem
4[Process2] The new file descriptor returned by dup is guaranteed to be the ___ numbered available file descriptor
- Alowest
- Bhighest
- Cfixed
- Dstack
- Earbitrary
5
[Process2] Given fork program as shown below, what would be the total number of processes at the end including the process running this program.
for (i=1; i < nprocs; i++) { childpid = fork(); }
When nprocs = 3, then the total number of processes after this code will be ____- A1
- B2
- C4
- D8
- E16
6[Process2] The new process created by fork is called the child process. This function is called once but returns ___.
- Anone
- Bonce
- Ctwice
- Dthree times
- Eas many as needed
7
[Process2] After fork, the return value for the child is ___- A-1
- B0
- C+1
- Da new process ID for the child process
- Ethe process id of the parent process
8
[Process2] ___ is a type of file that points to another file.- Asymbolic link
- Bdirectory file
- CFIFO
- Dpipe
- Edupe
9[Process2] This instruction ___ takes two (file descriptor) arguments, to duplicate the first one (file descriptor) to be set for the second one.
- Ahidden
- Bdup
- Cdup2
- Dfd
- Epipe
10
[Process2] Including the initial parent process, the total number of the processes (in total) will be ____ after executing the code segment below.
if (fork()) fork();- A1
- B2
- C3
- D4
- E0
11
[Process2] What would be a proper way to set a signal handler (sig_int) for SIGINT?- ASIGINT(sig_int);
- Bsigint(SIGINT);
- CSIGINT(signal, sig_int);
- Dsignal(SIGINT, sig_int);
- Esignal(sig_int, SIGINT);
12[Process2] After fork, the return value for the parent process is ___
- A-1
- B0
- C+1
- Dthe child process id
- Ethe process id of the parent process
13
[Process2] If a process needs a child process to do some of its work, it will call ___ to make a copy of the current process.- Adup
- Bclone
- Cthread
- Dfork
14
[Process2] Including the initial parent process, the total number of the processes (in total) will be ____ after executing the code segment below.
if (pid=fork()) {fork();}
if (pid=fork()) {fork();}
if (pid=fork()) {fork();}- A8
- B9
- C16
- D27
- E32
15
[Process2] For a convenience, ___ call is used to execute a command string (e.g., "ls -la | wc") within a program.- Athread
- Bprocess
- Cpipe
- Dfork
- Esystem
16
[Process2] The ____ contains all the information about the file: the file type, the file's access permission bits, the size of the file, pointers to the file's data blocks, and so on.- Acylinder
- Bdisk
- Cfile block
- Di-node
- Edup
17
[Process2] By convention, all shells in Unix open ___ file descriptors whenever a new program is run.- A0
- B1
- C2
- D3
- E4
- Fas many as needed
18
[Process2] Including the initial parent process, the total number of the processes (in total) will be ____ after executing the code segment below.
if (fork() < 0) {fork();}- A1
- B2
- C3
- D4
- E0
19[Process2] Including the initial parent process, the total number of the processes (in total) will be ____ after executing the code segment below.
fork(); fork(); fork();- A1
- B4
- C6
- D8
- E16
20[Process2] Consider a code segment for a pipe (e.g., to run "ls | wc") as we discussed in the classes, shown below.
What would it be the code segment for the "parent" process here after the fork but before exec (of "ls" or "wc")?
- Aclose(pfd[0]); dup2(pfd[1], 1); close(pfd[1]);
- Bclose(pfd[0]); dup2(pfd[1], 0); close(pfd[1]);
- Cclose(pfd[1]); dup2(pfd[0], 1); close(pfd[0]);
- Dclose(pfd[1]); dup2(pfd[0], 0); close(pfd[0]);
Information
- Description
- test 2 UNIX Quiz on Week 8 - Quiz 2, created by hassy saade on 17/10/2018.
- Author
- hassy saade
- Language
- English
- Views
- 31
- Tags
- Rating
- No ratings yet Rate this quiz