Correct ans
Question 1To determine if the system shell is available or not you would use the following invocation:
Correct!
if(system(NULL)) {...}
if(system("shell")) {...}
if(system("NULL")) {...}
if(system("")) {...}
Question 2
1 / 1 pts
Which of the following main() function's headers is valid?
Correct!
int main(int argc, char *argv[], char **env)
int main(int argc, char *argv[], char ***env)
int main(int argc, char *argv[], char env)
int main(int argc, char *argv[], char *env)
Question 3
1 / 1 pts
After successful invocation the fork() function:
returns 0 in parent and parent's PID in child
Correct!
returns 0 in child and child's PID in parent
returns 0 in both child and parent
returns child's PID in parent and parent's PID in child
Question 4
1 / 1 pts
Assuming that the code was compiled and ran in Unix/Linux environment what is its expected output?
#include <stdio.h>
#include <unistd.h>
int x = 0;
int main(void) {
if(fork()) {
printf("%d", ++x);
return 0;
} else {
printf("%d", ++x);
return 0;
}
}
Correct!
11
12
21
22
Question 5
1 / 1 pts
A variant of exec() function designed to pass a copy of environment to new process as well as using PATH to find the executable and accepting arguments placed in an array, is named:
execlp
Correct!
execvpe
execl
execlpe
Question 6
1 / 1 pts
A native Unix/Linux functions named wait() and waitpid() in the MS Windows environment:
are not needed due to different processes' serving philosophy
are replaces by Wait() and WaitPid() functions
have the same names and purpose
Correct!
may be substituted by WaitForSingleObject() function
Question 7
1 / 1 pts
Which of the "C" programming language standards offers built-in thread implementation?
C99
Correct!
C11
ANSI C
C89
Question 8
1 / 1 pts
In the MS Windows threads a single thread is represented as a value of type:
thread_t
thrd_t
Correct!
HANDLE
msthread_t
Question 9
1 / 1 pts
In MS Windows environment, if the main thread wants to wait for all other thread completion, it:
must use a number of subsequent invocations of WaitForSingleObject() function
uses Sleep() function
Correct!
may use the WaitForMultipleObjects() function
spends some time in an empty delay loop
Question 10
1 / 1 pts
The WINAPI specifier means that the function:
Correct!
is an obsolete implementation of standard Windows service
is not accessible from outside
uses standard MS Windows calling convention
is a static function
Question 11
1 / 1 pts
What is possible result of the following invocation?
#include <stdlib.h>
int main(int argc, char *argv[]) {
system(argv[0\]);
return 0;
}
stack overflow error
compiler error
OS shell error
Correct!
infinitive loop of launches
Question 12
1 / 1 pts
The third main() function parameter is:
a pointer to array containing argc pointers to environment variables
Correct!
a pointer to a NULL-terminated array of pointers to environment
a NULL-terminated array of pointers to environment variables
a pointer to first environment variable
Question 13
1 / 1 pts
Assuming that the following snippet is executed in MS Windows environment, its effect is:
putenv("VAR=");
setting the VAR's value to empty string
nothing
print the VAR's value to stdout
Correct!
removing the VAR from environment
Question 14
1 / 1 pts
Assuming that the code was compiled and ran in Unix/Linux environment what is its expected output?
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
int main(void) {
printf("%d", fork() == 0);
wait(NULL);
return 0;
}
1 or 0
Correct!
10 or 01
always 00
always 11
Question 16
1 / 1 pts
The MS Windows' HANDLE data type:
is the same as Unix/Linux PID
Correct!
is an unique resource identifier and plays different role than PID
is a string with process name and plays different role than PID
is a structure containing PID
Question 17
1 / 1 pts
A thread, in P-thread sense, is a function of type:
Correct!
void *thread(void *data);
void thread(void *data);
int thread(void *data);
void *thread(void);
Question 18
1 / 1 pts
In the MS Windows threads a single thread is represented as a value of type:
Correct!
HANDLE
msthread_t
thrd_t
thread_t
No comments:
Post a Comment