System Call


Q21.

Identify the correct order in which a server process must invoke the function calls accept, bind, listen, and recv according to UNIx socket API.
GateOverflow

Q22.

The contents of the text file t1 txt containing four lines are as follows : a1 b1 a2 b2 a3 b2 a4 b1 The contents of the text file t2 txt containing five lines are as follows : a1 c1 a2 c2 a3 c3 a4 c3 a5 c4 Consider the following Bourne shell script :awk - F ' ' ' {Print $1, $2} ' t1.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.)
GateOverflow

Q23.

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?
GateOverflow

Q24.

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?
GateOverflow

Q25.

Consider the following code fragment: if (fork() == 0) { a = a + 5; printf("%d,%dn", a, &a); } else { a = a - 5; printf("%d, %dn", a, &a); } Let u, v be the values printed by the parent process, and x, y be the values printed by the child process. Which one of the following is TRUE?
GateOverflow

Q26.

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:
GateOverflow

Q27.

A process executes the following codefor (i = 0; i < n; i + +) fork( );The total number of child processes created is
GateOverflow

Q28.

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. ln -s file 1 file 2 ln -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
GateOverflow

Q29.

Which of the following system calls results in the sending of SYN packets?
GateOverflow

Q30.

A process executes the following segment of code : for(i = 1; i <= n; i++) fork (); The number of new processes created is
GateOverflow