Question

In: Computer Science

1. Your organization routinely uses scripts, but as some employees have left, there are scripts that...

1. Your organization routinely uses scripts, but as some employees have left, there are scripts that contain only command lines and no one is certain of their purpose.What steps can be taken to ensure a way for others to know the purpose of a script?

a. Create text documentation of scripts and use the scriptdoc command to organize and display the documentation.

b. Use the whatis command to create and save new documentation for scripts.

c. Requirethatscriptwritersplacecommentlinesinsidethescriptsusingthe#symbol

to begin each comment line.

d. Require that scripts be named using the descriptive sentence naming function in UNIX/Linux.

2. Which of the following shells enables the use of scripts? (Choose all that apply.)

a. Bash

b. csh

c. sea

d. zsh

3. You frequently use the command ls -a and want to save time by just entering l to do the same thing.Which of the following commands enables you to set your system to view hidden files by only entering l?

a. put l= ls -a

b. setltols-a

c. set"ls-a"to"l"

d. alias l=" ls -a"

4. You have written a script, but when you run it there is an error.Which of the fol- lowing commands can you use to debug your script? (Choose all that apply.)

a. debug -all

b. sh -v

c. ./ -d

d. sh -x

5. You have written a shell program that creates four temporary files.Which of the fol- lowing commands can you use to remove these files when the script has completed its work?

a. trap

b. grep

c. del

d. clear

6. Which of the following commands works well for menus used in a script? (Choose all that apply.)

a. do

b. case

c. choose

d. Comm

7. You are currently in the source directory, which is the new directory you have just created for storing and running your scripts.You want to make certain that the source directory is in your default path.Which of the following commands enables you to view the current default path settings?

a. cat PATH

b. show path

c. sed PATH!

d. echo $PATH

8. You have created a script for use by your entire department in a commonly accessed directory. Only you are able to run the script, which works perfectly.Which of the following is likely to be the problem?

a. You did not link the script.

b. You did not give all users in your department execute permission for that script.

c. You did not designate to share ownership of the script.

d. There are two kinds of scripts, universal and private.You have created a private script and need to convert it to universal

9. Your current working directory contains a series of files that start with the word “account” combined with a, b, c, d, and e, such as accounta, accountb, and so on. Which of the following commands enables you to view the contents of all of these files? (Choose all that apply.)

a. ls account "a -e"

b. less account "a,e"

c. more account[ a,b,c,d,e ]

d. cat account{a to e}

10. For which of the following logic structures used within a script is fi the final line for that logic structure? (Choose all that apply.)

a. loop

b. case

c. for

d. If

11. Which of the following are examples of arithmetic or relational operators? (Choose all that apply.)

a. !

b. <

c. %

d. *

12. You have created a series of scripts that use the same environment variables. How- ever, when you run these scripts, some of them do not seem to recognize the envi- ronment variables you have set.What is the problem?

a. You need to use the export command so these variables have global use.

b. You are creating too many environment variables, because the maximum number is five.

c. You must use the home command to make these variables native to your home directory.

d. Only the system administrator can create environment variables and you should contact her to create the ones you need to use.

13. You have spent the last two hours creating a report in a file and afterwards you use cat to create a new file. Unfortunately the new file name you used was the same as the name you used for the report, and now your report is gone.What should you do next time to prevent this from happening?

a. Enter the cat -s command before you start.

b. Enter the command, set -o noclobber before you start.

c. Always use the cat -m command when you use cat to create a file, because this command checks to see if the file already exists.

d. After you created the report file you should have used the chmod a-o command to prevent the file from being deleted or overwritten.

14. You have remotely logged into a computer running UNIX or Linux, but you are not certain about which operating system you are using. However, when you display the contents of the          variable it shows which operating system you are using.

a. OP

b. OPTIND

c. OID

d. OSTYPE

15. What command can you use to view the environment and configuration variables already configured on your system?

a. var

b. envar

c. printenv

d. let -all

16. Which of the following are valid expressions? (Choose all that apply.)

a. let x=5*9

b. let x=y+10

c. let m=12/4

d. let r=128-80

17. When you type for wood maple spruce oak pine at the command line and then press Enter, what should you type next at the > prompt?

a. do

b. go

c. fi

d. Term

18. You want to store a long listing of your files in a variable called myfiles.Which of the following commands enables you to do this?

a. let ls -l=myfiles

b. echo ls -l > myfiles

c. myfiles=‘ls -l‘

d. let ls -l > myfiles

