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)
Cross
II and III
Tick
II and IV
Cross
l and III
Cross
II only


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
Cross
(I) and (II) only
Tick
(II) and (III) only
Cross
(II) only
Cross
(I) and (III) only


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?  
Cross
ls passwd
Cross
cat passwd
Tick
grep name passwd
Cross
grep print passwd


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?
Tick
kernel mode
Cross
superuser mode
Cross
privileged mode
Cross
user mode


Question 5

Consider the following statements : 

(a) UNIX provides three types of permissions 
* Read 
* Write 
* Execute 

(b) UNIX provides three sets of permissions 
* permission for owner 
* permission for group 
* permission for others 

Which of the above statement/s is/are true?

Cross

only (a)

Cross

only (b)

Tick

Both (a) and (b)

Cross

Neither (a) nor (b)



Question 5-Explanation: 

UNIX provides Read, Write and Execute permission on files UNIX provides three sets of permissions

  • permission for owner
  • permission for group
  • permission for others

For more information on UNIX OS Refer: Operating System | Unix File System
Both (a) and (b) are correct.

So, option (C) is correct.

Question 6
Match the following WINDOWS system calls and UNIX system calls with reference to process control and File manipulation. 4
Tick
(1)
Cross
(2)
Cross
(3)
Cross
(4)


Question 6-Explanation: 
  1. In UNIX Wait() is used to WaitForSingleObject() .
  2. In UNIX Fork() is used for create-process().
  3. In UNIX Create() is used for CreateFile().
  4. In UNIX Close() is used for CloseHandle()
  5. So, option (A) is correct.
Question 7
The linux command “mknod myfifo b 4 16”
Cross
Will create a character device if the user is root
Cross
Will create a named pipe FIFO if the user is root
Tick
Will create a block device if the user is root
Cross
None of the above


Question 8
Which statement is not correct about “init” process in Unix?
Cross
It is generally the parent of the login shell.
Cross
It has PID 1.
Tick
It is the first process in the system.
Cross
Init forks and execs a ‘getty’ process at every port connected to a terminal.


Question 8-Explanation: 
"init"(short for initialization) process in UNIX have:
  1. process id (PID) = 1
  2. It is generally the parent of the login shell.
  3. "init" forks and execs a ‘getty’ process at every port connected to a terminal.
  4. But it is not the first process in the system
  5. So, option (C) is correct.
Question 9
Unix command to change the case of first three lines of file “shortlist” from lower to upper
Cross
$ tr ‘[a – z]’ ‘[A – Z]’ shortlist ¦ head-3
Tick
$ head-3 shortlist ¦ tr ‘[a – z]’ ‘[A – Z]’
Cross
$ tr head -3 shortlist ‘[A – Z]’ ‘[a – z]’
Cross
$ tr shortlist head -3 ‘[a – z]’ ‘[A – Z]’


Question 10
Match the following vi commands in Unix: 75
Cross
(1)
Cross
(2)
Cross
(3)
Tick
(4)


Question 10-Explanation: 
  1. w vi command in unix saves file and remains in editing mode.
  2. x vi command in unix saves the file and quits editing mode
  3. q vi command in unix quits editing mode and no changes are saved to the file
  4. sh vi command in unix escapes unix shell
  5. So, option (D) is correct.
There are 32 questions to complete.

  • Last Updated : 03 Oct, 2019

Share your thoughts in the comments
Similar Reads