Perl Introduction
Which statement best describes Perl as a programming language?
- Perl is a high-level, interpreted language often used for text processing.
- Perl is exclusively a database query language.
- Perl is a low-level language primarily used for operating system kernels.
- Perl is only used for web page design.
- Perl is a hardware control language similar to assembly.
Script Syntax
What symbol does a Perl script use to indicate the start of a scalar variable, such as in $name?
- u0026
- @
- ?
- $
- %
Comments in Perl
How do you write a single-line comment in Perl?
- # This is a comment
- // This is a comment
- /* This is a comment */
- -- This is a comment
- u003C!-- This is a comment --u003E
Basic Input/Output
Which Perl function is commonly used to display output to the screen, such as printing 'Hello World'?
- out()
- show()
- print()
- display()
- output()
Array Declaration
Which of the following is the correct way to declare an array of numbers in Perl?
- $numbers = (1, 2, 3);
- @numbers = [1 2 3];
- @numbers = (1, 2, 3);
- numbers = {1, 2, 3};
- %numbers = (1, 2, 3);
Regular Expressions
If you want to check if a string exactly matches the word 'Perl', which Perl operator is typically used?
- ==
- =~
- u003C=
- !==
- ?:
File Handling Basics
Which Perl function can be used to open a file for reading?
- connect()
- readfile()
- open()
- usefile()
- access()
Use Case Scenario
For which task is Perl especially well-suited and often chosen?
- Advanced 3D graphics rendering
- Complex video game development
- Automating text file processing and report generation
- Developing mobile operating systems
- Designing microchip hardware layouts
Variable Types
What is the symbol used to represent a hash (associative array) in Perl, as in %fruits?
- u0026
- %
- *
- $
- @
Script Execution
Which file extension is most commonly used for Perl script files?
- .sh
- .py
- .pl
- .rb
- .js