19. What error is in the following script code?

case “selection” in “ i ”) ./listscript ;; “ ii ”) ./numberscript ;; “ iii ”) ./findscript ;; esac

a. All references to ;; should be replaced with a back quote.

b. There should be a dollar sign in front of selection, as in “$selection”

c. There should be no double quote marks in the code.

d. The code must end with the statement,“out”.

20. You are working with a colleague on a script called value that updates several files. You want to test the script, but not update the files.Which of the following com- mands can you use?

a. test -noupdate value

b. trap -u value

c. set -u value

d. sh -n value

21. You only have to enter the name of a script to have it run, such as entering myscript. What setting enables you to do this?

a. You have set the SCRIPT environment variable to 1 instead of the default 0.

b. Right after you logged in you entered setup scripts.

c. Thefirstlineinyourscriptsisalwaysrun,whichenablesscriptstoberuninthisway.

d. You have placed the directory from which you run the scripts in your PATH variable.

22. What would you expect to find in the HOME environment variable?

23. What is the difference between a compiler and an interpreter?

24. What command would you use to place the cursor in row 10 and column 15 on the screen or in a terminal window?

25. What is the purpose of a login script?

Solutions

Expert Solution

Computer Science

1. Your organization routinely uses scripts, but as some employees have left, there are scripts that contain only command lines and no one is certain of their purpose.What steps can be taken to ensure a way for others to know the purpose of a script?

a. Create text documentation of scripts and use the script doc command to organize and display the documentation.

b. Use the whatis command to create and save new documentation for scripts.

c. Requirethatscriptwritersplacecommentlinesinsidethescriptsusingthe#symbol

to begin each comment line.

d. Require that scripts be named using the descriptive sentence naming function in UNIX/Linux.

SOLUTION:

c. Require that script writers place comment lines inside the scripts using the # symbol to begin each comment line.

2. Which of the following shells enables the use of scripts? (Choose all that apply.)

a. Bash

b. csh

c. sea

d. zsh

SOLUTION:

a. Bash

b. csh

d. zsh

3. You frequently use the command ls -a and want to save time by just entering l to do the same thing.Which of the following commands enables you to set your system to view hidden files by only entering l?

a. put l= ls -a

b. setltols-a

c. set"ls-a"to"l"

d. alias l=" ls -a"

SOLUTION:

d. alias l=" ls -a"

4. You have written a script, but when you run it there is an error.Which of the fol- lowing commands can you use to debug your script? (Choose all that apply.)

a. debug -all

b. sh -v

c. ./ -d

d. sh -x

SOLUTION:

b. sh -v

d. sh -x

5. You have written a shell program that creates four temporary files.Which of the fol- lowing commands can you use to remove these files when the script has completed its work?

a. trap

b. grep

c. del

d. clear

SOLUTION:

a. trap

6. Which of the following commands works well for menus used in a script? (Choose all that apply.)

a. do

b. case

c. choose

d. Comm

SOLUTION:

b. case

7. You are currently in the source directory, which is the new directory you have just created for storing and running your scripts.You want to make certain that the source directory is in your default path.Which of the following commands enables you to view the current default path settings?

a. cat PATH

b. show path

c. sed PATH!

d. echo $PATH

SOLUTION:

d. echo $PATH

8. You have created a script for use by your entire department in a commonly accessed directory. Only you are able to run the script, which works perfectly.Which of the following is likely to be the problem?

a. You did not link the script.

b. You did not give all users in your department execute permission for that script.

c. You did not designate to share ownership of the script.

d. There are two kinds of scripts, universal and private.You have created a private script and need to convert it to universal

SOLUTION:

b. You did not give all users in your department execute permission for that script.

9. Your current working directory contains a series of files that start with the word “account” combined with a, b, c, d, and e, such as accounta, accountb, and so on. Which of the following commands enables you to view the contents of all of these files? (Choose all that apply.)

a. ls account "a -e"

b. less account "a,e"

c. more account[ a,b,c,d,e ]

d. cat account{a to e}

SOLUTION:

c. more account[ a,b,c,d,e ]

10. For which of the following logic structures used within a script is fi the final line for that logic structure? (Choose all that apply.)

a. loop

b. case

c. for

d. If

SOLUTION:

d. If

11. Which of the following are examples of arithmetic or relational operators? (Choose all that apply.)

a. !

b. <

c. %

d. *

SOLUTION:

a. !

b. <

c. %

d. *

