Perl Quiz (Set 20) Perl (Set 10) 1 / 11 What is the purpose of the 'use warnings' pragma? To enable debugging mode To enforce strict naming conventions for variables and subroutines To automatically import standard libraries To display warnings about potential programming errors 2 / 11 What is the difference between a subroutine and a function? A subroutine and a function are the same thing A subroutine is used for arithmetic operations, while a function is used for text manipulation A subroutine is used for text manipulation, while a function is used for arithmetic operations A subroutine doesn't return a value, while a function returns a value 3 / 11 What is the purpose of the 'sub' keyword? To define a function To define a loop To define a subroutine To define a conditional statement 4 / 11 What is the difference between 'grep' and 'map'? 'grep' filters an array and returns only the elements that match a condition, while 'map' iterates over an array and applies a transformation to each element 'grep' applies a transformation to each element of an array, while 'map' filters an array based on a condition 'grep' and 'map' are synonyms and can be used interchangeably 'grep' and 'map' are both used for joining elements of an array 5 / 11 What is the purpose of the 'map' function? To iterate over an array and apply a transformation to each element To filter an array and return only the elements that match a condition To join the elements of an array into a single string To reverse the order of elements in an array 6 / 11 What is the difference between 'scalar' and 'array' variables? 'scalar' variables can hold only single values, while 'array' variables can hold multiple values 'scalar' variables can hold multiple values, while 'array' variables can hold only single values 'scalar' variables are used for strings, while 'array' variables are used for numbers 'scalar' variables are used for arrays, while 'array' variables are used for hashes 7 / 11 What is the purpose of the 'use strict' pragma? To enable debugging mode To enforce strict naming conventions for variables and subroutines To improve performance To automatically import standard libraries 8 / 11 What is the difference between 'die' and 'exit'? 'die' is used to terminate the program without an error message, while 'exit' is used to generate an error message and terminate the program 'die' and 'exit' are synonyms and can be used interchangeably 'die' is used to generate an error message and terminate the program, while 'exit' is used to terminate the program without an error message 'die' and 'exit' are both used to generate error messages 9 / 11 What is the difference between 'while' and 'until' loops? 'while' loops execute as long as the condition is false, while 'until' loops execute as long as the condition is true 'while' loops are used for numerical comparisons, while 'until' loops are used for string comparisons 'while' loops execute a specific number of times, while 'until' loops execute an indefinite number of times 'while' loops execute as long as the condition is true, while 'until' loops execute as long as the condition is false 10 / 11 What is the Perl 'cmp' operator used for? To compare two strings numerically To compare two strings lexicographically To concatenate two strings To check if two strings are equal 11 / 11 What is the purpose of the 'unless' statement? To check if a condition is false before proceeding To check if a condition is true before proceeding To execute a loop repeatedly To exit a loop Your score isThe average score is 0% 0% Restart quiz