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