
Q121
Q121 Why might $@ be empty after an eval block?
The eval block contained no errors
Perl does not store errors
$@ must be initialized manually
Errors are not supported in Perl
Q122
Q122 What is the purpose of the DBI module in Perl?
Handles database connections and queries
Parses JSON data
Manages file operations
Creates HTML reports
Q123
Q123 Which method is used to establish a database connection in Perl DBI?
connect_db
DBI->connect
db_open
start_connection
Q124
Q124 What is the significance of RaiseError in DBI?
Automatically raises exceptions on errors
Ignores database errors
Prints database warnings
Disconnects from the database
Q125
Q125 What does AutoCommit => 1 do in a DBI connection?
Commits transactions automatically
Disables transactions
Delays commits
Requires manual commit calls
Q126
Q126 What does the following Perl DBI code do?
my $dbh = DBI->connect("DBI:mysql:database=test", "user", "pass");
Opens a file
Connects to a MySQL database
Starts a web server
Creates a new hash
Q127
Q127 What is the correct way to execute a SQL query in Perl DBI?
$dbh->query("SELECT * FROM users");
$dbh->execute("SELECT * FROM users");
$dbh->prepare("SELECT * FROM users")->execute();
$dbh->run("SELECT * FROM users");
Q128
Q128 Why does DBI->connect return undef?
The module is outdated
The connection parameters are incorrect
Perl does not support databases
The database must be restarted first
Q129
Q129 Why does $sth->execute(); fail after prepare()?
The query is missing
Database connection is closed
The SQL statement has syntax errors
Perl does not support SQL
Q130
Q130 What is the purpose of the CGI module in Perl?
Handling file operations
Generating HTML and handling web requests
Managing database queries
Creating desktop applications
Q131
Q131 How does a Perl CGI script typically send content to a web browser?
Using print "Content-Type: text/html\n\n";
Using echo "text/html"
Using header("text/html")
Using send_html("text/html")
Q132
Q132 What does param() do in a CGI script?
Retrieves query parameters from a web request
Creates an HTML form
Executes a Perl function
Connects to a database
Q133
Q133 What will the following CGI code output?
print header(), start_html("My Page"), h1("Hello, World!"), end_html();
An HTML page with "Hello, World!" as a heading
A plain text output
A 500 internal server error
Nothing
Q134
Q134 How do you correctly retrieve a form parameter named "user" in Perl CGI?
$user = get("user");
$user = param("user");
$user = $_GET{"user"};
$user = request("user");
Q135
Q135 Why does a CGI script output "500 Internal Server Error"?
The Perl script contains syntax errors
The HTML code is incorrect
CGI does not support Perl
The browser does not support CGI
Q136
Q136 Why does param("name") return an empty value in a CGI script?
The CGI module is missing
The script did not receive a name parameter
Perl does not support CGI
param() requires an explicit return type
Q137
Q137 Why is use strict; recommended in Perl scripts?
It improves performance
It forces explicit variable declaration
It automatically fixes syntax errors
It disables warnings
Q138
Q138 What security risk does Perl’s eval function pose?
It may delete system files
It can execute arbitrary code if misused
It prevents secure database connections
It slows down execution
Q139
Q139 How can Perl scripts mitigate the risk of command injection?
Using system() for all commands
Filtering user input and avoiding system() calls
Disabling Perl warnings
Running scripts with root privileges
Q140
Q140 What is the purpose of Perl’s taint mode?
Improves script speed
Detects security risks in user input
Logs all executed commands
Disables certain functions
Q141
Q141 How do you enable taint mode in a Perl script?
use strict;
perl -T script.pl
set_taint_mode();
use warnings;
Q142
Q142 Why might a Perl script fail when running with -T (taint mode)?
The script has syntax errors
The script is using tainted user input
Perl does not support -T
The script is missing use warnings;
Q143
Q143 Why is storing passwords directly in Perl scripts a security risk?
It causes performance issues
Plain text passwords can be exposed
Perl does not support password storage
It makes scripts slower
Q144
Q144 What is one of Perl’s most common real-world applications?
Mobile app development
Game development
Text processing and automation
Embedded systems programming
Q145
Q145 How does Perl contribute to bioinformatics research?
It is used for high-performance computing
It helps in processing genetic sequence data
It controls lab hardware
It is used for 3D modeling
Q146
Q146 Why is Perl commonly used in network security applications?
It provides a built-in firewall
It has built-in encryption algorithms
It supports powerful text processing for log analysis
It replaces traditional antivirus software
Q147
Q147 How does the following Perl script help in system administration?
while (
It reads a log file and filters for errors
It writes error messages to a file
It modifies log files
It creates new log files
Q148
Q148 How does Perl help in web scraping applications?
By creating databases
By automating HTTP requests and parsing HTML
By generating CSS files
By designing frontend UI
Q149
Q149 Why might a Perl web automation script fail unexpectedly?
The script has incorrect permissions
The target website structure changed
Perl does not support HTTP requests
The script requires a database connection
Q150
Q150 Why does a Perl-based ETL (Extract, Transform, Load) script crash on large datasets?
Perl does not support ETL operations
The script runs out of memory due to inefficient processing
Perl has a file size limit
Databases do not support Perl scripts