WorksheetsPerl
Total questions: 15
Worksheet time: 8mins
In Perl, which symbol is used to indicate a scalar variable?
@
%
$
&
What is the correct way to declare an array in Perl?
@array = (1, 2, 3, 4);
array = [1, 2, 3, 4];
$array = {1, 2, 3, 4};
%array = (1, 2, 3, 4);
What is the default variable in Perl that stores the current topic or input?
%_
$_
@ARGV
$default
Which of the following is a valid Perl loop statement?
for(condition) {}
foreach my $item (@array) { print $item; }
loop() {}
do while() {}
What is the correct way to check if two scalar values are equal in Perl?
if ($x = $y)
if ($x == $y)
if ($x eq $y)
if ($x equals $y)
How are string values concatenated in Perl?
Using the . operator
Using the + operator
Using the & operator
Using the , operator
Which function is used to get user input from the keyboard in Perl?
get()
<STDIN>
read()
input()
How do you define a function in Perl?
function myFunction() { }
def myFunction() { }
sub myFunction { }
fn myFunction() { }
How do you pass parameters to a function in Perl?
function(param1, param2)
myFunction[param1, param2]
sub myFunction { my ($param1, $param2) = @_; }
def myFunction(param1, param2)
What is the purpose of the return statement in a Perl function?
To exit the program
To return a value from a function
To declare a function
To call another function
What is the significance of namespaces in Perl?
They store large datasets
They prevent naming conflicts between functions and variables
They improve execution speed
They convert data types
How do you open a file for reading in Perl?
open(FILE, "filename.txt");
open my $fh, "read", "filename.txt";
file_open("filename.txt", "r");
open(my $fh, "<", "filename.txt");
Which function is used to read a line from a file in Perl?
readFile()
<$fh>
get()
fetch()
What happens if you try to open a non-existent file in Perl without error handling?
Perl creates a new file
Perl throws an error
Perl ignores the statement
The program continues execution normally
In BioPerl, which module is commonly used for handling biological sequences?
Bio::File
Bio::Seq
Bio::Search
Bio::Genome
