Perl Operators   «Prev  Next»

Perl Operator - Quiz

Each question is worth one point. Select the best answer or answers for each question.
 

1. What is the result of this expression:
3 + 4 * 7 % 3
Please select the best answer.
  A. 4
  B. 7
  C. 1

2. What is the meaning of the qq operator?
Please select the best answer.
  A. It delimits, but does not interpolate, a string
  B. It interpolates, but does not delimit, a string
  C. It delimits and interpolates a string

3. What is the result of this expression:
$s = '.' x 75;
Please select the best answer.
  A. 75
  B. A string of seventy-five periods
  C. It cannot be evaluated

4. What is printed after the following statements are executed?
$i = 3;
print $i--;

Please select the best answer.
  A. 1
  B. 2
  C. 3

5. Give the value of $y after this code:
$x = '';
$y = $x ? "one" : "two"

Please select the best answer.
  A. "two"
  B. "one"
  C. "twelve"

6. What will be the value of $z:
$z = -f "foo"
Please select the best answer.
  A. The contents of the file "foo"
  B. The integer 1
  C. True if "foo" exists

7. What will be printed by this code:
@a = (5 ... 9);
print join ', ', @a, "\n";

Please select the best answer.
  A. 56789
  B. 5, 6, 7, 8, 9
  C. 5, 6, 7, 8, 9,

8. What is the value of $x after this code:
$a = 1; $b = 2; $c = 3; $x = $a ? $b : $c;

Please select the best answer.
  A. 1
  B. 2
  C. 3


9. What does this code do:
$filename = 'testfile';
open(FILE, ">>$filename");
print FILE "Hiya!\n";
close(FILE);

Please select the best answer.
  A. Writes "Hiya!\n" to the file
  B. Appends "Hiya!\n" to the file
  C. Reads "Hiya!\n" from the file
Your score is 0.0