12. You have created a series of scripts that use the same environment variables. How- ever, when you run these scripts, some of them do not seem to recognize the envi- ronment variables you have set.What is the problem?

a. You need to use the export command so these variables have global use.

b. You are creating too many environment variables, because the maximum number is five.

c. You must use the home command to make these variables native to your home directory.

d. Only the system administrator can create environment variables and you should contact her to create the ones you need to use.

SOLUTION:

a. You need to use the export command so these variables have global use.

13. You have spent the last two hours creating a report in a file and afterwards you use cat to create a new file. Unfortunately the new file name you used was the same as the name you used for the report, and now your report is gone.What should you do next time to prevent this from happening?

a. Enter the cat -s command before you start.

b. Enter the command, set -o noclobber before you start.

c. Always use the cat -m command when you use cat to create a file, because this command checks to see if the file already exists.

d. After you created the report file you should have used the chmod a-o command to prevent the file from being deleted or overwritten.

SOLUTION:

b. Enter the command, set -o noclobber before you start.

14. You have remotely logged into a computer running UNIX or Linux, but you are not certain about which operating system you are using. However, when you display the contents of the          variable it shows which operating system you are using.

a. OP

b. OPTIND

c. OID

d. OSTYPE

SOLUTION:

d. OSTYPE

15. What command can you use to view the environment and configuration variables already configured on your system?

a. var

b. envar

c. printenv

d. let -all

SOLUTION:

c. printenv

16. Which of the following are valid expressions? (Choose all that apply.)

a. let x=5*9

b. let x=y+10

c. let m=12/4

d. let r=128-80

SOLUTION:

a. let x=5*9

b. let x=y+10

c. let m=12/4

d. let r=128-80

17. When you type for wood maple spruce oak pine at the command line and then press Enter, what should you type next at the > prompt?

a. do

b. go

c. fi

d. Term

SOLUTION:

a. do

18. You want to store a long listing of your files in a variable called myfiles.Which of the following commands enables you to do this?

a. let ls -l=myfiles

b. echo ls -l > myfiles

c. myfiles=‘ls -l‘

d. let ls -l > myfiles

SOLUTION:

c. myfiles=‘ls -l‘

19. What error is in the following script code?

case “selection” in “ i ”) ./listscript ;; “ ii ”) ./numberscript ;; “ iii ”) ./findscript ;; esac

a. All references to ;; should be replaced with a back quote.

b. There should be a dollar sign in front of selection, as in “$selection”

c. There should be no double quote marks in the code.

d. The code must end with the statement,“out”.

SOLUTION:

b. There should be a dollar sign in front of selection, as in “$selection”

20. You are working with a colleague on a script called value that updates several files. You want to test the script, but not update the files.Which of the following com- mands can you use?

a. test -noupdate value

b. trap -u value

c. set -u value

d. sh -n value

SOLUTION:

d. sh -n value

21. You only have to enter the name of a script to have it run, such as entering myscript. What setting enables you to do this?

a. You have set the SCRIPT environment variable to 1 instead of the default 0.

b. Right after you logged in you entered setup scripts.

c. Thefirstlineinyourscriptsisalwaysrun,whichenablesscriptstoberuninthisway.

d. You have placed the directory from which you run the scripts in your PATH variable.

SOLUTION:

d. You have placed the directory from which you run the scripts in your PATH variable.

22. What would you expect to find in the HOME environment variable?

SOLUTION:

We expect to find in the HOME environment variable is absolute path to user’s home directory.

23. What is the difference between a compiler and an interpreter?

SOLUTION:

Complier is transform or change our written code into machine code and save that machine code in separate file before our program runs

Interpreter is transform every written code in high level programming language statements one by one into machine code at the time of program runs.

Compare to interpreter complier executes faster.

24. What command would you use to place the cursor in row 10 and column 15 on the screen or in a terminal window?

SOLUTION:

Tput cup 10 15 command is used to place the cursor in row 10 and column 15 on the screen or in a terminal window.

25. What is the purpose of a login script?

SOLUTION:

When user log into a system the login scripts work or run. Login script is a script. Batch file and other programming languages can be written the login script.

It is mostly used in schools and business for features which is characteristics are obtain or available in that computer operating system and approach that on the computer by users.

Simply it works or executes on every time when user login to the computer.

It have aliases and set -O no clobber commands. That commands are used for script runs and it take final duration of the login session.


Related Solutions

