Featured
- Get link
- X
- Other Apps
GATE QUESTIONS
1.Which one or more of the following options guarantee that a computer system will transition from user mode to kernel mode?
A. Function Call
B. malloc Call
C. Page Fault
D. System Call
answer---(C & D)
2.Which of the following standard C library functions will always invoke a system call when executed from a single-threaded process in a
UNIX/Linux operating system?
A.exit
B.malloc
C.sleep
D.strlen
answer---(A & C)
3.The following C program is executed on a Unix / Linux system:
#include < unistd.h >
int main() {
int i;
for (i = 0; i < 10; i++)
if (i % 2 = = 0) fork();
return 0;
}
The total number of child process created is:
A.31
B.63
C.5
D.6
answer---(A)
4.The difference between a named pipe and a regular file in Unix is that
A.Unlike a regular file, named pipe is a special file
B.The data in a pipe is transient, unlike the content of a regular file
C. Pipes forbid random accessing, while regular files do allow this.
D. All of the above
answer---(D)
5.The following C program:
{
fork(); fork(); printf("yes");
}
If we execute this core segment, how many times the string yes will be printed?
A.Only once
B.2 times
C.4 times
D.8 times
answer---(C)
6.The Linux command:
mknod myfifo b 4 16
A. will create a character device if user is root
B. will create a named pipe FIFO if user is root
C. will create a block device if user is root
D. None of these
answer---(C)
7.What is the output of the following program?
main()
{
int a = 10;
if (fork()== 0))
a++;
printf("%d\n", a);
}
A.10 and 11
B.10
C.11
D.11 and 11
answer---(A)
8.Consider the following program.
main()
{
fork();
fork();
fork();
}
How many new processes will be created?
A.8
B.6
C.7
D.5
answer---(C)
9.Identify the correct order in which a server process must invoke the function calls accept, bind, listen, and recv according to UNIX
socket API.
A.listen, accept, bind, recv
B.bind, listen, accept, recv
C.bind, accept, listen, recv
D.accept, listen, bind, recv
answer---(B)
10.A process executes the code
fork();
fork();
fork();
The total number of child processes created is
A.3
B.4
C.7
D.8
answer---(C)
11.Which of the following UNIX command allows scheduling a program to be executed at the specifies time?
A.cron
B.nice
C.date and time
D.schedule
answer---(A)
12.Fork is
A.the creation of a new job
B.the dispatching of a task
C.increasing the priority of a task
D.the creation of a new process
answer---(D)
13.Consider the execution of the following commands in a shell on a Linux operating system.
bash$ cat alpha
Mathematics
bash$ In alpha beta
bash$ rm alpha
bash$ cat >> beta << SAME
Information Technology
SAME
bash$ cat beta
The output of the last command will be:
A.Mathematics Information Technology SAME
B.Mathematics Information Technology
C.Information Technology
D.Information Technology SAME
answer---(D)
14.A process executes the following code
for (i = 0; i < n; i + + ) fork( ) ;
The total number of child processes created is:
A.n
B.2^n -1
C.2^n
D.2^n+1 -1
answer---(B)
15.A client process P needs to make a TCP connection to a server process S. Consider the following situation: the server process S
executes a socket(), a bind() and a listen() system call in that order, following which it is preempted. Subsequently, the client process P
executes a socket() system call followed by connect() system call to connect to the server process S. The server process has not
executed any accept() system call. Which one of the following events could take place?
A.connect() system call returns successfully
B.connect() system call blocks
C.connect() system call returns an error
D.connect() system call results in a core dump
answer---(C)
16.Which of the following system calls results in the sending of SYN packets?
A.socket
B.bind
C.listen
D.connect
answer---(D)
17.The contents of the text file tl txt containing four lines are as follows :
a1 bl
a2 b2
a4 bl
The contents of the text file t2 txt containing five lines are as follows :
a1 cl
a4 c3
a5 c4
Consider the following Bourne shell script :
awk - F ' ' ' {Print $1, $2} 'tl.txt |
while read a b ;do
awk -v aV = $ a- v by = $b - F''
aV = = $1 (print aV,bV, $2)'t2. txt
done
Which one of the following strings will NOT be present in the output generated when the above script in run? (Note that the given
strings may be substrings of a printed line.)
A."bl cl "
B."bl c3"
C."b1 c2"
D."b1 c3"
answer---(C)
18.A user level process in Unix traps the signal sent on a Ctrl-C input, and has a signal handling routine that saves appropriate files
before terminating the process. When a Ctrl-C input is given to this process, what is the mode in which the signal handling routine
executes?
A.User mode
B.Kernel mode
C.Superuser mode
D.Privileged mode
answer---(D)
19.The shell command:
find -name passwd -print
is executed in /etc directory of a computer system running Unix. Which of the following shell commands will give the same
information as the above command when executed in the same directory?
A.Is passwd
B.cat passwd
C.grep name passwd
D.grep print passwd
answer---(C)
20.A student wishes to create symbolic links in a computer system running Unix. Three text files named "file 1
"file 2" and "file 3" exist in
her current working directory, and the student has read and write permissions for all three files. Assume that file 1 contains
information about her hobbies, file 2 contains information about her friends and file 3 contains information about her courses. The
student executes the following sequence of commands from her current working directory.
In -s file 1 file 2
In -s file 2 file 3
Which of the following types of information would be lost from her file system?
I.Hobbies
II.Friends
III.Courses
A.I and II only
B.II and III only
C.II only
D.I and III only
answer---(B)
- Get link
- X
- Other Apps
Comments
Post a Comment