InterviewSolution
This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
What is the use of the ’$_’ symbol? |
|
Answer» $ is default input and PATTERN MATCHING SPACE variable in Perl. |
|
| 2. |
How will you remove the duplicate data from @array=("perl", "php”, "per", "asp")? |
|
Answer» SUB uniqueString {
|
|
| 3. |
How to add two arrays together ? |
|
Answer» @sumarray = (@arr1,@ARR2); |
|
| 4. |
What are the types of operator Perl have ? |
Answer»
|
|
| 5. |
What is the grep function also write the syntax of it? |
|
Answer» The grep function is USED as a filter an array list that RUNS a REGULAR expression and returns TRUE and EVALUATED element. Syntax @List = grep(Expression, @array). |
|
| 6. |
How to declare a variable in Perl? |
|
Answer» We are not REQUIRED to declare a variable EXPLICITLY to reserve MEMORY space, but its automatically when we ASSIGN a VALUE to the variable using an equal sign(=). |
|
| 7. |
How Perl uses an interpreter? |
|
Answer» The program is compiled into the parse tree by the interpreter which ignores words, SPACES or marks after a pound symbol. Once parse tree conversion will be done it will execute it immediately. We know Perl as an INTERPRETED LANGUAGE, which converts the program into BYTECODE before EXECUTION. Moreover, it does not store compiled file. |
|
| 8. |
Why Perl warnings are important? |
|
Answer» The Perl warning gives you the most basic way to GET a quality CHECK of CODE that is DEVELOPED by programmers. |
|
| 9. |
How to reuse code explain with an example. |
|
Answer» Perl provides a reuse code ability which is called inheritance in this child CLASS can use the methods of the parent class. ExamplePACKAGE Parent;
|
|
| 10. |
Write a function that is only available inside the scope. |
|
Answer» $pvt = CALCULATION(5,5);
|
|
| 12. |
What are the data types we have in perl explain? |
|
Answer» There are 3 SORTS of data types
|
|
| 13. |
Read the following lines and differentiate single and double quote. |
|
Answer» 1. print "Hello, world\n"; 2. print 'Hello, world\n'; Both will gives you DIFFERENT result like this :- Hello, world ALSO quotes interpolate variables and SPECIAL characters, whereas same thing does not work for single. |
|
| 14. |
Print hello world using perl also explain it. |
|
Answer» $perl -e 'print "HELLO World\n"' -e REPRESENT perl interpreter at command LINE while $ is prompt here. Perl file will be saved with dot (. pl) pl EXTENSION. |
|
| 15. |
How to install Perl on Windows? |
Answer»
|
|
| 16. |
How to install Perl on and Linux and Unix? |
|
Answer» INSTALLATION on Linux and UNIX carry same process–
Perl has a standard location to install it in /usr/local/bin and its libraries will be installed in /usr/local/lib/perlXX, XX is the version of Perl that you have installed.Once you have done with all this process then you can check Perl version typing Perl –v on cmd. |
|
| 19. |
What is Subroutine in Perl? |
|
Answer» A GROUP of statements that perform a task SIDE by side is called a SUBROUTINE. Code DEVIATION is also PROVIDED by subroutine so that each can perform a specific task at the same time. |
|
| 20. |
What is the socket call in advance Perl ? |
|
Answer» In an ESTABLISHED network connection, a socket CALL is the FIRST call that CREATES a socket. |
|
| 21. |
Which alternate will you use in case your machine is not running an email server? |
|
Answer» We can go with SMTP Server which is available at a REMOTE location along with requiring INFORMATION as Id-password and URL. Once you GET all these details to share your information to send() method Example$msg->send('smtp', "smtp.myisp.net", AuthUser=>"id", AuthPass=>"password" ); |
|
| 22. |
What is a die function in error handling? |
|
Answer» Die FUNCTION is a kind of warning that LEADS an exit call. Which means it immediately terminates the execution in case of error occurrence. ExampleCHDIR('/etc') or die "Can't change directory"; |
|
| 23. |
What is error handling? |
|
Answer» When your PROGRAMME takes APPROPRIATE action against the error occurs which MAY OCCUR during the programme execution. |
|
| 24. |
Differentiate Chop & Chomp function. |
|
Answer» Chop function and Chomp function both are used to ELIMINATE the last character from an EXPRESSION, each element of the list but in case of chomp function if values of ELEMENTS MATCH only then chomp will follow the elimination TERM. That is the reason why chomp is preferable more than chop. |
|