Introduction to Linux II Chapter 2

Introduction to Linux II Chapter 2 Exam Answer

CCNA7.COM had tried to collect all chapter exam from candidate who has already taken exam.  There are 26 questions in Introduction to Linux II Chapter 2. Our team has modified and corrected all answers with 100% score before we published on this page. In Introduction to Linux II Chapter 2 exam, you should review all questions again and again before go to take online exam with NDG system.

  1. Question ID 1099

    Which of the following steps is NOT performed while creating a shell script?

    • Create a file with commands
    • Make the file executable
    • Login as root on the server console
    • Put #!/bin/bash as the first line
  2. Question ID 1100

    The first line in a shell script reads:

    #!/bin/bash

    What does it signify?

    • It is a comment
    • The executable (shell) to use to run the script
    • Name of the editor used to create the file
    • The script requires root login
  3. Question ID 1101

    The command bash script_file can be used to directly execute a shell script.

    True or False?

    • True
    • False
  4. Question ID 1102

    Which of the following is placed before a script name to execute it from the current directory?

    • #!
    • !!
    • ./
    • //
  5. Question ID 1103

    Instead of specifying the current directory, it is better to place the script in a location that is included in the __________ variable.

    • SCRIPTS
    • ENV
    • GLOBAL
    • PATH
  6. Question ID 1104

    An ideal place for a regular user (not a super user), to place their shell scripts would be:

    • /sbin
    • /home/john/bin
    • /usr/local/sbin
    • /bin
  7. Question ID 1105

    Use of SETUID permission on scripts is the best way to specify permissions.

    True or False?

    • True
    • False
  8. Question ID 1106

    A user has written a few scripts for private use. Which of the following commands should be used so that no one else has execute permission?

    • chmod u-rx script_file
    • chmod u+x script_file
    • chmod -R 755 script_file
    • chmod a+x script_file
  9. Question ID 1107

    Which of the following commands will produce the same result as start=`date`?

    • start=date
    • start=%date%
    • start=$(date)
    • start=(date)
  10. Question ID 1108

    The __________ statement can be used to gather information from the user running the script.

    • read
    • for
    • seq
    • if
  11. Question ID 1110

    The command read –p will capture the current position of the mouse pointer.

    True or False?

    • True
    • False
  12. Question ID 1111

    Conditional statements CANNOT be used to determine which of the following?

    • System runlevel
    • If the file exists
    • If two strings match or not
    • If two numeric values match
  13. Question ID 1112

    When will the condition test –n STRING be true?

    • If the length of STRING is nonzero
    • If the length of STRING is zero
    • Never
    • Always
  14. Question ID 1113

    In shell scripts, the conditional statement if must always end with:

    • then
    • elif
    • fi
    • False condition
  15. Question ID 1114

    The return status from a command is 1. What does this indicate?

    • Calculation done by the command yields the result 1
    • Command is still running in the background
    • Command executed successfully
    • Command did not execute successfully
  16. Question ID 1115

    A user jamie already exists in the system. The command grep jamie /etc/passwd displays one user record. Running the echo $? command immediately after the grep command would result in what output?

    • 5
    • 1
    • 2
    • 0
  17. Question ID 1116

    Which of the following will NOT handle bad user input properly:

    • Checking the value of the $? variable using an if statement
    • Checking the validity of user input before passing it on to the command
    • Checking the return value of a command directly in the conditional part of the if statement
    • Checking the command’s Standard Output
  18. Question ID 1117

    A user wants an email sent when his shell script is executed successfully. Which of the following commands in the script can do this?

    • mail root
    • echo $mail
    • mail brad
    • cron job will send an email by default
  19. Question ID 1118

    The __________ statement is most useful in performing an operation on multiple items.

    • read
    • for
    • test
    • many
  20. Question ID 1119

    What will the following statement do?

    for name in `cat /root/users`

    • Get into an infinite loop
    • Assign to the name variable each value in the specified file
    • Run for two values cat and /root/users
    • Report an error
  21. Question ID 1120

    The output of the command seq 10 10 30 will be:

    • 50
    • 10 10 30
    • 10 20 30
    • 3
  22. Question ID 1121

    The ___________ command is used to print a sequence of numbers.

    • seq
    • series
    • num
    • list
  23. Question ID 1122

    The statement if [ -d file ] will be true, if the file:

    • Is executable
    • Exists
    • Is writable
    • Is a directory
  24. Question ID 1123

    Which of the following file test statement conditions is NOTcorrect?

    • -d filename tests if the file is in the current directory
    • -x filename tests a file to determine if it is executable
    • -w filename tests a file to determine if it is writable
    • -e filename tests if the file exist
  25. Question ID 1124

    A user wants to execute a script called test1_script. What type of permission does she need on the test1_script file?

    • Read and execute
    • Read and write
    • Read only
    • Write only
  26. Question ID 1125

    Command substitution can be used to insert the output of a command as another command’s argument.

    True or False?

    • True
    • False

Comments

comments