1

UNIX

Question 1
Which of the following commands or sequences of commands will rename a file x to file y in a Unix system? I. mv y, x II. mv x, y III. cp y, x (rm x) IV. cp x, y (rm x)
A
II and III
B
II and IV
C
l and III
D
II only
UNIX    GATE-IT-2004    
Discuss it


Question 1 Explanation: 
I. mv y, x                        //will move contents of file x to file y II. mv x, y                      //will move contents of file y to file x III. cp y, x (rm x)         //will copy  file x to file y (removal of x after the command) IV. cp x, y (rm x)         //will move contents file y to file x (removal of x after the command)   Hence Answer B
Question 2
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
A
(I) and (II) only
B
(II) and (III) only
C
(II) only
D
(I) and (III) only
UNIX    Gate IT 2005    
Discuss it


Question 3
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
ls passwd
B
cat passwd
C
grep name passwd
D
grep print passwd
UNIX    Gate IT 2005    
Discuss it


Question 3 Explanation: 

Find is a Unix (or Linux) command used for searching the files in a directory hierarchy. The syntax of find command is :
find –name “filename” –print

Grep is a unix command which can be used to find file names with a watching string. The syntax of grep command is :
grep name “filename”

 
Thus, option (C) is correct.
 
Please comment below if you find anything wrong in the above post.
Question 4
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
kernel mode
B
superuser mode
C
privileged mode
D
user mode
UNIX    Gate IT 2005    
Discuss it


There are 4 questions to complete.
1

Company Wise Coding Practice    Topic Wise Coding Practice