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 upper case
uc($string)
(@array)
Assignment
@ARGV
2. The three basic ________ of the open() function: > write - >> append - < read file
substr($string, $startindex, $numchars)
comments
access modes
Array variables
3. Arrays can be assigned or read in _________
system() function
execution block
scalar context (Ex: $myArray[4] = 2)
push(@array, $newValue)
4. Returns a two element ray of the next key value pair; resultArray[0] is the key resultArray[1] is the value
each(%hash)
execution block
@arrayName size
length($string)
5. eq - ne - lt - le - gt - ge
size string comparison operators
execution block
arithmetic comparison operators
interpreter
6. _________ @arrayName) returns the size of the array
system() function
scalar
size string comparison operators
Variable context
7. Stores information about the current users environment. You can print this from the command line using printenv
FILEHANDLE
@ARGV
@entireFile=<FILEHANDLE>
%ENV hash array
8. _________ of scalar variables in perl - using "=" - Ex: $myVariable = 5;
Assignment
Special array
command substitution
like functions
9. Removes the last element from the array pop
%hashname = (key1=>"value1", key2=>"value2", key3=>"Value3")
substr($string, $startindex, $numchars)
scalar context (Ex: $myArray[4] = 2)
(@array)
10. The four types of loops in perl: while - until - for - ________
foreach
Assignment
each(%hash)
system() function
11. The two primary methods of executing _______ in perl: - system("command args") - - `command args`
Variable context
basic binding operators
scalar
system commands
12. _________ $#arrayName give value of last index available in the array. Ex an array of size 5 will have its $#arrayName = 4
Special array
values(%hash)
exists($hashName{keyName})
(@array)
13. Common ________: pop(@array) - push(@array, $new Value) - shift(@array) - unshift(@array, $newValue) - sort(@array) - reverse(@array)
array functions
use moduleName; Ex: use Roman;
@arrayName size
ucfirst($string)
14. The open() statement in perl: open(________, file_mode, "filename.txt")
(@array)
FILEHANDLE
arithmetic comparison operators
push(@array, $newValue)
15. Does the hash key with "keyName" exists
exists($hashName{keyName})
command substitution
string manipulation functions
print(FILEHANDLE "Data to outputn");
16. In arrays elements need not be __________
execution block
Scalar variables
foreach
similar data types
17. 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
interpreter
%ENV hash array
newline
arithmetic comparison operators
18. A special system variable used to pass arguments to script
array functions
@ARGV
Special array
exists($hashName{keyName})
19. Assignment of a hash variable for a single hash element
hash functions
join(':', @array)
Expression Quantifiers
$hashName{keyName}="Value to Add"
20. Returns a copy of the string with the first letter lower case
foreach
system() function
like functions
lcfirst($string)
21. _________ in perl - An associative array
Hash variables
push(@array, $newValue)
Array variables
hash functions
22. Delete the hash entry with the key given
flow-control
unshift(@array, $newValue)
delete($hashName{key})
chomp(@string)
23. Returns all of the keys of the hash as an array
keys(%hash)
Hash variables
newline
last index
24. scalar(@arrayName) returns the ______ of the array names
use moduleName; Ex: use Roman;
@arrayName size
string manipulation functions
Expression character classes
25. The variable that provides the last index of an array
interpreter
$#arrayName
lc($string)
Expression Quantifiers
26. The use of "if" "if-else" and "if-elsif-else"
last index
substr($string, $startindex, $numchars)
flow-control
scalar context (Ex: $myArray[4] = 2)
27. Modules in perl - Synonymous with header files in C - Collection of ______ and variables that may be used in your program
Expression character classes
like functions
$#arrayName
use moduleName; Ex: use Roman;
28. Returns the length of the string including escape sequences
exists($hashName{keyName})
length($string)
system() function
Array variables
29. Removes trailing newline
chomp($string)
keys(%hash)
$hashName{keyName}="Value to Add"
FILEHANDLE
30. Returns all of the values of the hash as an array
chomp($string)
values(%hash)
Scalar variables
system() function
31. The use of ______ in perl - Documenting code - Created by placing a "#" on a line. - are not multi-line
interpreter
comments
like functions
$hashName{keyName}="Value to Add"
32. Returns a copy of the string as all lower case
length($string)
lc($string)
Assignment
$hashName{keyName}="Value to Add"
33. Returns the sub string starting at index $startindex and ending after $numchars chars in the string $string
chomp(@string)
substr($string, $startindex, $numchars)
delete($hashName{key})
@ARGV
34. Common ________: keys(%hash) - values(%hash) - each(%hash) - delete($hash{keyName}) - exists($hash{keyName}) - reverse(%hash)
hash functions
command substitution
interpreter
print(FILEHANDLE "Data to outputn");
35. Split string into an array using spaces as delimeter
split(/\s/, $string)
@entireFile=<FILEHANDLE>
Editing
hash functions
36. Explain how to read a line from a file handle
$line=<FILEHANDLE>
array functions
Expression Quantifiers
push(@array, $newValue)
37. Two ____________ in regular expressions: =~ Contains - !~ Does not contain
reverse(%hashName)
basic binding operators
keys(%hash)
reverse(@array)
38. Assignment of hash variables in perl (when oringally defining the hash)
%hashname = (key1=>"value1", key2=>"value2", key3=>"Value3")
push(@array, $newValue)
unshift(@array, $newValue)
FILEHANDLE
39. Adds a new element to end of the array with value $newValue
Scalar variables
push(@array, $newValue)
Expression character classes
print(FILEHANDLE "Data to outputn");
40. Removes the first element of the array shift
system commands
(@array)
@arrayName size
Variable context
41. ________ in perl - can be scalar array or hash context - tells the interpreter what you are looking for (Ex: "$arrayname[$index_number]")
lc($string)
unshift(@array, $newValue)
Variable context
ucfirst($string)
42. 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
exists($hashName{keyName})
system() function
chomp($string)
uc($string)
43. Common ___________: substr($string, $start, $numchars); - length($string) - lc($string) - uc($string) - chomp($string) - chomp(@string) - join(':", @string) - split(/\s/, $string) - lcfirst($string) - ucfirst($string)
Scalar variables
keys(%hash)
string manipulation functions
print(FILEHANDLE "Data to outputn");
44. < - > - == - <= - >= - !=
interpreter
Hash variables
ucfirst($string)
arithmetic comparison operators
45. To include modules in perl
Hash variables
execution block
use moduleName; Ex: use Roman;
system commands
46. Regular ____________: w - alphanumeric word including underscor - d - digits 0-9 - s any whitespace - . - any character
join(':', @array)
basic binding operators
Expression character classes
reverse(%hashName)
47. To write to a filehandle
newline
Array variables
print(FILEHANDLE "Data to outputn");
Scalar variables
48. Reverses the elements of the array
reverse(@array)
interpreter
delete($hashName{key})
newline
49. _________ in perl - Singular variable - starts with "$" - Number or characer or string- Perl does automatic type conversion of these
Scalar variables
unshift(@array, $newValue)
%ENV hash array
flow-control
50. Remove trailing newline from each element in the array
Editing
$hashName{keyName}="Value to Add"
chomp(@string)
system commands
Can you answer 50 questions in 15 minutes?
Let me suggest you:
Browse all subjects
Browse all tests
Most popular tests
Major Subjects
Tests & Exams
AP
CLEP
DSST
GRE
SAT
GMAT
Certifications
CISSP go to https://www.isc2.org/
PMP
ITIL
RHCE
MCTS
More...
IT Skills
Android Programming
Data Modeling
Objective C Programming
Basic Python Programming
Adobe Illustrator
More...
Business Skills
Advertising Techniques
Business Accounting Basics
Business Strategy
Human Resource Management
Marketing Basics
More...
Soft Skills
Body Language
People Skills
Public Speaking
Persuasion
Job Hunting And Resumes
More...
Vocabulary
GRE Vocab
SAT Vocab
TOEFL Essential Vocab
Basic English Words For All
Global Words You Should Know
Business English
More...
Languages
AP German Vocab
AP Latin Vocab
SAT Subject Test: French
Italian Survival
Norwegian Survival
More...
Engineering
Audio Engineering
Computer Science Engineering
Aerospace Engineering
Chemical Engineering
Structural Engineering
More...
Health Sciences
Basic Nursing Skills
Health Science Language Fundamentals
Veterinary Technology Medical Language
Cardiology
Clinical Surgery
More...
English
Grammar Fundamentals
Literary And Rhetorical Vocab
Elements Of Style Vocab
Introduction To English Major
Complete Advanced Sentences
Literature
Homonyms
More...
Math
Algebra Formulas
Basic Arithmetic: Measurements
Metric Conversions
Geometric Properties
Important Math Facts
Number Sense Vocab
Business Math
More...
Other Major Subjects
Science
Economics
History
Law
Performing-arts
Cooking
Logic & Reasoning
Trivia
Browse all subjects
Browse all tests
Most popular tests