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