Answers - OS LAB QUIZ
Answers - OS LAB QUIZ
2. What would be the current working directory at the end of the following command sequence?
$ pwd
/home/user1/proj
$ cd src
$ cd generic
$ cd .
$ pwd
a) /home/user1/proj
b) /home/user1/proj/src
c) /home/user1
d) /home/user1/proj/src/generic
a) uname –r
b) uname –n
c) uname –t
d) kernel
a) :q
b) :s
c) :w
d) None of these
5. Which of the following can be used as shorthand for test?
a) ( )
b) esac
c) [ ]
d) fi
6. The statement z=`expr 5.0 / 2.0` would store which of the following values in z?
a) 1
b) 2
c) 2.5
d) Gives Error
a) $0
b) $#
c) $*
d) $?
8.With a umask value of 202, what is the default permission assigned to newly created regular
file in bash shell?
a) –rwxr--rwx
b) -r--rwx-r--
c) -r-xrwx-r-x
d) –r--rw-r--
9.Which of these commands will set the permissions on file textfile to read and write for the
owner, read for the group, and nothing for everyone else?
a) The process id is $$
b) The process id is $<pid>$<pid>
c) The process id is <pid><pid>
d) The process id is $$$$
11. Which variable contains last background job process id?
a) $*
b) $?
c) $$
d) $!
12. With a umask value of 202, what is the default permission assigned to newly created
directory in bash shell?
a) drwxr--rwx
b) dr--rwx-r--
c) dr-xrwx-r-x
d) dr--rw-r--
13.Assuming the files fileA, fileB, fileAB, fileBC and fileABC, exist in a directory, which files
match with the pattern “file[ABC]”
14.Which command is used to count the number of directories in the current directory?
a) ls -d | wc –c
b) ls –l | grep -c “^d”
c) ls –l | grep “^d”
d) All of these
15. The statement z=`expr 5 / 2` would store which of the following values in z?
a) 1
b) 2
c) 2.5
d) Gives Error
16. Which variable will display the list of the positional parameters?
a) $@
b) $*
c) $?
d) None of these
17. Which option of rmdir command will remove all directories a, b, c if path is a/b/c
a) –r
b) –o
c) –p
d) –t
18. Which command is used to count the number of directories in the current directory?
a) ls -d | wc –c
b) ls –l | grep -c “^d”
c) ls –l | grep “^d” | wc –l
d) ls –d | grep -c
19. When trying to compare two files using cmp, if the files differ; what is the output?
a) ksh
b) tcsh
c) csh
d) echo
e) All of these
21. Which command is used to count the number of directories in the current directory?
a) ls -d | wc –c
b) ls –l | grep -c “^d”
c) ls –l | grep “^d” | wc –n
d) ls –l | grep “^d” | wc –l
a) /etc
b) /
c) /home
d) None of these
23. Execution of the command “mkdir test” at dollar prompt results into the following “mkdir: Failed to
make directory “test” ”; Permission denied.
This can happen due to which reason.
24. When we enter the password, the system performs the encryption. Where, encryption generates a
string of seemingly random characters that UNIX/LINUX subsequently uses to determine the authenticity
of a password. This encryption is stored in a file named shadow in the directory titled.
a. /etc
b. /bin
c. /var
d. /lib
25.echo in Bash Linux interprets the escape sequences with which of the following options.
a. e
b. m
c. l
d. x
a) 0
0
b) 1
0
c) 1
1
d) 0
1
27. How can you search for blank line in a file?
a) $ grep “ “ file
b) $ grep “^$” file
c) $ grep [“ “] file
d) $ grep [^$] file
a. 0
b. 1
c. 2
d. none of the above
30. Suppose currently I am in directory /home/csed/labquiz/os. After executing cd ../. where am I now?
a) /home
b) /home/csed
c) /home/csed/labquiz
d) /home/csed/labquiz/os