Purchase Solution

Few questions about functions and arrays in shell scripting

Not what you're looking for?

Ask Custom Question

2.Which of the following commands is used to create an array?
a.create
b.declare
c.function
d.source

3.You use the ______________ command to call a function library file.
a.create
b.declare
c.function
d.source

4.Which of the following commands is used to display all variables?
a.create
b.typeset
c.function
d.source

5.You use the ______________ command to create a function named Goals.
a.unset Goals
b.declare -a Goals
c.function Goals ()
d.source Goals

6.Which of the following commands is used to remove a function named Goals?
a.unset Goals
b.declare -a Goals
c.function Goals ()
d.source Goals

7.You use the ______________ statement to display all the values in an array named Beaches.
a.echo ${Beaches[0]}
b.echo ${Beaches[1]}
c.echo ${Beaches[#]}
d.echo ${Beaches[*]}

8.A ______________ refers to the element number in an array.
a.call
b.data value
c.subscript
d.return value

9.______________ is the process of breaking a programming task into smaller pieces.
a.Function calling
b.Subscripting
c.Indexing
d.Modularization

10.A ______________ activates a function.
a.function call
b.return value
c.subscript
d.function module

11.Which of the following commands is used to display the length of the data value located at subscript 5 in the array named Beaches?
a.echo ${Beaches[5]}
b.echo ${#Beaches[4]}
c.echo ${#Beaches[5]}
d.echo ${@Beaches[*]}

12.Which of the following commands is used to display the first value in the array named Beaches?
a.echo ${Beaches[0]}
b.echo ${Beaches[1]}
c.echo ${Beaches[2]}
d.echo ${Beaches[*]}

13.You use the ______________ command to declare a variable so it can only be used in a function.
a.global
b.function
c.declare -a
d.source

14.A value is ______________ to a function when the function is given the value to process.
a.called
b.returned
c.passed
d.evaluated

15.Which of the following commands is used to display the total number of data values in the array named Beaches?
a.echo ${Beaches[]}
b.echo ${*Beaches[#]}
c.echo ${#Beaches[*]}
d.echo ${@Beaches[*]}

16.Which of the following declares an array named States with the elements Florida, Georgia, Maine, Montana, and Alabama?
a.states=(Florida Georgia Maine Montana Alabama)
b.states[]=(Florida Georgia Maine Montana Alabama)
c.states[01234]=(Florida Georgia Maine Montana)Alabama
d.function()=(Florida Georgia Maine Montana Alabama)

Purchase this Solution

Solution Summary

Since nothing is mentioned about the specific shell language to use, it is inferred from the context of questions that these questions are based around "Bash" shell scripting.

Solution Preview

Since nothing is mentioned about the specific shell language to use, it is inferred from the context of questions that these questions are based around "Bash" shell scripting.

2. "declare" command is used to create an array.
3. We use "source" command to call a function library file.
4. "typeset" command is used to display all variables.
5. ...

Purchase this Solution


Free BrainMass Quizzes
Inserting and deleting in a linked list

This quiz tests your understanding of how to insert and delete elements in a linked list. Understanding of the use of linked lists, and the related performance aspects, is an important fundamental skill of computer science data structures.

Word 2010: Tables

Have you never worked with Tables in Word 2010? Maybe it has been a while since you have used a Table in Word and you need to brush up on your skills. Several keywords and popular options are discussed as you go through this quiz.

Java loops

This quiz checks your knowledge of for and while loops in Java. For and while loops are essential building blocks for all Java programs. Having a solid understanding of these constructs is critical for success in programming Java.

Basic UNIX commands

Use this quiz to check your knowledge of a few common UNIX commands. The quiz covers some of the most essential UNIX commands and their basic usage. If you can pass this quiz then you are clearly on your way to becoming an effective UNIX command line user.

Word 2010: Table of Contents

Ever wondered where a Table of Contents in a Word document comes from? Maybe you need a refresher on the topic? This quiz will remind you of the keywords and options used when working with a T.O.C. in Word 2010.