Tag: perl

Questions Related to perl

In Perl, which of the following are file handles?

  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.

In Perl, "stat" returns a thirteen element array with which of the following values?

  1. Perl version ID

  2. Web server ID

  3. Last access

  4. Inode number

  5. C&E


Correct Option: E

AI Explanation

To answer this question, we need to understand the functionality of the "stat" function in Perl. The "stat" function in Perl is used to retrieve information about a file or a filehandle. It returns a thirteen-element array that contains various attributes of the file.

Let's go through each option to understand which values are returned by the "stat" function:

Option A) Perl version ID - This option is incorrect. The "stat" function does not return the Perl version ID. It provides information about the file, not the Perl version.

Option B) Web server ID - This option is incorrect. The "stat" function does not return the Web server ID. It provides information about the file, not the web server.

Option C) Last access - This option is correct. The "stat" function returns the last access time of the file as one of the elements in the array.

Option D) Inode number - This option is correct. The "stat" function returns the inode number of the file as one of the elements in the array.

So, options C and D are correct. Therefore, the correct answer is E) C&E, as both options C and D are returned by the "stat" function in Perl.

PERL is

  1. Procedural

  2. OOPs

  3. Both

  4. None


Correct Option: C
  1. ord

  2. sort

  3. reverse

  4. foreach


Correct Option: D