CS 2204 Quiz – Week of 10/1/2001

 


1.      What is the default datatype of variables in ksh shell scripts?

a.       integer

b.      floating point

c.       character

d.      string

Answer: d

 

2.      Which of these situations would cause an error message to be printed after typing the command “my_script” on the command line, assuming that my_script is a ksh script?

a.       my_script does not have execute permission set

b.      the current working directory is not in the PATH

c.       both a) and b)

d.      neither a) nor b)

Answer: c

 

3.      What is the meaning of the expression ${sports[*]} in a ksh script?

a.       all of the elements of the array sports

b.      the number of elements in the array sports

c.       the first element in the array sports

d.      I love sports!

Answer: a

 

4.      In a ksh script, how does one indicate the beginning and end of a block of statements in a while loop?

a.       with { and }

b.      with [ and ]

c.       with while and elihw

d.      with do and done

Answer: d

 

5.      What is the default list upon which a for loop operates in a ksh script (i.e. a script contains “for x” rather than “for x in y”)?

a.       the list of files in the current working directory

b.      the list of currently running processes

c.       the list of arguments to the script

d.      the list 1, 2, 3, 4, …

Answer: c