Operating System Architecture Set 25

On This Page

This set of Operating System Architecture Multiple Choice Questions & Answers (MCQs) focuses on Operating System Architecture Set 25

Q1 | The statement z = ‘expr 5 / 2′ would storewhich of the following values in z?
  • 0
  • 1
  • 2
  • 2.5
Q2 | The expression expr -9 % 2 evaluates to:
  • 0
  • 1
  • -1
  • 2
Q3 | What is the output of the following program?b =[ -n $b ]echo $? [ -z $b ]echo $?
  • 1 1
  • 2 2
  • 0 0
  • 0 1
Q4 | What is the output of the following program? [ -n $HOME ]echo $?[ -z $HOME ]echo $?
  • 0 1
  • 1 0
  • 0 0
  • 1 1
Q5 | What is the output of the following program? x = 3; y = 5; z = 10;if [( $x -eq 3 ) -a ( $y -eq 5 -o $z -eq 10 )] thenecho $x elseecho $yfi
  • 1
  • 3
  • 5
  • error
Q6 | What is the return value ($?) of this code:os = Unix[$osName = UnixName] && exit 2 [${os}Name = UnixName] && exit 3
  • 0
  • 1
  • 2
  • 3
Q7 | What is the output of the following code: s=Unixecho 1.$os 2."$os" 3.'$os' 4.$os
  • 1.unix 2.unix 3.unix 4.unix
  • 1.unix 2.unix 3.$os 4.unix
  • 1.unix 2.unix 3.unix 4.$os
  • 1.unix 2.$os 3.$os 4.$os
Q8 | which of these is NOT a valid variable in bash
  •      (double underscore)
  • _1var (underscore 1 var )
  • _var_ (underscore var underscore)
  • some-var (some hyphen var)
Q9 | What will be output of following command:$ echo "The process id is" $$$$
  • the process id is $$
  • the process id is$$
  • the process id is
  • the process id is$$$$
Q10 | 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
  • /home/user1/proj
  • /home/user1/proj/sr c
  • /home/user1
  • /home/user1/proj/src/generic
Q11 | How do you print the lines between 5 and 10, both inclusive
  • cat filename | head | tail 6
  • cat filename | head | tail -5
  • cat filename | tail+5 | head
  • cat filename | tail-5 | head -10
Q12 | Create a new file “new.txt” that is a concatenation of “file1.txt” and “file2.txt”
  • cp file.txt file2.txt new.txt
  • cat file1.txt file2.txt> new.txt
  • mv file[12].txt new.txt
  • ls file1.txt file2.txt | new.txt
Q13 | If a file with execute permissions set, but with unknown file format is executed
  • the file is passed to/bin/sh
  • the system returns an error
  • the current shell will try to execute it
  • none of the mentioned
Q14 | Which of the following is true?
  • shell is a process and can be started by superuser only
  • shell is a built-in kernel functionality
  • shell is a wrapper for all the commands and utilities
  • none of the mentioned
Q15 | Which is true with regards to the shell prompt
  • it can be accidentally erased with backspace
  • the prompt cannot be modified
  • the prompt can be customized (modified)
  • none of the mentioned
Q16 | What is a shell in UNIX?
  • a program through which users can issue commands to unix
  • a window management system
  • the login screen
  • the thing that rides on the back of a turtle in unix
Q17 | Which of the following represents an absolute path?
  • ../home/file.txt
  • bin/cat
  • cs2204/
  • /usr/bin/cat
Q18 | The user bhojas logged in and performed the following sequence of command. What will be the output of the last command? $ cd project/module1$ pwd
  • /home/bhojas/project/m odule1
  • /home/project/mod ule1
  • /usr/bhojas/project/module1
  • project/module1
Q19 | BASH shell stands for?
  • bourne-again shell
  • basic access shell
  • basic to advanced shell
  • big & advanced shell
Q20 | Which of the following files will not be displayed by the command cat re* ?
  • reminder
  • receipt
  • receipt
  • recipe-cake
Q21 | The redirection 2> abc implies
  • write file 2 to file abc
  • write standard output to abc
  • write standard error to abc
  • none of the mentioned
Q22 | cmd 2>&1 > abc will
  • write file2 to file1
  • write standard output and standard error to abc
  • write standard error to abc
  • write standard output to abc & standard error to monitor
Q23 | cmd > abc 2>&1 will
  • write file2 to file1
  • write standard output and standard error to abc
  • write standard error to abc
  • write standard output to abc & standard error to monitor
Q24 | Which of these is the correct method for appending “foo” in /tmp/bar file?
  • echo foo > /tmp/bar
  • echo foo >>/tmp/bar
  • echo foo |/tmp/var
  • /tmp/bar < echo foo
Q25 | Syntax to suppress the display of command error to monitor?
  • command > &2
  • command 2> &1
  • command 2> &2
  • command 2>/dev/null