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. Returns a copy of the string as all lower case
lc($string)
FILEHANDLE
reverse(%hashName)
delete($hashName{key})
2. Modules in perl - Synonymous with header files in C - Collection of ______ and variables that may be used in your program
like functions
ucfirst($string)
reverse(@array)
@ARGV
3. ________ in perl - A collection of data (static data or scalar variables or arrays or hashes can all be stored in an array element)
Assignment
Array variables
system commands
print(FILEHANDLE "Data to outputn");
4. The four types of loops in perl: while - until - for - ________
foreach
@arrayName size
$line=<FILEHANDLE>
delete($hashName{key})
5. To include modules in perl
use moduleName; Ex: use Roman;
FILEHANDLE
chomp($string)
command substitution
6. Removes the last element from the array pop
unshift(@array, $newValue)
Scalar variables
hash functions
(@array)
7. ________ in perl - can be scalar array or hash context - tells the interpreter what you are looking for (Ex: "$arrayname[$index_number]")
values(%hash)
interpreter
execution block
Variable context
8. Join the elements of the array seperating the elements with the ':' character
9. The use of "if" "if-else" and "if-elsif-else"
comments
substr($string, $startindex, $numchars)
length($string)
flow-control
10. _________ of scalar variables in perl - using "=" - Ex: $myVariable = 5;
each(%hash)
arithmetic comparison operators
Assignment
size string comparison operators
11. Returns a copy of the string with the first letter lower case
lc($string)
sort(@array)
lcfirst($string)
delete($hashName{key})
12. Explain how to read a line from a file handle
Expression character classes
$line=<FILEHANDLE>
string manipulation functions
use moduleName; Ex: use Roman;
13. Returns the sub string starting at index $startindex and ending after $numchars chars in the string $string
reverse(@array)
Assignment
interpreter
substr($string, $startindex, $numchars)
14. scalar(@arrayName) returns the ______ of the array names
@arrayName size
uc($string)
@ARGV
last index
15. Returns all of the values of the hash as an array
chomp(@string)
values(%hash)
Scalar variables
$hashName{keyName}="Value to Add"
16. To write to a filehandle
print(FILEHANDLE "Data to outputn");
$#arrayName
Hash variables
values(%hash)
17. The variable that provides the last index of an array
Assignment
$#arrayName
flow-control
split(/\s/, $string)
18. 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
command substitution
$#arrayName
foreach
string manipulation functions
19. Returns a two element ray of the next key value pair; resultArray[0] is the key resultArray[1] is the value
system() function
each(%hash)
length($string)
arithmetic comparison operators
20. eq - ne - lt - le - gt - ge
lc($string)
$#arrayName
size string comparison operators
scalar context (Ex: $myArray[4] = 2)
21. A special system variable used to pass arguments to script
@ARGV
Expression character classes
(@array)
$line=<FILEHANDLE>
22. Returns a copy of the string with the first letter upper case
size string comparison operators
ucfirst($string)
keys(%hash)
Assignment
23. _________ in perl - An associative array
last index
foreach
unshift(@array, $newValue)
Hash variables
24. Stores information about the current users environment. You can print this from the command line using printenv
scalar
Assignment
string manipulation functions
%ENV hash array
25. The purpose of {} in an "if" statement: To Define the __________ of the if statement. Unlike C the {} braces ARE REQUIRED
interpreter
Hash variables
execution block
print(FILEHANDLE "Data to outputn");
26. Removes trailing newline
%hashname = (key1=>"value1", key2=>"value2", key3=>"Value3")
delete($hashName{key})
chomp($string)
FILEHANDLE
27. Returns all of the keys of the hash as an array
keys(%hash)
execution block
similar data types
length($string)
28. The two primary methods of executing _______ in perl: - system("command args") - - `command args`
command substitution
each(%hash)
array functions
system commands
29. To read an entire file into an array (one line per element)
like functions
arithmetic comparison operators
split(/\s/, $string)
@entireFile=<FILEHANDLE>
30. Regular __________: * - 0 or more characters - + - 1 or more characters - ? - 0 or 1 characters
unshift(@array, $newValue)
comments
@entireFile=<FILEHANDLE>
Expression Quantifiers
31. The use of ______ in perl - Documenting code - Created by placing a "#" on a line. - are not multi-line
reverse(%hashName)
comments
use moduleName; Ex: use Roman;
exists($hashName{keyName})
32. < - > - == - <= - >= - !=
Special array
chomp($string)
string manipulation functions
arithmetic comparison operators
33. In perl the _______ will recognize syntax errors and halt execution BEFORE it begins - and will output statements; it does not understand and the line which it encountered the error on
substr($string, $startindex, $numchars)
command substitution
interpreter
$hashName{keyName}="Value to Add"
34. Does the hash key with "keyName" exists
access modes
ucfirst($string)
last index
exists($hashName{keyName})
35. Two ____________ in regular expressions: =~ Contains - !~ Does not contain
basic binding operators
scalar
hash functions
@arrayName size
36. Common ___________: substr($string, $start, $numchars); - length($string) - lc($string) - uc($string) - chomp($string) - chomp(@string) - join(':", @string) - split(/\s/, $string) - lcfirst($string) - ucfirst($string)
delete($hashName{key})
string manipulation functions
Editing
$#arrayName
37. _________ $#arrayName give value of last index available in the array. Ex an array of size 5 will have its $#arrayName = 4
last index
system commands
lcfirst($string)
Special array
38. Remove trailing newline from each element in the array
exists($hashName{keyName})
delete($hashName{key})
chomp(@string)
Variable context
39. Common ________: pop(@array) - push(@array, $new Value) - shift(@array) - unshift(@array, $newValue) - sort(@array) - reverse(@array)
interpreter
values(%hash)
array functions
push(@array, $newValue)
40. Add a new element to the from of the array with the value $newwValue
lc($string)
scalar
Expression character classes
unshift(@array, $newValue)
41. Adds a new element to end of the array with value $newValue
values(%hash)
push(@array, $newValue)
ucfirst($string)
length($string)
42. The three basic ________ of the open() function: > write - >> append - < read file
last index
access modes
chomp(@string)
delete($hashName{key})
43. Delete the hash entry with the key given
delete($hashName{key})
access modes
%ENV hash array
Scalar variables
44. Assignment of hash variables in perl (when oringally defining the hash)
Array variables
basic binding operators
arithmetic comparison operators
%hashname = (key1=>"value1", key2=>"value2", key3=>"Value3")
45. _________ @arrayName) returns the size of the array
print(FILEHANDLE "Data to outputn");
command substitution
scalar
unshift(@array, $newValue)
46. Returns the length of the string including escape sequences
@ARGV
length($string)
hash functions
last index
47. Common ________: keys(%hash) - values(%hash) - each(%hash) - delete($hash{keyName}) - exists($hash{keyName}) - reverse(%hash)
reverse(%hashName)
substr($string, $startindex, $numchars)
reverse(@array)
hash functions
48. The open() statement in perl: open(________, file_mode, "filename.txt")
Special array
FILEHANDLE
Array variables
flow-control
49. Swap keys for values and values for keys. Will cause issues if there are multiple hash entries with the same value
size string comparison operators
execution block
push(@array, $newValue)
reverse(%hashName)
50. In arrays elements need not be __________
split(/\s/, $string)
similar data types
%hashname = (key1=>"value1", key2=>"value2", key3=>"Value3")
access modes