PERL Quiz

Description: PERL Quiz 2
Number of Questions: 8
Created by:
Tags: perl
Attempted 0/8 Correct 0 Score 0

In Perl, the following will result in which of the following, if the prize is currently "5 dollars" print 'You won $prize';

  1. You won $5.00

  2. You won 5 dollars

  3. You won $prize

  4. You won $5


Correct Option: C
  1. stdquit

  2. stdend

  3. stdin

  4. stdout

  5. C&D


Correct Option: E

In Perl, which switch is used for printing out warnings about typographical errors in your script?

  1. -P

  2. -W

  3. -p

  4. -w


Correct Option: D

AI Explanation

To answer this question, we need to understand the different switches used in Perl for printing out warnings about typographical errors in a script.

Option A) -P - This option is incorrect because the -P switch in Perl is used for enabling parsing of files with the .P extension. It does not relate to printing out warnings about typographical errors.

Option B) -W - This option is incorrect because the -W switch in Perl is used to enable all warnings, including additional warnings not covered by the -w switch.

Option C) -p - This option is incorrect because the -p switch in Perl is used to add a loop around your script, which makes it iterate over input lines and automatically prints each line.

Option D) -w - This option is correct because the -w switch in Perl is used to enable warnings. When enabled, it prints out warnings about typographical errors in your script.

Therefore, the correct answer is D) -w. This option is correct because it is used in Perl to print out warnings about typographical errors in your script.

  1. Perl version ID

  2. Web server ID

  3. Last access

  4. Inode number

  5. C&E


Correct Option: E

In Perl, scalar variables always begin with a ________ sign.

  1. #

  2. @

  3. %

  4. $


Correct Option: D

AI Explanation

To answer this question, you need to understand the naming convention for scalar variables in Perl.

Option A) # - This option is incorrect because the # sign is used to indicate comments in Perl, not for naming variables.

Option B) @ - This option is incorrect because the @ sign is used to denote arrays in Perl, not for scalar variables.

Option C) % - This option is incorrect because the % sign is used to denote hashes in Perl, not for scalar variables.

Option D) $ - This option is correct because scalar variables in Perl always begin with the $ sign. Scalar variables hold single values, such as numbers or strings.

The correct answer is D. This option is correct because scalar variables in Perl are always denoted by the $ sign.

- Hide questions