Unix Programming And Shell Scripting Test! Trivia Quiz

25 Questions | Total Attempts: 5381

SettingsSettingsSettings
Please wait...
Unix Programming And Shell Scripting Test! Trivia Quiz

What do you know about Unix programming and shell scripting? Shell scripting is an open-source computer program created to be run by the Unix/ Linux shell. The program devises a series of plans for the shell to execute. The typical operations performed by Shell Scripting include file manipulation, program execution, and printing text. If you choose to learn more about Unix programming and shell scripting, try this quiz.


Questions and Answers
  • 1. 
    How can you append the output of a command to a file?
    • A. 

      Command > file

    • B. 

      Command >> file

    • C. 

      Command file

    • D. 

      Command < file

  • 2. 
    With what command you can see what folder you are in?
    • A. 

      Whereami

    • B. 

      Place

    • C. 

      Map

    • D. 

      Pwd

  • 3. 
    How do you delete a file?
    • A. 

      Rm filename

    • B. 

      Dl filename

    • C. 

      Touch filename

    • D. 

      Less filename

  • 4. 
    How do you get all files with on the 3rd place an r, g or i?
    • A. 

      Ls ?3[rgi]*

    • B. 

      Ls *[rgi]*

    • C. 

      Ls [..i*]

    • D. 

      Ls ??[rgi]*

  • 5. 
    What command do you have to use to go to the parent directory?
    • A. 

      Cd -

    • B. 

      Cd /up

    • C. 

      Cd ~

    • D. 

      Cd ..

  • 6. 
    With what command you can see your user name?
    • A. 

      Pwd

    • B. 

      I

    • C. 

      Whoami

    • D. 

      Me

  • 7. 
    With what can you stop a process?
    • A. 

      Kill

    • B. 

      Delete

    • C. 

      Stop

    • D. 

      Shutdown

  • 8. 
    What does the command ls do?
    • A. 

      Shows a calendar

    • B. 

      Display of files and folders, present in the folder where you are

    • C. 

      Opening a file

    • D. 

      Display of the contents of a file

  • 9. 
    What do you use to forward errors to a file?
    • A. 

      2> /dev/null

    • B. 

      &> filename

    • C. 

      1> filename

    • D. 

      2> filename

  • 10. 
    How can you display a list of all files, including the hidden files?
    • A. 

      Ls -a

    • B. 

      Find -a

    • C. 

      Find all

    • D. 

      All

  • 11. 
    What is the difference between "Thread" and "Process"?
    • A. 

      A process is a collection of virtual memory space, code, data, and system resources. A thread is code that is to be serially executed within a process.

    • B. 

      A processor executes Processes , not Threads

    • C. 

      Process – is stream of executable code within Thread

    • D. 

      Process has its own set of register including program counter,stack pointer

  • 12. 
    How will you list only the empty lines in a file (using grep)?
    • A. 

      Grep “$^” filename.txt

    • B. 

      Grep “$” filename.txt

    • C. 

      Grep “^$” filename.txt

    • D. 

      Grep $^ filename.txt

  • 13. 
    How do you read arguments in a shell program?
    • A. 

      $0 would be the first line argument, $1 would be the Second command line argument, $2 the Third, and so on

    • B. 

      $1 would be the first command line argument, $2 the second, and so on $0 is the name of the script or function

    • C. 

      Both a and b are correct

    • D. 

      Both a and b are incorrect

  • 14. 
    Which of the following is NOT proper shell name?
    • A. 

      Csh : C shell

    • B. 

      Ksh : Korn Shell

    • C. 

      Bash : bourne again shell

    • D. 

      Ssh : sea shell

  • 15. 
    In Shell scripting What does does $? Return?
    • A. 

      $? will return exit status of command .0 if command gets successfully executed ,non-zero if command failed.

    • B. 

      $? will return exit status of command .Non-0 if command gets successfully executed ,zero if command failed.

    • C. 

      System error

    • D. 

      Invalid command

  • 16. 
    In Shell scripting What does $# stand for?
    • A. 

      Will return no of error

    • B. 

      # will return the number of parameters that are passed as the command-line arguments.

    • C. 

      Error

    • D. 

      All the above are incorrect

  • 17. 
    In Shell scripting what is  $*?
    • A. 

      Its mainly used for showing up all params. This show few parameter values passed in shell script.

    • B. 

      Its mainly used for showing up all params. This show all values returned.

    • C. 

      Its mainly used for showing up all params. This show all parameter values passed in shell script.

    • D. 

      None of the above is correct.

  • 18. 
    How can you get/set an environment variable from a program?
    • A. 

      Getenv() and putenv()

    • B. 

      Getenv() and setenv()

    • C. 

      Readenv and putenv()

    • D. 

      Readenv() and setenv()

  • 19. 
    To change mode of myfile to 'rwxr–r–'  , the command used is
    • A. 

      Chmod(myfile,0742).

    • B. 

      Chmod(myfile,0474).

    • C. 

      Chmod(myfile,0747).

    • D. 

      Chmod(myfile,0744)

  • 20. 
    All UNIX files have its description stored in a structure called 'inode'. which of the below fields are not part of the inode.
    • A. 

      File access count

    • B. 

      File owner identifier

    • C. 

      File type

    • D. 

      File access permissions

  • 21. 
    Which of the below commands NOT used to view the contents of a file?
    • A. 

      Ls command

    • B. 

      Cat command

    • C. 

      More command

    • D. 

      Disp command

  • 22. 
    Unix identifies every process by a Process Identification Number (PID) which is assigned when the process is initiated. When we want to perform an operation on a process, we refer to it by its PID or ProcessId.
    • A. 

      True

    • B. 

      False

  • 23. 
    How do you find out what’s your shell?
    • A. 

      Whomami

    • B. 

      Pwd

    • C. 

      Echo $SHELL

    • D. 

      $sh

  • 24. 
    What is the command to count words, lines, and characters in a file? (Just type command name only)
  • 25. 
    Fork() command used to create a new process. 
    • A. 

      True

    • B. 

      False

Back to Top Back to top