- Perl Basics
- Perl - Home
- Perl - Introduction
- Perl - Environment
- Perl - Syntax Overview
- Perl - Data Types
- Perl - Variables
- Perl - Scalars
- Perl - Arrays
- Perl - Hashes
- Perl - IF...ELSE
- Perl - Loops
- Perl - Operators
- Perl - Date & Time
- Perl - Subroutines
- Perl - References
- Perl - Formats
- Perl - File I/O
- Perl - Directories
- Perl - Error Handling
- Perl - Special Variables
- Perl - Coding Standard
- Perl - Regular Expressions
- Perl - Sending Email
- Perl Advanced
- Perl - Socket Programming
- Perl - Object Oriented
- Perl - Database Access
- Perl - CGI Programming
- Perl - Packages & Modules
- Perl - Process Management
- Perl - Embedded Documentation
- Perl - Functions References
- Perl Useful Resources
- Perl - Questions and Answers
- Perl - Quick Guide
- Perl - Useful Resources
- Perl - Discussion
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Perl Mock Test
This section presents you various set of Mock Tests related to Perl. You can download these sample mock tests at your local machine and solve offline at your convenience. Every mock test is supplied with a mock test key to let you verify the final score and grade yourself.
Perl Mock Test I
Q 1 - Which of the following is correct about Perl?
A - Perl stands for Practical Extraction and Report Language.
C - Perl supports both procedural and object-oriented programming.
Answer : D
Explanation
All of the above options are correct.
Q 2 - Which of the following is correct about Perl?
A - Perl can handle encrypted Web data, including e-commerce transactions.
Answer : D
Explanation
All of the above options are correct.
Q 3 - Which of the following interpolates variables and special characters in Perl?
A - Single Quotes based String
Answer : B
Explanation
Only double quotes interpolate variables and special characters such as newlines , where as single quote does not interpolate any variable or special character.
Answer : A
Explanation
Perl is a case sensitive programming language. Thus $Manpower and $manpower are two different identifiers in Perl.
Q 5 - Which of the following data type is suppported in Perl?
Answer : D
Explanation
All of the above data types are supported in Perl.
Q 6 - Which of the following correctly describes scalar data types in Perl?
A - These are simple variables. They are preceded by a dollar sign ($).
B - These are ordered lists of scalars that you access with a numeric index which starts with 0.
C - These are unordered sets of key/value pairs that you access using the keys as subscripts.
Answer : A
Explanation
Scalars are simple variables. They are preceded by a dollar sign ($). A scalar is either a number, a string, or a reference. A reference is actually an address of a variable, which we will see in the upcoming chapters.
Q 7 - Which of the following correctly describes Array data types in Perl?
A - These are simple variables. They are preceded by a dollar sign ($).
B - These are ordered lists of scalars that you access with a numeric index which starts with 0.
C - These are unordered sets of key/value pairs that you access using the keys as subscripts.
Answer : B
Explanation
Arrays are ordered lists of scalars that you access with a numeric index which starts with 0. They are preceded by an "at" sign (@).
Q 8 - Which of the following correctly describes Hashes data types in Perl?
A - These are simple variables. They are preceded by a dollar sign ($).
B - These are ordered lists of scalars that you access with a numeric index which starts with 0.
C - These are unordered sets of key/value pairs that you access using the keys as subscripts.
Answer : C
Explanation
Hashes are unordered sets of key/value pairs that you access using the keys as subscripts. They are preceded by a percent sign (%).
Q 9 - Which of the following data types are preceded by a dollar sign ($) in Perl?
Answer : A
Explanation
Scalars are preceded by a dollar sign ($).
Q 10 - Which of the following data types are preceded by an "at" sign (@) in Perl?
Answer : B
Explanation
Arrays are preceded by an "at" sign (@).
Q 11 - Which of the following data types are preceded by a percent sign (%) in Perl?
Answer : C
Explanation
Hashes are preceded by a percent sign (%).
Q 12 - In which of the following variable context, assignment to a scalar variable evaluates the right-hand side in a scalar context?
Answer : A
Explanation
Scalar − Assignment to a scalar variable evaluates the right-hand side in a scalar context.
Q 13 - In which of the following variable context, assignment to an array or a hash evaluates the right-hand side in a list context?
Answer : B
Explanation
List − Assignment to an array or a hash evaluates the right-hand side in a list context.
Q 14 - In which of the following variable context, an expression is being evaluated to see whether it's true or false?
Answer : C
Explanation
Boolean − Boolean context is simply any place where an expression is being evaluated to see whether it's true or false.
Q 15 - Which of the following variable context doesn't care what the return value is?
Answer : D
Explanation
Void − This context not only doesn't care what the return value is, it doesn't even want a return value.
Q 16 - Which of the following variable context only happens inside quotes, or things that work like quotes?
Answer : A
Explanation
Interpolative − This context only happens inside quotes, or things that work like quotes.
Q 17 - Which of the following special variable represents current file name?
Answer : B
Explanation
_FILE_ -represents current file name.
Q 18 - Which of the following special variable represents current line number?
Answer : C
Explanation
_LINE_ -represents current line number.
Q 19 - Which of the following special variable represents current package name?
Answer : A
Explanation
_PACKAGE_ -represents current package name.
Q 20 - Which of the following is correct about Array in Perl?
A - An array is a variable that stores an ordered list of scalar values.
Answer : D
Explanation
All of the above options are correct.
Q 21 - Which of the following method pushes the values of the list onto the end of the array?
Answer : A
Explanation
push @ARRAY, LIST − Pushes the values of the list onto the end of the array.
Q 22 - Which of the following method pops off and returns the last value of the array?
Answer : B
Explanation
pop @ARRAY - Pops off and returns the last value of the array.
Q 23 - Which of the following method shifts the first value of the array off and returns it, shortening the array by 1 and moving everything down?
Answer : C
Explanation
shift @ARRAY − Shifts the first value of the array off and returns it, shortening the array by 1 and moving everything down.
Q 24 - Which of the following method prepends list to the front of the array, and returns the number of elements in the new array?
Answer : D
Explanation
unshift @ARRAY, LIST - Prepends list to the front of the array, and returns the number of elements in the new array.
Q 25 - Which of the following method remove the elements of @ARRAY designated by OFFSET and LENGTH, and replaces them with LIST, if specified?
A - splice @ARRAY, OFFSET [ , LENGTH [ , LIST ] ]
B - split @ARRAY, OFFSET [ , LENGTH [ , LIST ] ]
Answer : A
Explanation
splice @ARRAY, OFFSET [ , LENGTH [ , LIST ] ] - This function will remove the elements of @ARRAY designated by OFFSET and LENGTH, and replaces them with LIST, if specified. Finally, it returns the elements removed from the array.
Answer Sheet
Question Number | Answer Key |
---|---|
1 | D |
2 | D |
3 | B |
4 | A |
5 | D |
6 | A |
7 | B |
8 | C |
9 | A |
10 | B |
11 | C |
12 | A |
13 | B |
14 | C |
15 | D |
16 | A |
17 | B |
18 | C |
19 | A |
20 | D |
21 | A |
22 | B |
23 | C |
24 | D |
25 | A |