Perl Variables  «Prev  Next»

Perl Variables - Quiz

Each question is worth one point. Select the best answer for each question.
 
1. What is a scalar?
Please select the best answer.
  A. A one-dimensional variable
  B. A one-dimensional value
  C. A numeric value

2. What is a list in Perl?
Please select the best answer.
  A. An ordered series of scalars
  B. An unordered series of scalars
  C. An array that uses a string index

3. Why is the $ character used to access array members?
Please select the best answer.
  A. Because an array is a scalar value
  B. Because array members are scalar values
  C. Because array members are non-scalar values


4. How do you get the number of elements in an array?
Please select the best answer.
  A. Test for a null; for example, if(@array[$i] == 0)
  B. Check the array in scalar context; for example, scalar @array
  C. Use a special function or macro; for example, sizeof @array


5. Which one of the following pseudo code statements would you use to get an element from a hash?
Please select the best answer.
  A. $hash{key}
  B. %hash{key}
  C. @hash[key]


6. What does the split function do?
Please select the best answer.
  A. Removes pieces from a string
  B. Creates a string from a list
  C. Creates a list of parts of a string

7. What does the join function do?
Please select the best answer.
  A. Adds pieces to a string
  B. Creates a string from a list
  C. Creates a list of parts of a string


8. What is a stack?
Please select the best answer.
  A. A first-in/first-out (FIFO) data structure
  B. A last-in/first-out (LIFO) data structure
  C. A first-in/last-out (FILO) data structure

9. What does the push function do?
Please select the best answer.
  A. Adds an item to an array at the beginning
  B. Adds an item to an array at the end
  C. Deletes all items in an array


Your score is 0.0