Scenario 6: Your organization is shifting and you have a team of employees that have been...
Scenario 6: Your organization is shifting and you have a team of employees that have been notified that they are no longer part of the organization. Some employees will have an end date in one month, some in three months and some in six months. A few employees feel betrayed and are no longer performing at a high level. These employees are scheduled depart in six months. 1. How will you keep these employees motivated?
Reflect on a time from your childhood when direct definitions, identity scripts, or attachment styles left...
Reflect on a time from your childhood when direct definitions, identity scripts, or attachment styles left a big impact on your self-identity. How did the experience shape your perception of who you were at the time? Have those same self-perceptions become a major part of how you think about yourself now or have other experiences reshaped your identity to its current state? How does social comparison theory play out in your professional and personal life? Which type of comparison do...
Identify two important operating standards that are routinely measured in your organization. These measures must be...
Identify two important operating standards that are routinely measured in your organization. These measures must be “paired observations” and must also meet the criteria for a quantitative measure (i.e. either interval or ratio level of measurement). Obtain 20 paired observations. Example:  Standard measures that fit these requirements might be total electricity demand measured in kilowatts (ratio level), and outside temperature measured in degrees Fahrenheit (interval level). The hotter outside temperature the higher the electricity demands will be. 1)      Identify which of...
1.         _____ refers to a strong emotional bond employees have to their organization that makes them...
1.         _____ refers to a strong emotional bond employees have to their organization that makes them feel actively involved and committed to their work. Employee involvement Employee (workforce) engagement Workforce management Job enrichment 2.         _____ refers to any activity by which employees participate in work-related decisions and improvement activities, with the objectives of tapping the creative energies of all employees and improving their motivation. Employee involvement Employee engagement Workforce management Job enrichment 3.         _____ represents the highest level of engagement....
Identify two important operating standards that are routinely measured in your organization. These measures must meet...
Identify two important operating standards that are routinely measured in your organization. These measures must meet the criteria for qualitative, nominal measures. Observations must be cross-classified into a contingency table. Obtain a sample that will produce at least five observations into each group of the cross-classification. Purpose:  To demonstrate the application of non-parametric tests in your organization. Example:  A standard measure that fits these requirements is the human resource department’s employee tracking system. The director of human resources of my company wants...
It is common for an organization to have different categories of employees, such that one Employee...
It is common for an organization to have different categories of employees, such that one Employee class can not easily describe all types of Employees.In this project, you will code a basic Employee class, and then a number of classes which derive from the Employee class (inherit), adding Employee specifics. An application program which stores info for one company will have use objects of different types to model the all employees. Part I:   The Employee Class First create the Employee...
salary(in lakh per annum) no of employees in no of employees in less than organization 1...
salary(in lakh per annum) no of employees in no of employees in less than organization 1 organization 2 5 655 950 10 872 1657 15 1033 2108 20 1144 2488 25 1189 2645 30 1204 2769 35 1212 2825 40 1217 2858 45 1220 2870 50 1222 2877 55 1224 2882 60 1225 2885 65 2888 70 2890 from the above data please find the mean,variance,standrad deviation and coefficient of variation and also conclude that Which organisation has more equitable...
REQUIRED: 1. We have discussed employees are the most valuable assets of an organization, even though...
REQUIRED: 1. We have discussed employees are the most valuable assets of an organization, even though they are not listed in the Balance Sheet. Without employees, an organization is nothing. Explain the main reasons why employees are valuable assets, and why the organization should treat them well? 2. Describe what employees expect from the organization and why? 3. How should an organization treat its employees during a pandemic? – Discuss from both organization and employees’ perspectives. Discuss how the pandemic...
Question 1, Abilene Paradox, Anaclitic Depression, and the Organization: You have a sense that your organization...
Question 1, Abilene Paradox, Anaclitic Depression, and the Organization: You have a sense that your organization may have arrived to Abilene. You are to decide what to do next. As part of your answer, explain the concept of the Abilene Paradox to the CEO. Why does it happen? How would you know if your organization is in or approaching Abilene? Define and explain what anaclitic depression is and how it impacts organizations. Develop a strategy to take your organization out...
1) Now that you have learned some of the basic principles of organization, pause and think...
1) Now that you have learned some of the basic principles of organization, pause and think about where you have already applied such concepts yourself or when you have been part of an organization that did. 1. Did you find a division of labor necessary and helpful? 2. Were you assigned specific tasks or left on your own to decide what to do? 3. Were promotions based strictly on qualifications, as Weber suggested? What other factors may have been considered?...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT