TestOut LabSim 14

.pdf

School

Eastern Gateway Community College *

*We aren’t endorsed by this school

Course

1680

Subject

Computer Science

Date

Dec 6, 2023

Type

pdf

Pages

12

Uploaded by MateCaribouMaster661

Report
11/15/23, 12 : 59 AM Page 1 of 12 https://labsimapp.testout.com/v6_0_575/exam-engine.html/176c10c3-…n/31308803/783da08f-b2ef-464f-8624-23fec01f7276/end ? locale=en-us 14.2.8 Practice Questions Candidate: Levi Cloakey (Lcloakey) Date: 11/15/2023 12:58:42 am • Time Spent: 04:07 Score: 80% Passing Score: 80% Question 1: Incorrect What command would you enter to assign the " fi rst Monday" output of the date command to the fi rstmonday variable? " rstmonday=${date -- date=" " rst Monday" fi rstmonday=$(date --date=" fi rst Monday") Explanation You would enter the fi rstmonday=$(date --date=" fi rst Monday") command to assign the ' fi rst Monday" output of the date command to the fi rstmonday variable. References 14.1.4 Scripting Facts 14.2.1 Bash Shell Environments and Shell Variables 14.2.2 Bash Shell Parameters and User Variables 14.2.5 User Variables and Shell Arithmetic 14.2.7 Shell Environments, Bash Variables and Parameters Facts q_env_var_param_command_expansion_ex_lp6.question.fex
11/15/23, 12 : 59 AM Page 2 of 12 https://labsimapp.testout.com/v6_0_575/exam-engine.html/176c10c3-…n/31308803/783da08f-b2ef-464f-8624-23fec01f7276/end ? locale=en-us Question 2: Correct While writing a shell script, you want to perform some arithmetic operations. Which of the following commands is used to create an integer variable? declare -i variablename variablename variablename(integer) variablename(integer) set variablename variablename variablename variablename integer; Explanation declare -i variablename variablename will create a variable named variablename where the type is integer (whole numbers only). variablename variablename integer and variablename(integer) variablename(integer) are invalid commands. set variablename variablename is used to set the value of the variable. References 14.1.4 Scripting Facts 14.2.1 Bash Shell Environments and Shell Variables 14.2.2 Bash Shell Parameters and User Variables 14.2.5 User Variables and Shell Arithmetic 14.2.7 Shell Environments, Bash Variables and Parameters Facts q_env_var_param_declare_i_lp6.question.fex
11/15/23, 12 : 59 AM Page 3 of 12 https://labsimapp.testout.com/v6_0_575/exam-engine.html/176c10c3-…n/31308803/783da08f-b2ef-464f-8624-23fec01f7276/end ? locale=en-us Question 3: Correct You want to create a variable called marketing that has a value of TestOut . You want this variable to be available each time a new shell environment is spawned as a process. Which of the following commands will meet your requirements? marketing=TestOut printenv marketing export marketing declare -x marketing=TestOut Explanation The type of variable you want to create is an environment variable that will be available each time a new shell environment is spawned as a process. To create this type of variable, you can use the declare -x command. In this scenario, you would enter declare - x marketing=TestOut . The export marketing command would convert an existing marketing shell variable into an environment variable. However, you want to create an environment variable, not convert one. The marketing=TestOut command would create a shell variable, not an environment variable. The printenv marketing command would simply display the value of the marketing variable. References 14.2.7 Shell Environments, Bash Variables and Parameters Facts q_env_var_param_declare_x_create_lp6.question.fex
11/15/23, 12 : 59 AM Page 4 of 12 https://labsimapp.testout.com/v6_0_575/exam-engine.html/176c10c3-…n/31308803/783da08f-b2ef-464f-8624-23fec01f7276/end ? locale=en-us Question 4: Incorrect You have created a breakfast variable with a value of "yogurt and granola." What command would you enter to only display "granola" from the shell command prompt? echo $(breakfast:11) echo ${breakfast:11} Explanation You would enter the echo ${breakfast:11} command at the shell command prompt to only display the word "granola." The echo command displays the content of the breakfast variable. Using braces {} indicates that this is a parameter expansion. And the 11 is an o ff set count that starts at 0 from the left and begins displaying at the " g " in granola . References 2.1.3 Shell Commands 14.1.1 Bash Scripting Overview 14.1.3 Executing and Sourcing a Script 14.1.4 Scripting Facts q_env_var_param_expansion_ex_lp6.question.fex
11/15/23, 12 : 59 AM Page 5 of 12 https://labsimapp.testout.com/v6_0_575/exam-engine.html/176c10c3-…n/31308803/783da08f-b2ef-464f-8624-23fec01f7276/end ? locale=en-us Question 5: Correct Which of the following describes the function of the export command? Spawns a new subshell for command execution. Makes the command history available to a child process. Makes a mount point available to a remote server. Converts shell variables to environment variables. Explanation The export command sets or converts a shell variable into an inheritable environment variable. References 14.1.4 Scripting Facts 14.2.1 Bash Shell Environments and Shell Variables 14.2.2 Bash Shell Parameters and User Variables 14.2.5 User Variables and Shell Arithmetic 14.2.7 Shell Environments, Bash Variables and Parameters Facts q_env_var_param_export_def_lp6.question.fex
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help