SUBJECTS
|
BROWSE
|
CAREER CENTER
|
POPULAR
|
JOIN
|
LOGIN
Business Skills
|
Soft Skills
|
Basic Literacy
|
Certifications
About
|
Help
|
Privacy
|
Terms
|
Email
Search
Test your basic knowledge |
Perl Programming
Start Test
Study First
Subject
:
it-skills
Instructions:
Answer 50 questions in 15 minutes.
If you are not ready to take this test, you can
study here
.
Match each statement with the correct term.
Don't refresh. All questions and answers are randomly picked and ordered every time you load a test.
This is a study tool. The 3 wrong answers for each question are randomly chosen from answers to other questions. So, you might find at times the answers obvious, but you will see it re-enforces your understanding as you take the test each time.
1. Regular ____________: w - alphanumeric word including underscor - d - digits 0-9 - s any whitespace - . - any character
Expression character classes
reverse(@array)
delete($hashName{key})
scalar context (Ex: $myArray[4] = 2)
2. The __________ in perl: - uses grave marks `command args`- returns the output of the command to the variable you specify - if $output = `command arg` the output is stored all in one variable (all lines seperated by n) - if @output = `command arg` the
access modes
(@array)
lc($string)
command substitution
3. ________ in perl - A collection of data (static data or scalar variables or arrays or hashes can all be stored in an array element)
values(%hash)
lc($string)
Array variables
similar data types
4. The three basic ________ of the open() function: > write - >> append - < read file
scalar
access modes
FILEHANDLE
Expression Quantifiers
5. The use of ______ in perl - Documenting code - Created by placing a "#" on a line. - are not multi-line
scalar
comments
FILEHANDLE
array functions
6. Returns a copy of the string as all lower case
array functions
Expression Quantifiers
split(/\s/, $string)
lc($string)
7. _________ of scalar variables in perl - using "=" - Ex: $myVariable = 5;
use moduleName; Ex: use Roman;
(@array)
Assignment
keys(%hash)
8. _________ @arrayName) returns the size of the array
scalar
basic binding operators
values(%hash)
Special array
9. Arrays can be assigned or read in _________
scalar context (Ex: $myArray[4] = 2)
Hash variables
keys(%hash)
Variable context
10. To include modules in perl
use moduleName; Ex: use Roman;
$line=<FILEHANDLE>
(@array)
newline
11. _________ in perl - An associative array
unshift(@array, $newValue)
Hash variables
uc($string)
last index
12. Regular __________: * - 0 or more characters - + - 1 or more characters - ? - 0 or 1 characters
Expression Quantifiers
flow-control
length($string)
array functions
13. The two primary methods of executing _______ in perl: - system("command args") - - `command args`
system commands
keys(%hash)
unshift(@array, $newValue)
delete($hashName{key})
14. The two phases of creating a PERL program _______ - Execution
chomp($string)
flow-control
Editing
uc($string)
15. Removes trailing newline
basic binding operators
sort(@array)
chomp($string)
hash functions
16. Remove trailing newline from each element in the array
chomp(@string)
scalar context (Ex: $myArray[4] = 2)
similar data types
Special array
17. Common ________: pop(@array) - push(@array, $new Value) - shift(@array) - unshift(@array, $newValue) - sort(@array) - reverse(@array)
access modes
keys(%hash)
reverse(@array)
array functions
18. Delete the hash entry with the key given
system commands
keys(%hash)
system() function
delete($hashName{key})
19. To read an entire file into an array (one line per element)
@entireFile=<FILEHANDLE>
like functions
array functions
interpreter
20. _________ in perl - Singular variable - starts with "$" - Number or characer or string- Perl does automatic type conversion of these
Scalar variables
each(%hash)
scalar context (Ex: $myArray[4] = 2)
command substitution
21. Returns the sub string starting at index $startindex and ending after $numchars chars in the string $string
system commands
join(':', @array)
substr($string, $startindex, $numchars)
scalar
22. Add a new element to the from of the array with the value $newwValue
access modes
Assignment
unshift(@array, $newValue)
similar data types
23. Explain how to read a line from a file handle
$line=<FILEHANDLE>
Expression character classes
like functions
flow-control
24. $#arrayName returns the value of the ______ of the array (NOT the data stored in that array element)
reverse(%hashName)
hash functions
lcfirst($string)
last index
25. Modules in perl - Synonymous with header files in C - Collection of ______ and variables that may be used in your program
Array variables
like functions
@arrayName size
arithmetic comparison operators
26. Removes the last element from the array pop
Scalar variables
(@array)
Special array
FILEHANDLE
27. To write to a filehandle
length($string)
comments
print(FILEHANDLE "Data to outputn");
join(':', @array)
28. In arrays elements need not be __________
use moduleName; Ex: use Roman;
FILEHANDLE
Expression Quantifiers
similar data types
29. Join the elements of the array seperating the elements with the ':' character
Warning
: Invalid argument supplied for foreach() in
/var/www/html/basicversity.com/show_quiz.php
on line
183
30. Common ___________: substr($string, $start, $numchars); - length($string) - lc($string) - uc($string) - chomp($string) - chomp(@string) - join(':", @string) - split(/\s/, $string) - lcfirst($string) - ucfirst($string)
string manipulation functions
last index
system() function
newline
31. The use of "if" "if-else" and "if-elsif-else"
flow-control
like functions
chomp(@string)
$line=<FILEHANDLE>
32. A special system variable used to pass arguments to script
uc($string)
foreach
@ARGV
%ENV hash array
33. Returns a copy of the string with the first letter lower case
push(@array, $newValue)
values(%hash)
scalar
lcfirst($string)
34. Adds a new element to end of the array with value $newValue
values(%hash)
command substitution
uc($string)
push(@array, $newValue)
35. ________ in perl - can be scalar array or hash context - tells the interpreter what you are looking for (Ex: "$arrayname[$index_number]")
access modes
Variable context
basic binding operators
exists($hashName{keyName})
36. scalar(@arrayName) returns the ______ of the array names
command substitution
@arrayName size
@ARGV
exists($hashName{keyName})
37. Returns a copy of the string with the first letter upper case
comments
ucfirst($string)
FILEHANDLE
exists($hashName{keyName})
38. Stores information about the current users environment. You can print this from the command line using printenv
scalar
%ENV hash array
delete($hashName{key})
chomp(@string)
39. eq - ne - lt - le - gt - ge
size string comparison operators
ucfirst($string)
scalar
unshift(@array, $newValue)
40. Returns the length of the string including escape sequences
execution block
split(/\s/, $string)
length($string)
Assignment
41. The purpose of {} in an "if" statement: To Define the __________ of the if statement. Unlike C the {} braces ARE REQUIRED
split(/\s/, $string)
access modes
execution block
print(FILEHANDLE "Data to outputn");
42. Returns all of the values of the hash as an array
sort(@array)
system() function
values(%hash)
length($string)
43. Sort and array alphabetically
array functions
comments
Hash variables
sort(@array)
44. The four types of loops in perl: while - until - for - ________
Assignment
@arrayName size
execution block
foreach
45. Common ________: keys(%hash) - values(%hash) - each(%hash) - delete($hash{keyName}) - exists($hash{keyName}) - reverse(%hash)
hash functions
length($string)
values(%hash)
like functions
46. Assignment of a hash variable for a single hash element
last index
$hashName{keyName}="Value to Add"
substr($string, $startindex, $numchars)
Special array
47. To get rid of the ________ in $line you could now chomp() (Ex: chomp($line);)
newline
uc($string)
string manipulation functions
@arrayName size
48. Returns all of the keys of the hash as an array
chomp(@string)
keys(%hash)
length($string)
%ENV hash array
49. Two ____________ in regular expressions: =~ Contains - !~ Does not contain
basic binding operators
ucfirst($string)
$line=<FILEHANDLE>
@arrayName size
50. The open() statement in perl: open(________, file_mode, "filename.txt")
push(@array, $newValue)
keys(%hash)
(@array)
FILEHANDLE