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