CIW Course Revision Site

Tutor Marked Assignment PL TMA-02

In a Nutshell - CIW Course Section 2 Part B

PL TMA-02 - CD Access Code: 5235

Q1. Which of the following symbols are used to compare two numeric values?

Q2. What would be displayed by the following Perl statements?

$A = 100;
$B = 100;
print ($A != $B);

Q3. What would be displayed by the following Perl statements?

$A = (12 * 3) + 4;
$B = 12 * 3 + 4;
print ($A >= $B);

Q4. What would be displayed by the following Perl statements?

$A = 12 * (3 + 4);
$B = 12 * 3 + 4;
print ($A <= $B);

Q5. What would be displayed by the following Perl statements?

$A = (12 - 3) + 4;
$B = 12 - 3 + 4;
print ($A > $B);

Q6. What would be displayed by the following Perl statements?

$A = (12 * 3) + 4;
$B = 12 * 3 + 4;
$C = - ($A - $B);
print ($A < $C);

Q7. What would be displayed by the following Perl statements?

$A = "John";
$B = "James";
print ($A eq $B);

Q8. What would be displayed by the following Perl statements?

$A = "John";
$B = "James";
print ($A gt $B);

Q9. What would be displayed by the following Perl statements?

$A = "John";
$B = "James";
$C = $A;
print ($A ge $C);

Q10. What would be displayed by the following Perl statements?

$A = "John";
$B = "James";
$C = 8 / 4 + 2;
$D = (8 / 4) + 2;
print ($A lt $B || $C == $D);

Q11. What would be displayed by the following Perl statements?

$A = 19;
$B = 29;
$C = $B - $A + 6;
$D = $C - $A;
print ($B > $A xor $D <= $A);

Q12. What would be displayed by the following Perl statements?

$A = "March";
$B = "May";
$C = 12;
$D = $C + ($A gt $B);
print (!($C == $D));

Q13. What would be displayed by the following Perl statements?

$counter = 0;
while ($counter < 10)
{
  $counter++;
  print ($counter);
  print (" ");

}

Q14. What would be displayed by the following Perl statements?

$counter = 1;
while ($counter < 10)
{
  print ($counter);
  print (" ");
  $counter++;

}

Q15. What would be displayed by the following Perl statements?

$counter = 0;
print ($counter);
until ($counter < 10)
{
  $counter++;
  print ($counter);
  print (" ");
}

Q16. What would be displayed by the following Perl statements?

$counter = 0;
do
{
  print ($counter);
  $counter++;
} while ($counter < 10);

Q17. What would be displayed by the following Perl statements?

for ($counter = 10; $counter >= 1; $counter--)
{
  print ($counter);
  print (" ");

}

Q18. What would be displayed by the following Perl statements?

for ($counter = 1; $counter < 10; $counter++)
{
  if ($counter % 3)
  {
    print ($counter);
    print (" ");
  }
}

Q19. What would be displayed by the following Perl statements?

MYLOOP: for ($i = 1; $i < 10; $i ++)
{
  if ($i < 3)
  {
    print ($i);
    print (" ");
  }
  else
  {
    last MYLOOP;
  }
}

Q20. Which of the following lines has the correct syntax for appending the output from Perl script script.pl to output file script1output.txt?

Design by Stephen

Certified Internet Webmaster

Page last Edited: 25 Nov 2011