Perl 5 Test Answer


Which of the following meta characters creates a single expression or atom?
a. { }
b. ( )
c. *
d. +
e. ?
Which of the following is not true regarding scalar variable names?
a. Variable names that begin with an underscore or an alphabet character may have any practical length
b. The characters that follow variable names that begin with an underscore or alphabet character may be digits, underscores or alphabet characters
c. If a variable name begins with a digit, it may be of any practical length but can contain only digits
d. If a variable name begins with a non-alphanumeric character, it can only be one character long
e. Variable names can contain spaces
The syntax of the heredoc operator is.
a. print >>heredoc - marker;
b. print <
c. select <
d. print << heredoc -label;
e. printlist <
Dereferencing refers to.
a. accessing an array that contains a reference to another array
b. removing the reference
c. an undefined or empty reference
d. accessing values referred to by Perl references
e. a scalar variable that keeps track of where another variable is stored in memory
A label, in Perl, is.
a. a marker for the Perl interpreter
b. a heading
c. a switch statement
d. the name of an operator
e. a component embedded in the code
The keyword 'my' is used to declare
a. comments
b. bare words
c. default variables
d. Lexical variables
Non-associative operators are those that.
a. do not bind at all
b. change their associativity depending on the context
c. do not show precedence
d. bind themselves to whichever expression they are adjacent to
e. do not associate the lvalue with the expression on the right
The foreach loop is usually used to process.
a. arrays and hashes
b. a block of statements a number of times
c. lists
d. multi-dimensional arrays
e. namespaces
A directory handle.
a. is a program that handles your operating system
b. is a link from your computer program to the directory on your file system
c. does not have its own namespace
d. cannot be considered equivalent to a file handle
e. does not require the opendir function
Which of the following can replace if else?
a. ? :
b. : ?
c. ! :
d. / ?
e. ? /
Which of the following is not a feature of Perl?
a. Portability
b. Interpreted language
c. Compiled language
d. Is used for CGI applications
e. Was originally used to generate reports that tracked errors
What does Perl stand for?
a. Programmer's Extraction Report Language
b. Practical Extra Reference Language
c. Practical Extraction and Report Language
d. Practical Evolving Report Language
e. Practical Error Report Language
Which one of the following is a part of the if family of branching statements in Perl?
a. if
b. if else
c. if elsif
d. if, if else, and if elsif
e. None of the above
What does the following syntax indicate?
$lvalue=join(delimiter, list);
a. Creates a single delineated string from an input list
b. Translates a number into a character
c. Returns the first position of a substring
d. Returns the number of characters in a string
e. Returns the last position of a substring
Which of the following characters is the variable designator for scalar variables?
a. @
b. %
c. $
d. *
e. &
Which of the following is not true of labels?
a. A label can go on any line
b. A label must begin with a character followed by any combination of letters or numbers that end with a colon
c. Reserved words cannot be used as labels
d. Labels are case sensitive
e. A label performs the same function as the lastcommand
The s/// function.
a. substitutes one string for another string
b. returns the first position of a substring
c. returns the last position of a substring
d. returns the number of characters of a string
e. returns or modifies a substring
Which of the following file functions gets the file descriptor of a file handle?
a. fcntl
b. flock
c. getc
d. fileno
e. link
What does the switch syntax :f do?
a. It allows the option to be negated
b. It sets the default syntax
c. It sets the input option to include an optional real-number argument
d. It sets the input option to include an optional integer argument
e. It sets the input option to include a mandatory real-number argument
A scalar variable can contain.
a. only one data item at a time
b. several data items at a time, the number of which needs to be declared beforehand
c. unlimited items
d. two items at a time
e. an array of data items
Which of the following operators is associated with writing to a program?
a. +
b. >
c. >>
d. | filename
e. filename |
Which of the following characters denotes a comment in Perl?
a. //
b. #
c. /*
d. &
e. *
What are bare words?
a. Comments with the # sign missing
b. Improperly declared variables
c. Operators
d. Character strings without surrounding quotation marks
e. Characters denoting a string
How many times does the do statement allow you to execute the block of statements in a loop?
a. Does not allow you to execute statements in a loop
b. At least once
c. Twice
d. Depends on the number of times specified
e. An indefinite number of times
What does the ord string function do?
a. Returns or modifies a sub string
b. Translates a number into a character
c. Creates a delineated string from an input list
d. Returns the number of characters in a string
e. Converts ASCII characters into their numeric value
How is an array assigned to an array?
a. @array1=@array[1...6];
b. @array1=@array2;
c. @array=(1, "string", 4,5, \@ array z);
d. By creating another array object
e. An array cannot be assigned to an array
Which of the following is not a type of reference variables?
a. Direct
b. Constant
c. Subroutine
d. Numeric
e. Symbolic
Which of the following begins or ends a system command string in Perl?
a. "
b. '
c. <>
d.
e. `
To start the Perl debugger, what will you type at the command prompt?
a. perldb
b. DB<1>
c. perl errorMessage.pl-d
d. perl -d filename.pl
e. perl-w programName.pl
Which of the following can be used with the do statement?
a. A label modifier
b. next
c. while
d. redo
e. last
What does a print FILEHANDLE list do?
a. Prints to FILEHANDLE the data in list
b. Prints the contents of the default special variable $_ to FILEHANDLE
c. Prints to the default selected file handle the data in list
d. Prints to the default selected file handle the contents of the default special variable $_
e. None of the above
What does the pop function do?
a. Takes elements off the end of an array
b. Puts elements into the first cell index of an array
c. Adds an element to the end of an array
d. Takes elements off the first index of the array
e. Modifies or deletes elements from the array
What does the pattern modifier m do?
a. Ignores the character case when matching the pattern
b. Compiles the pattern and interprets it only the first time it occurs
c. Treats the input string as if it were a single line
d. Treats the input string as if it were multiple lines
e. Allows a comment character in the pattern
Which of the following loops is usually used to process arrays?
a. while
b. until
c. do
d. for / foreach
What does the following compound assignment operator signify?

     | =
a. Exclusive OR the expression on the left of the operator with the expression on the right of the operator
b. Logical OR the expression on the left of the operator with the expression on the right of the operator
c. Left shift the expression on the left of the operator by the expression on the right of the operator
d. Binary OR the expression on the left of the operator with the expression on the right of the operator
e. Append the expression on the left of the operator with the expression on the right of the operator
What does the following error indicate?

"Can't Locate Function in @INC"
a. You misspelled a function name
b. The last line of the required file returned a zero or null value
c. You forgot to type the comma after the first argument of a function
d. Your code is using a function that has been replaced by a newer function
e. You used an uninitialized value
Which of the following is not an alignment character?
a. <
b. >
c. |
d. &
e. #
The value assigned to an array cell must be.
a. a scalar value
b. a variable value
c. a scalar or a variable value that resolves to a scalar value
d. null
e. None of the above
Which of the following operators has/have the highest precedence?
a. Increment/decrement
b. NOT, escape, sign operator
c. Dereference operator
d. Exponential operator
e. Parenthesis, function, quotation marks
How are hash references created?
a. % $ reference
b. $ reference = \ % hash;
c. @ reference = \ % hash;
d. % hash=$reference;
e. $$reference= \ % hash;