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