faq on perl.docx

100
Why do you use Perl? Perl is a powerful free interpreter. Perl is portable, flexible and easy to learn. How do I set environment variables in Perl programs? you can just do something like this: $path = $ENV{'PATH'}; As you may remember, "%ENV" is a special hash in Perl that contains the value of all your environment variables. Because %ENV is a hash, you can set environment variables just as you'd set the value of any Perl hash variable. Here's how you can set your PATH variable to make sure the following four directories are in your path:: $ENV{'PATH'} = '/bin:/usr/bin:/usr/local/bin:/home/yourname/bin'; Which of these is a difference between C++ and Perl? Perl can have objects whose data cannot be accessed outside its class, but C++ cannot. Perl can use closures with unreachable private data as objects, and C++ doesn't support closures. Furthermore, C++ does support pointer arithmetic via `int *ip = (int*)&object', allowing you do look all over the object. Perl doesn't have pointer arithmetic. It also doesn't allow `#define private public' to change access rights to foreign objects. On the other hand, once you start poking around in /dev/mem, no one is safe. How to open and read data files with Perl Data files are opened in Perl using the open() function. When you open a data file, all you have to do is specify (a) a file handle and (b) the name of the file you want to read from. As an example, suppose you need to read some data from a file named "checkbook.txt". Here's a simple open statement that opens the checkbook file for read access: open (CHECKBOOK, "checkbook.txt"); In this example, the name "CHECKBOOK" is the file handle that you'll use later when reading from the checkbook.txt data file. Any time you want to read data from the checkbook file, just use the file handle named "CHECKBOOK". Now that we've opened the checkbook file, we'd like to be able to read what's in it. Here's how to read one line of data from the checkbook file: $record = < CHECKBOOK > ; After this statement is executed, the variable $record contains the contents of the first line of the checkbook file. The "<>" symbol is called the line reading operator. To print every record of information from the checkbook file open (CHECKBOOK, "checkbook.txt") || die "couldn't open the file!"; while ($record = < CHECKBOOK >) { print $record;

Upload: ashwani-gupta

Post on 13-Apr-2015

156 views

Category:

Documents


0 download

DESCRIPTION

FAQ On Perl

TRANSCRIPT

Page 1: FAQ on Perl.docx

Why do you use Perl?Perl is a powerful free interpreter. Perl is portable, flexible and easy to learn.

How do I set environment variables in Perl programs? you can just do something like this: $path = $ENV{'PATH'};As you may remember, "%ENV" is a special hash in Perl that contains the value of all your environment variables.Because %ENV is a hash, you can set environment variables just as you'd set the value of any Perl hash variable. Here's how you can set your PATH variable to make sure the following four directories are in your path::$ENV{'PATH'} = '/bin:/usr/bin:/usr/local/bin:/home/yourname/bin';

Which of these is a difference between C++ and Perl? Perl can have objects whose data cannot be accessed outside its class, but C++ cannot.Perl can use closures with unreachable private data as objects, and C++ doesn't support closures. Furthermore, C++ does support pointer arithmetic via `int *ip = (int*)&object', allowing you do look all over the object. Perl doesn't have pointer arithmetic. It also doesn't allow `#define private public' to change access rights to foreign objects. On the other hand, once you start poking around in /dev/mem, no one is safe.

How to open and read data files with Perl Data files are opened in Perl using the open() function. When you open a data file, all you have to do is specify (a) a file handle and (b) the name of the file you want to read from.As an example, suppose you need to read some data from a file named "checkbook.txt". Here's a simple open statement that opens the checkbook file for read access: open (CHECKBOOK, "checkbook.txt"); In this example, the name "CHECKBOOK" is the file handle that you'll use later when reading from the checkbook.txt data file. Any time you want to read data from the checkbook file, just use the file handle named "CHECKBOOK".Now that we've opened the checkbook file, we'd like to be able to read what's in it. Here's how to read one line of data from the checkbook file:$record = < CHECKBOOK > ;After this statement is executed, the variable $record contains the contents of the first line of the checkbook file. The "<>" symbol is called the line reading operator.To print every record of information from the checkbook file

open (CHECKBOOK, "checkbook.txt") || die "couldn't open the file!";while ($record = < CHECKBOOK >) {print $record;}close(CHECKBOOK);

How do I do fill_in_the_blank for each file in a directory? Here's code that just prints a listing of every file in the current directory:#!/usr/bin/perl -wopendir(DIR, ".");@files = readdir(DIR);closedir(DIR);

Page 2: FAQ on Perl.docx

foreach $file (@files) {print "$file\n";}

How do I do fill_in_the_blank for each file in a directory?

Here's code that just prints a listing of every file in the current directory:#!/usr/bin/perl -wopendir(DIR, ".");@files = readdir(DIR);closedir(DIR);foreach $file (@files) {print "$file\n";}

How do I generate a list of all .html files in a directory? Here's a snippet of code that just prints a listing of every file in the current directory that ends with the extension .html:#!/usr/bin/perl -wopendir(DIR, ".");@files = grep(/\.html$/,readdir(DIR));closedir(DIR);foreach $file (@files) {print "$file\n";}

What is Perl one-liner? There are two ways a Perl script can be run:--from a command line, called one-liner, that means you type and execute immediately on the command line. You'll need the -e option to start like "C:\ %gt perl -e "print \"Hello\";". One-liner doesn't mean one Perl statement. One-liner may contain many statements in one line.--from a script file, called Perl program.

Assuming both a local($var) and a my($var) exist, what's the difference between ${var} and ${"var"}? ${var} is the lexical variable $var, and ${"var"} is the dynamic variable $var.Note that because the second is a symbol table lookup, it is disallowed under `use strict "refs"'. The words global, local, package, symbol table, and dynamic all refer to the kind of variables that local() affects, whereas the other sort, those governed by my(), are variously knows as private, lexical, or scoped variable.

What happens when you return a reference to a private variable? Perl keeps track of your variables, whether dynamic or otherwise, and doesn't free things before you're done using them.

How to turn on Perl warnings? Why is that important? Perl is very forgiving of strange and sometimes wrong code, which can mean hours spent searching for bugs and weird results. Turning on warnings helps uncover common

Page 3: FAQ on Perl.docx

mistakes and strange places and save a lot of debugging time in the long run. There are various ways of turning on Perl warnings: For Perl one-liner, use -w option on the command line. On Unix or Windows, use the -w option in the shebang line (The first # line in the script). Note: Windows Perl interpreter may not require it. For other systems, choose compiler warnings, or check compiler documentation.

What are scalar data and scalar variables? Perl has a flexible concept of data types. Scalar means a single thing, like a number or string. So the Java concept of int, float, double and string equals to Perl\'s scalar in concept and the numbers and strings are exchangeable. Scalar variable is a Perl variable that is used to store scalar data. It uses a dollar sign $ and followed by one or more alphanumeric characters or underscores. It is case sensitive.

Why should I use the -w argument with my Perl programs?Many Perl developers use the -w option of the interpreter, especially during the development stages of an application. This warning option turns on many warning messages that can help you understand and debug your applications.To use this option on Unix systems, just include it on the first line of the program, like this:#!/usr/bin/perl -wIf you develop Perl apps on a DOS/Windows computer, and you're creating a program named myApp.pl, you can turn on the warning messages when you run your program like this:perl -w myApp.pl

Assuming $_ contains HTML, which of the following substitutions will remove all tags in it?1.s/<.*>//g;2.s/<.*?>//gs;3.s/<\/?[A-Z]\w*(?:\s+[A-Z]\w*(?:\s*=\s*(?:(["']).*?\1|[\w-.]+))?)*\s*>//gsix;

You can't do that.If it weren't for HTML comments, improperly formatted HTML, and tags with interesting data like < SCRIPT >, you could do this. Alas, you cannot. It takes a lot more smarts, and quite frankly, a real parser. 

I want users send data by formmail but when they send nothing or call it from web site they will see error.codes in PHP like this:if (isset($HTTP_POST_VARS)){..........}else{echo ("error lalalalal")}How it will look in perl?

In php it will be like if (isset($HTTP_POST_VARS)){....}

Page 4: FAQ on Perl.docx

In perl, tried this.if ($ENV{'REQUEST_METHOD'} eq 'POST'){.....}

What is the output of the following Perl program?1 $p1 = "prog1.java";2 $p1 =~ s/(.*)\.java/$1.cpp/;3 print "$p1\n";

prog1.cpp

Why aren't Perl's patterns regular expressions?

Because Perl patterns have backreferences.A regular expression by definition must be able to determine the next state in the finite automaton without requiring any extra memory to keep around previous state. A pattern /([ab]+)c\1/ requires the state machine to remember old states, and thus disqualifies such patterns as being regular expressions in the classic sense of the term.

What does Perl do if you try to exploit the execve(2) race involving setuid scripts?

Sends mail to root and exits.It has been said that all programs advance to the point of being able to automatically read mail. While not quite at that point (well, without having a module loaded), Perl does at least automatically send it.

How do I do < fill-in-the-blank > for each element in a hash? Here's a simple technique to process each element in a hash:

#!/usr/bin/perl -w

%days = ('Sun' =>'Sunday','Mon' => 'Monday','Tue' => 'Tuesday','Wed' => 'Wednesday','Thu' => 'Thursday','Fri' => 'Friday','Sat' => 'Saturday' );

foreach $key (sort keys %days) {print "The long name for $key is $days{$key}.\n";}

How do I sort a hash by the hash key? Suppose we have a class of five students. Their names are kim, al, rocky, chrisy, and jane.

Here's a test program that prints the contents

Page 5: FAQ on Perl.docx

of the grades hash, sorted by student name:

#!/usr/bin/perl -w

%grades = (kim => 96,al => 63,rocky => 87,chrisy => 96,jane => 79,);

print "\n\tGRADES SORTED BY STUDENT NAME:\n";foreach $key (sort (keys(%grades))) {print "\t\t$key \t\t$grades{$key}\n";}

The output of this program looks like this:

GRADES SORTED BY STUDENT NAME:al 63chrisy 96jane 79kim 96rocky 87

}

How do you print out the next line from a filehandle with all its bytes reversed? print scalar reverse scalar <FH>Surprisingly enough, you have to put both the reverse and the <FH> into scalar context separately for this to work.

How do I send e-mail from a Perl/CGI program on a Unix system? Sending e-mail from a Perl/CGI program on a Unix computer system is usually pretty simple. Most Perl programs directly invoke the Unix sendmail program. We'll go through a quick example here.Assuming that you've already have e-mail information you need, such as the send-to address and subject, you can use these next steps to generate and send the e-mail message:# the rest of your program is up here ...open(MAIL, "|/usr/lib/sendmail -t");print MAIL "To: $sendToAddress\n";print MAIL "From: $myEmailAddress\n";print MAIL "Subject: $subject\n";print MAIL "This is the message body.\n";print MAIL "Put your message here in the body.\n";close (MAIL);

How to read from a pipeline with PerlExample 1:

Page 6: FAQ on Perl.docx

To run the date command from a Perl program, and read the outputof the command, all you need are a few lines of code like this:

open(DATE, "date|"); $theDate = <DATE>; close(DATE);

The open() function runs the external date command, then opens a file handle DATE to the output of the date command.

Next, the output of the date command is read into the variable $theDate through the file handle DATE.

Example 2:

The following code runs the "ps -f" command, and reads the output:

open(PS_F, "ps -f|"); while (<PS_F>) { ($uid,$pid,$ppid,$restOfLine) = split; # do whatever I want with the variables here ... } close(PS_F);

Why is it hard to call this function: sub y { "because" } Because y is a kind of quoting operator.The y/// operator is the sed-savvy synonym for tr///. That means y(3) would be like tr(), which would be looking for a second string, as in tr/a-z/A-Z/, tr(a-z)(A-Z), or tr[a-z][A-Z].

What does `$result = f() .. g()' really return? False so long as f() returns false, after which it returns true until g() returns true, and then starts the cycle again.This is scalar not list context, so we have the bistable flip-flop range operator famous in parsing of mail messages, as in `$in_body = /^$/ .. eof()'. Except for the first time f() returns true, g() is entirely ignored, and f() will be ignored while g() later when g() is evaluated. Double dot is the inclusive range operator, f() and g() will both be evaluated on the same record. If you don't want that to happen, the exclusive range operator, triple dots, can be used instead. For extra credit, describe this:$bingo = ( a() .. b() ) ... ( c() .. d() );

Why does Perl not have overloaded functions? Because you can inspect the argument count, return context, and object types all by yourself.In Perl, the number of arguments is trivially available to a function via the scalar sense of @_, the return context via wantarray(), and the types of the arguments via ref() if they're references and simple pattern matching like /^\d+$/ otherwise. In languages like C++ where you can't do this, you simply must resort to overloading of functions.

What does read() return at end of file? 0A defined (but false) 0 value is the proper indication of the end of file for read() and sysread().

Page 7: FAQ on Perl.docx

What does `new $cur->{LINK}' do? (Assume the current package has no new() function of its own.) $cur->new()->{LINK}The indirect object syntax only has a single token lookahead. That means if new() is a method, it only grabs the very next token, not the entire following expression.This is why `new $obj[23] arg' does't work, as well as why `print $fh[23] "stuff\n"' does't work. Mixing notations between the OO and IO notations is perilous. If you always use arrow syntax for method calls, and nothing else, you'll not be surprised.

How do I sort a hash by the hash value? Here's a program that prints the contents of the grades hash, sorted numerically by the hash value:

#!/usr/bin/perl -w

# Help sort a hash by the hash 'value', not the 'key'. to highest).sub hashValueAscendingNum {$grades{$a} <=> $grades{$b};}

# Help sort a hash by the hash 'value', not the 'key'. # Values are returned in descending numeric order # (highest to lowest).sub hashValueDescendingNum {$grades{$b} <=> $grades{$a};}

%grades = (student1 => 90,student2 => 75,student3 => 96,student4 => 55,student5 => 76,);

print "\n\tGRADES IN ASCENDING NUMERIC ORDER:\n";foreach $key (sort hashValueAscendingNum (keys(%grades))) {print "\t\t$grades{$key} \t\t $key\n";}

print "\n\tGRADES IN DESCENDING NUMERIC ORDER:\n";foreach $key (sort hashValueDescendingNum (keys(%grades))) {print "\t\t$grades{$key} \t\t $key\n";}

Page 8: FAQ on Perl.docx

How to read file into hash array ?open(IN, "<name_file")or die "Couldn't open file for processing: $!";while (<IN>) {chomp;$hash_table{$_} = 0;}close IN;

print "$_ = $hash_table{$_}\n" foreach keys %hash_table;

How do you find the length of an array? $@array

What value is returned by a lone `return;' statement? The undefined value in scalar context, and the empty list value () in list context.This way functions that wish to return failure can just use a simple return without worrying about the context in which they were called.

What's the difference between /^Foo/s and /^Foo/? The second would match Foo other than at the start of the record if $* were set.The deprecated $* flag does double duty, filling the roles of both /s and /m. By using /s, you suppress any settings of that spooky variable, and force your carets and dollars to match only at the ends of the string and not at ends of line as well -- just as they would if $* weren't set at all.

Does Perl have reference type? Yes. Perl can make a scalar or hash type reference by using backslash operator.For example$str = "here we go"; # a scalar variable $strref = \$str; # a reference to a scalar

@array = (1..10); # an array $arrayref = \@array; # a reference to an array Note that the reference itself is a scalar.

How to dereference a reference? There are a number of ways to dereference a reference.Using two dollar signs to dereference a scalar.$original = $$strref;Using @ sign to dereference an array.@list = @$arrayref;Similar for hashes.

What does length(%HASH) produce if you have thirty-seven random keys in a newly created hash? 5length() is a built-in prototyped as sub length($), and a scalar prototype silently changes aggregates into radically different forms. The scalar sense of a hash is false (0) if it's empty, otherwise it's a string representing the fullness of the buckets, like "18/32" or "39/64". The length of that string is likely to be 5. Likewise, `length(@a)' would be 2 if there were 37 elements in @a.

Page 9: FAQ on Perl.docx

If EXPR is an arbitrary expression, what is the difference between $Foo::{EXPR} and *{"Foo::".EXPR}? The second is disallowed under `use strict "refs"'.Dereferencing a string with *{"STR"} is disallowed under the refs stricture, although *{STR} would not be. This is similar in spirit to the way ${"STR"} is always the symbol table variable, while ${STR} may be the lexical variable. If it's not a bareword, you're playing with the symbol table in a particular dynamic fashion.

How do I do < fill-in-the-blank > for each element in an array? #!/usr/bin/perl -w@homeRunHitters = ('McGwire', 'Sosa', 'Maris', 'Ruth');foreach (@homeRunHitters) {print "$_ hit a lot of home runs in one year\n";}

How do I replace every <TAB> character in a file with a comma?

perl -pi.bak -e 's/\t/,/g' myfile.txt

What is the easiest way to download the contents of a URL with Perl?

Once you have the libwww-perl library, LWP.pm installed, the code is this:#!/usr/bin/perluse LWP::Simple;$url = get 'http://www.websitename.com/';

How to concatenate strings with Perl?

Method #1 - using Perl's dot operator:$name = 'checkbook';$filename = "/tmp/" . $name . ".tmp";

Method #2 - using Perl's join function $name = "checkbook"; $filename = join "", "/tmp/", $name, ".tmp";

Method #3 - usual way of concatenating strings$filename = "/tmp/${name}.tmp";

How do I read command-line arguments with Perl?

With Perl, command-line arguments are stored in the array named @ARGV.$ARGV[0] contains the first argument, $ARGV[1] contains the second argument, etc.$#ARGV is the subscript of the last element of the @ARGV array, so the number of arguments on the command line is $#ARGV + 1.Here's a simple program:#!/usr/bin/perl$numArgs = $#ARGV + 1;print "thanks, you gave me $numArgs command-line arguments.\n";foreach $argnum (0 .. $#ARGV) {print "$ARGV[$argnum]\n";}

Page 10: FAQ on Perl.docx

When would `local $_' in a function ruin your day?When your caller was in the middle for a while(m//g) loop The /g state on a global variable is not protected by running local on it. That'll teach you to stop using locals. Too bad $_ can't be the target of a my() -- yet.

What happens to objects lost in "unreachable" memory, such as the object returned by Ob->new() in `{ my $ap; $ap = [ Ob->new(), \$ap ]; }' ? Their destructors are called when that interpreter thread shuts down.When the interpreter exits, it first does an exhaustive search looking for anything that it allocated. This allows Perl to be used in embedded and multithreaded applications safely, and furthermore guarantees correctness of object code.

Assume that $ref refers to a scalar, an array, a hash or to some nested data structure. Explain the following statements: $$ref; # returns a scalar $$ref[0]; # returns the first element of that array$ref- > [0]; # returns the first element of that array@$ref; # returns the contents of that array, or number of elements, in scalar context$&$ref; # returns the last index in that array$ref- > [0][5]; # returns the sixth element in the first row@{$ref- > {key}} # returns the contents of the array that is the value of the key "key"  

How do you match one letter in the current locale? /[^\W_\d]/We don't have full POSIX regexps, so you can't get at the isalpha() <ctype.h> macro save indirectly. You ask for one byte which is neither a non-alphanumunder, nor an under, nor a numeric. That leaves just the alphas, which is what you want.

How do I print the entire contents of an array with Perl? To answer this question, we first need a sample array. Let's assume that you have an array that contains the name of baseball teams, like this:@teams = ('cubs', 'reds', 'yankees', 'dodgers');If you just want to print the array with the array members separated by blank spaces, you can just print the array like this:@teams = ('cubs', 'reds', 'yankees', 'dodgers');print "@teams\n";But that's not usually the case. More often, you want each element printed on a separate line. To achieve this, you can use this code:@teams = ('cubs', 'reds', 'yankees', 'dodgers');foreach (@teams) {print "$_\n";}

Perl uses single or double quotes to surround a zero or more characters. Are the single(' ') or double quotes (" ") identical? They are not identical. There are several differences between using single quotes and double quotes for strings.1. The double-quoted string will perform variable interpolation on its contents. That is, any variable references inside the quotes will be replaced by the actual values.2. The single-quoted string will print just like it is. It doesn't care the dollar signs. 3. The double-quoted string can contain the escape characters like newline, tab,

Page 11: FAQ on Perl.docx

carraige return, etc.4. The single-quoted string can contain the escape sequences, like single quote, backward slash, etc.

How many ways can we express string in Perl? Many. For example 'this is a string' can be expressed in: "this is a string" qq/this is a string like double-quoted string/qq^this is a string like double-quoted string^q/this is a string/q&this is a string&q(this is a string)

How do you give functions private variables that retain their values between calls? Create a scope surrounding that sub that contains lexicals.Only lexical variables are truly private, and they will persist even when their block exits if something still cares about them. Thus:{ my $i = 0; sub next_i { $i++ } sub last_i { --$i } }creates two functions that share a private variable. The $i variable will not be deallocated when its block goes away because next_i and last_i need to be able to access it.

1.Explain Perl. When do you use Perl for programming? What are the advantages of programming in Perl?2. What factors do you take into consideration to decide if Perl is a suitable programming language for a situation?3. How would you ensure the re-use and maximum readability of your Perl code?4. What is the importance of Perl warnings? How do you turn them on?5. Differentiate between Use and Require, My and Local, For and Foreach and Exec and System6. Situation : You are required to replace a char in a string and store the number of replacements. How would you do that?7. Situation: You want to concatenate strings with Perl. How would you do that?8. Situation - There are some duplicate entries in an array and you want to remove them. How would you do that?9. What is the use of command "use strict"?10. Explain the arguments for Perl Interpreter.11. What would happen if you prefixed some variables with following symbols?12. What is the use of a.) -w b.) Strict c.) -T.?13. Explain: a.) Subroutine b.) Perl one-liner c.) Lists d.) iValue14. Situation: You want to concatenate strings with Perl. How would you do that?15. Situation: You want to download the contents of a URL with Perl. How would you do that?16. Situation: You want to connect to SQL Server through Perl. How would you do that?17. Situation - You want to open and read data files with Perl. How would you do that?18. Explain the different types of data Perl can handle.19. Explain different types of Perl Operators.20. Situation: You want to add two arrays together. How would you do that?21. Situation: You want to empty an array. How would you do that?22. Situation: You want to read command-line arguements with Perl. How would you do that?23. Situation: You want to print the contents of an entire array. How would you do that?24. Explain: Grooving and shortening of arrays and Splicing of arrays25. Explain: a.) Goto label b.) Goto name c.) Goto expr26. There are two types of eval statements i.e. eval EXPR and eval BLOCK. Explain them.27. Explain returning values from subroutines.28. What are prefix dereferencer? List them.

Page 12: FAQ on Perl.docx

29. Explain "grep" function.30. Differentiate between C++ and Perl.31. Explain: Chomp, Chop, CPAN, TK

Explain Perl. When do you use Perl for programming? What are the advantages of programming in Perl?

About PERL:

PERL is Practical Extraction and Reporting language, which is a high level programming language written by Larry Wall. The more recent expansion is Pathologically Eclectic Rubbish Lister .

PERL is a free open source language.

It is simple to learn as its syntax is similar to C

It supports OOP – Object oriented programming like C++

Unlike C/ C++ it is a lot more flexible in usage

When do we use PERL for Programming:

Generally PERL is used to develop web based applications even though libraries are available to program web server applications, database interfaces and networking components. Example: The popular e-commerce site www.amazon.com was developed with PERL.

Advantages of programming in Perl

As mentioned above, PERL -is easier to understand due to its simple syntax-is easier to use due to its flexibility-supports OOP -is easily readable

What factors do you take into consideration to decide if Perl is a suitable programming language for a situation?

If the project requires OOP programming but requires faster execution

If the application to be developed is web based, Perl provides a lot of flexibility in programming such applications and is most popularly used.

Cost – As PERL is free, we can save on the cost of acquiring license for the programming language.

If the deadline is near, we can use CPAN, the Comprehensive Perl Archive Network, which is one of the largest repositories of free code in the world. If you need a particular type of functionality, chances are there are several options on the CPAN, and there are no fees or ongoing costs for using it.

How would you ensure the re-use and maximum readability of your Perl code?

modularize code and include them where required using the “use” command

use subroutines or functions to segregate operations thereby making the code more readable

use objects to create programs wherever possible which greatly promotes code reuse

Page 13: FAQ on Perl.docx

include appropriate comments as and when required

eliminate any dereferencing operator

What is the importance of Perl warnings? How do you turn them on?

Warnings are one of the most basic ways in which you can get Perl to check the quality of the code that you have produced. Mandatory warnings highlight problems in the lexical analysis stage. Optional warnings highlight cases of possible anomaly.

The traditional way of enabling warnings was to use the -w argument on thecommand line:perl -w myscript.plYou can also supply the option within the "shebang" line:#/usr/local/bin/perl -w

You can also mention use warnings with all, deprecated and unsafe options.Eg: use warnings 'all';

Differentiate between Use and Require, My and Local, For and Foreach and Exec and System

Use and Require

Both the Use and Require statements are used while importing modules.

A require statement imports functions only within their packages. The use statement imports functions with a global scope so that their functions and objects can be accessed directly.

Eg. Require module;Var = module::method(); //method called with the module reference

Eg: use module;Var = method(); //method can be called directly

-Use statements are interpreted and are executed during the parsing whereas the require statements are executed during run time thereby supporting dynamic selection of modules.

My and Local

A variable declared with the My statement is scoped within the current block. The variable and its value goes out of scope outside the block whereas a local statement is used to temporarily assign a value to the global variable inside the block. The variable used with local statement still has global accessibility but the value lasts only as long as the control is inside the block.

For and Foreach

The for statement has an initialization, condition check and increment expressions in its body and is used for general iterations performing operations involving a loop. The foreach statement is particularly used to iterate through arrays and runs for the length of the array.

Exec and System

Exec command is used to execute a system command directly which does not return to the calling script unless if the command specified does not exist and System command is used to run a subcommand as part of a Perl script.

Page 14: FAQ on Perl.docx

i.e The exec command stops the execution of the current process and starts the execution of the new process and does not return back to the stopped process. But the system command, holds the execution of the current process, forks a new process and continues with the execution of the command specified and returns back to the process on hold to continue execution.

Situation : You are required to replace a char in a string and store the number of replacements. How would you do that?

#!usr/bin/perluse strict;use warnings;my $mainstring="APerlAReplAFunction";my $count = ($mainstring =~ tr/A//);print "There are $count As in the given string\n";print $mainstring;

Situation: You want to concatenate strings with Perl. How would you do that?

By using the dot operator which concatenates strings in Perl.Eg. $string = “My name is”.$name

Situation - There are some duplicate entries in an array and you want to remove them. How would you do that?

If duplicates need to be removed, the best way is to use a hash.Eg:

sub uniqueentr {return keys %{{ map { $_ => 1 } @_ }};}@array1 = ("tea","coffee","tea","cola”,"coffee");print join(" ", @array1), "\n";print join(" ", uniqueentr(@array1)), "\n";

What is the use of command "use strict"?

Use strict command calls the strict pragma and is used to force checks on definition and usage of variables, references and other barewords used in the script. If unsafe or ambiguous statements are used, this command stops the execution of the script instead of just providing warnings.

Explain the arguments for Perl Interpreter.

-a - automatically splits a group of input files-c - checks the syntax of the script without executing it-d - invokes the PERL debugger after the script is compiled-d:module - script is compiled and control is transferred to the module specified.-d - The command line is interpreted as single line script-S - uses the $PATH env variable to locate the script-T - switches on Taint mode-v - prints the version and path level of the interpreter-w - prints warnings

What would happen if you prefixed some variables with following symbols?

Page 15: FAQ on Perl.docx

i.) $ - The variable becomes a scalar variable which can hold one value onlyii.) @ - The variable becomes an array variable which can hold a list of scalar variablesiii.) % - The variable becomes a hash variable which stores values as key-value pairs

What is the use of following?

i.) –wWhen used gives out warnings about the possible interpretation errors in the script.

ii.) StrictStrict is a pragma which is used to force checks on the definition and usage of variables, references and other barewords used in the script. This can be invoked using the use strict command. If there are any unsafe or ambiguous commands in the script, this pragma stops the execution of the script instead of just giving warnings.

iii.) -T.When used, switches on taint checking which forces Perl to check the origin of variables where outside variables cannot be used in system calls and subshell executions.

Explain: a.) Subroutine b.) Perl one-liner c.) Lists d.) iValue

a.) Subroutine

Subroutines are named blocks of code that accept arguments, perform required operation and return values. In PERL, the terms subroutine and function are used interchangeably. Syntax for defining subroutine: sub NAME or sub NAME PROTOTYPE ATTRIBUTES to be specific where prototype and attributes are optional. PROTOTYPE is the prototype of the arguments that the subroutine takes in and ATTRIBUTES are the attributes that the subroutine exhibits.

b.) Perl one-liner

One-liners are one command line only programs (may contain more than one perl statements) that are used to accomplish an operation. They are called so because the program can be typed and executed from the command line immediately.Eg:# run program, but with warnings perl -w my_file# run program under debugger perl -d my_file

c.) Lists

Lists are special type of arrays that hold a series of values. Lists can either be explicitly generated by the user using a paranthesis and comma to separate the values or can be a value returned by a function when evaluated in list context.

d.) iValue

An ivalue is a scalar value that can be used to store the result of any expression. Ivalues appear in the left hand side of the expression and usually represents a data space in memory.

Situation: You want to concatenate strings with Perl. How would you do that?

By using the dot operator which concatenates strings in Perl.Eg. $string = “My name is”.$name

Page 16: FAQ on Perl.docx

Situation: You want to download the contents of a URL with Perl. How would you do that?

- Use use the libwww-perl library, LWP.pm- #!/usr/bin/perluse LWP::Simple;$url = get 'http://www.DevDaily.com/';

Situation: You want to connect to SQL Server through Perl. How would you do that?

Perl supports access to all of the major database systems through a number of extensionsprovided through the DBI toolkit, a third-party module available from CPAN. Under Windows you can use either the DBI interfaces or the Win32::ODBC toolkit, which provides direct access to any ODBC-compliant database including SQL Server database products.Using DBI: use DBI;my $dbh = DBI->connect(DSN);Using ODBC:Use Win32::ODBC;$database = new Win32::ODBC("DSN" [, CONNECT_OPTION, ...]);

Situation - You want to open and read data files with Perl. How would you do that?

open FILEHANDLE - used to open data files and filehandle points to the file that is openedread FILEHANDLE, SCALAR, LENGTH - used to read from filehandle of length LENGTH and the result is placed in SCALAR.close FILEHANDLE - closes file after reading is complete.

Explain the different types of data Perl can handle.

- Scalars : store single values and are preceded by $ sign- Arrays: store a list of scalar values and are preceded by @ sign- Hashes: store associative arrays which use a key value as index instead of numerical indexes. Use % as prefix.

Explain different types of Perl Operators.

-Arithmetic operators, +, - ,* etc-Assignment operators: += , -+, *= etc -Increment/ decrement operators: ++, ---String concatenation: ‘.’ operator -comparison operators: ==, !=, >, < , >= etc-Logical operators: &&, ||, !

Situation: You want to add two arrays together. How would you do that?

@sumarray = (@arr1,@arr2);We can also use the push function to accomplish the same.

Situation: You want to empty an array. How would you do that?

-by setting its length to any –ve number, generally -1-by assigning null list

Situation: You want to read command-line arguements with Perl. How would you do that?

Page 17: FAQ on Perl.docx

In Perl, command line arguments are stored in an array @ARGV. Hence $ARGV[0] gives the first argument $ARGV[1] gives the second argument and so on. $#ARGV is the subscript of the last element of the @ARGV array, so the number of arguments on the command line is $#ARGV + 1.

Situation: You want to print the contents of an entire array. How would you do that?

Step 1: Get the size of the array using the scalar context on the array. Eg. @array = (1,2,3);print ; "Size: ",scalar @array,"\n";Step 2: Iterate through the array using a for loop and print each item.

Explain: Grooving and shortening of arrays and Splicing of arrays

a.)Grooving and shortening of arrays.Grooving and shortening of arrays can be done by directly giving a non existent index to which Perl automatically adjusts the array size as needed.

b.)Splicing of arraysSplicing copies and removes or replaces elements from the array using the position specified in the splice function instead of just extracting into another array.Syntax: splice ARRAY, OFFSET, LENGTH, LIST

Explain: a.) Goto label b.) Goto name c.) Goto expr

a.) Goto label

In the case of goto LABEL, execution stops at the current point and resumes at the point of the label specified. It cannot be used to jump to a point inside a subroutine or loop.

b.) Goto name

The goto &NAME statement is more complex. It allows you to replace the currently executing subroutine with a call to the specified subroutine instead.This allows you to automatically call a different subroutine based on the current environment and is used to dynamically select alternative routines.

c.) Goto expr

Goto expr is just an extended form of goto LABEL. Perl expects the expression to evaluate dynamically at execution time to a label by name

There are two types of eval statements i.e. eval EXPR and eval BLOCK. Explain them.

When Eval is called with EXPR, the contents of the expression will be parsed and interpreted every time the Eval function is called.

With Eval BLOCK, the contents are parsed and compiled along with the rest ofthe script, but the actual execution only takes place when the eval statement is reached. Because the code is parsed at the time of compilation of the rest of the script, the BLOCK form cannot be used to check for syntax errors in a piece of dynamically generated code.

Explain returning values from subroutines.

Page 18: FAQ on Perl.docx

Values can be returned by a subroutine using an explicit return statement. Otherwise it would be the value of the last expression evaluated.

What are prefix dereferencer? List them.

When we dereference a variable using particular prefix, they are called prefix dereference.

(i) $-Scalar variables(ii) %-Hash variables(iii) @-arrays(iv) &-subroutines(v) Type globs-*myvar stands for @myvar, %myvar.

Explain "grep" function.

The grep function evaluates an expr or a block for each element of the List. For each statement that returns true, it adds that element to the list of returning values.

Differentiate between C++ and Perl.

-C++ does not allow closures while Perl does-C++ allows pointer arithmetic but Perl does not allow pointer arithmetic

Explain: Chomp, Chop, CPAN, TK

Chomp

A Chomp function removes the last character from an expr or each element of list if it matches the value of $/. This is considered to be safer than Chop as this removes only if there is a match.

ChopA Chop function removes the last character from EXPR, each element of list.

CPAN

CPAN is the Comprehensive Perl Archive Network, a large collection of Perl software and documentation. CPAN.pm is also a module in Perl which is used to download and install Perl software from the CPAN archive.

TK

TK is an open source tool kit that is used to build web based applications using Perl.

1. Difference between the variables in which chomp function work ?

Scalar: It is denoted by $ symbol. Variable can be a number or a string.

Array: Denoted by @ symbol prefix. Arrays are indexed by numbers.

The namespace for these types of variables is different. For Example: @add, $add. The scalar variables are in one table of names or namespace and it can hold single specific information at a

Page 19: FAQ on Perl.docx

time and array variables are in another table of names or namespace. Scalar variables can be either a number or a string

2. How can we create Perl programs in UNIX, Windows NT, Macintosh and OS/2 ?

“Emacs” or “vi” can be used in UNIX and in Windows NT we can use “notepad”. In Macintosh we can use MacPerl’s text editor or any other text editor and in OS/2, e or epm can be used

3. Create a function that is only available inside the scope where it is defined ?

?

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

$pvt = Calculation(5,5);

print("Result = $pvt\n");

sub Calculation{

my ($fstVar, $secndVar) = @_;

my $square = sub{

return($_[0] ** 2);

};

return(&$square($fstVar) + &$square($scndVar));

};

Output: Result = 50

Page 20: FAQ on Perl.docx

4. How can i display all array element in which each element will display on next line in Perl ?

?

1

2

3

4

5

6

7

8

9

@array_declared=('ab','cd','ef','gh');

foreach (@array_declared)

{

print "$_n";

}

5. Which feature of Perl provides code reusability ? Give any example of that feature.

Inheritance feature of Perl provides code reusability. In inheritance, the child class can use the methods and property of parent class

?

1

2

3

4

5

6

7

8

9

Package Parent;

Sub foo

{

print("Inside A::foo\n");

}

Page 21: FAQ on Perl.docx

10

11

12

13

14

15

16

17

18

19

package Child;

@ISA = (Parent);

package main;

Child->foo();

Child->bar();

6. In Perl we can show the warnings using some options in order to reduce or avoid the errors. What are that options?

-The -w Command-line option: It will display the list if warning messages regarding the code.

- strict pragma: It forces the user to declare all variables before they can be used using the my() function.

- Using the built-in debugger: It allows the user to scroll through the entire program line by line.

7. Write the program to process a list of numbers.

The following program would ask the user to enter numbers when executed and the average of the numbers is shown as the output:

?

1

2

3

4

5

$sum = 0;

$count = 0;

print "Enter number: ";

Page 22: FAQ on Perl.docx

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

$num = <>;

chomp($num);

while ($num >= 0)

{

$count++;

$sum += $num;

print "Enter another number: ";

$num = <>;

chomp($num);

}

print "$count numbers were entered\n";

if ($count > 0)

{

print "The average is ",$sum/$count,"\n";

Page 23: FAQ on Perl.docx

31

32

33

34

35

36

37

}

exit(0);

8. Does Perl have objects? If yes, then does it force you to use objects? If no, then why?

Yes, Perl has objects and it doesn’t force you to use objects. Many object oriented modules can be used without understanding objects. But if the program is too large then it is efficient for the programmer to make it object oriented.

9. Can we load binary extension dynamically?

Yes, we can load binary extension dynamically but your system supports that. If it doesn’t support, then you can statically compile the extension.

10. Write a program to concatenate the $firststring and $secondstring and result of these strings should be separated by a single space.

Syntax:

$result = $firststring . ” “.$secondstring;

Program:

?

1

2

3

#!/usr/bin/perl

$firststring = "abcd";

Page 24: FAQ on Perl.docx

4

5

6

7

8

9

$secondstring = "efgh";

$combine = "$firststring $secondstring";

print "$Combine\n";

Output:

abcd efgh

11.  How do I replace every TAB character in a file with a comma? 

?

1

2

3

</div>

<div>perl -pi.bak -e 's/\t/,/g' myfile.txt</div>

<div>

12. In Perl, there are some arguments that are used frequently. What are that arguments and what do they mean?

-w (argument shows warning)

-d (use for debug)

-c (which compile only not run)

-e (which executes)

We can also use combination of these like:

-wd

13. How many types of primary data structures in Perl and what do they mean?

The scalar: It can hold one specific piece of information at a time (string, integer, or reference). It starts with dollar $ sign followed by the Perl identifier and Perl identifier can contain

Page 25: FAQ on Perl.docx

alphanumeric and underscores. It is not allowed to start with a digit. Arrays are simply a list of scalar variables.

Arrays: Arrays begin with @ sign. Example of array:

?

1my @arrayvar = (“string a”, “string b “string c”);

Associative arrays: It also frequently called hashes, are the third major data type in Perl after scalars and arrays. Hashes are named as such because they work very similarly to a common data structure that programmers use in other languages–hash tables. However, hashes in Perl are actually a direct language supported data type.

14. Which functions in Perl allows you to include a module file or a module and what is the difference between them?

“use”

1. The method is used only for the modules (only to include .pm type file)

2. The included objects are verified at the time of compilation.

3. We don’t need to specify the file extension.

4. loads the module at compile time.

“require”

1. The method is used for both libraries and modules.

2. The included objects are verified at the run time.

3. We need to specify the file Extension.

4. Loads at run-time.

suppose we have a module file as “Module.pm”

use Module;

or

require “Module.pm”;

(will do the same)

Page 26: FAQ on Perl.docx

15. How can you define “my” variables scope in Perl and how it is different from “local” variable scope?

?

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

$test = 2.3456;

{

my $test = 3;

print "In block, $test = $test ";

print "In block, $:: test = $:: test ";

}

print "Outside the block, $test = $test ";

print "Outside the block, $:: test = $::test ";

Output:

In block, $test = 3

In block, $::test = 2.3456

Outside the block, $test = 2.3456

Outside the block, $::test = 2.3456

The scope of “my” variable visibility is in the block only but if we declare one variable local then we can access that from the outside of the block also. ‘my’ creates a new variable, ‘local’ temporarily amends the value of a variable.

Page 27: FAQ on Perl.docx

16. Which guidelines by Perl modules must be followed?

In Perl, the following guidelines must follow by the modules:

The file name of a module must the same as the package name.

The name of the package should always begin with a capital letter.

The entire file name should have the extension “.pm”.

In case no object oriented technique is used the package should be derived from the Exporter class.

Also if no object oriented techniques are used the module should export its functions and variables to the main namespace using the @EXPORT and @EXPOR_OK arrays (the use directive is used to load the modules).

17. How the interpreter is used in Perl?

Every Perl program must be passed through the Perl interpreter in order to execute. The first line in many Perl programs is something like:

?

1#!/usr/bin/perl

The interpreter compiles the program internally into a parse tree. Any words, spaces, or marks after a pound symbol will be ignored by the program interpreter. After converting into parse tree, interpreter executes it immediately. Perl is commonly known as an interpreted language, is not strictly true. Since the interpreter actually does convert the program into byte code before executing it, it is sometimes called an interpreter/compiler. Although the compiled form is not stored as a file.

18. “The methods defined in the parent class will always override the methods defined in the base class”. What does this statement means?

The above statement is a concept of Polymorphism in Perl. To clarify the statement, let’s take an example:

?

1

2

3

package X;

sub foo

Page 28: FAQ on Perl.docx

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

{

print("Inside X::foo\n");

}

package Z;

@ISA = (X);

sub foo

{

print("Inside Z::foo\n");

}

package main;

Z->foo();

This program displays:

Inside Z::foo

Page 29: FAQ on Perl.docx

- In the above example, the foo() method defined in class Z class overrides the inheritance from class X. Polymorphism is mainly used to add or extend the functionality of an existing class without reprogramming the whole class.

19. For a situation in programming, how can you determine that Perl is a suitable?

If you need faster execution the Perl will provide you that requirement. There a lot of flexibility in programming if you want to develop a web based application. We do not need to buy the license for Perl because it is free. We can use CPAN (Comprehensive Perl Archive Network), which is one of the largest repositories of free code in the world.

20. Write syntax to add two arrays together in perl?

?

1

2

3

@arrayvar = (@array1,@array2);

To accomplish the same, we can also use the push function.

21.  How many types of operators are used in the Perl?

Arithmetic operators

+, – ,*

Assignment operators:

+= , -+, *=

Increment/ decrement operators:

++, –

String concatenation:

‘.’ operator

comparison operators:

==, !=, >, < , >=

Logical operators:

Page 30: FAQ on Perl.docx

&&, ||, !

22.  If you want to empty an array then how would you do that?

We can empty an array by setting its length to any –ve number, generally -1 and by assigning null list

?

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

use strict;

use warnings;

my @checkarray;

if (@checkarray)

{

print "Array is not empty";

}

else

{

print "Array is empty";

}

Page 31: FAQ on Perl.docx

21

23.  Where the command line arguments are stored and if you want to read command-line arguments with Perl, how would you do that?

The command line arguments in Perl are stored in an array @ARGV.

$ARGV[0] (the first argument)

$ARGV[1] (the second argument) and so on.

$#ARGV is the subscript of the last element of the @ARGV array, so the number of arguments on the command line is $#ARGV + 1

24.  Suppose an array contains @arraycontent=(‘ab’, ‘cd’, ‘ef’, ‘gh’). How to print all the contents of the given array?

?

1

2

3

4

5

6

7

8

9

@arraycontent=(‘ab’, ‘cd’, ‘ef’, ‘gh’)

foreach (@arraycontent)

{

print "$_\n";

}

25.  What is the use of -w, -t and strict in Perl?

When we use –w, it gives warnings about the possible interpretation errors in the script.

Strict tells Perl to force checks on the definition and usage of variables. This can be invoked using the use strict command. If there are any unsafe or ambiguous commands in the script, this pragma stops the execution of the script instead of just giving warnings.

Page 32: FAQ on Perl.docx

When used –t, it switches on taint checking. It forces Perl to check the origin of variables where outside variables cannot be used in sub shell executions and system calls

26.  Write a program to download the contents from www.perlinterview.com/answers.php website in Perl.

?

1

2

3

4

5

6

7

8

9

10

11

12

13

#!/usr/bin/perl

use strict;

use warnings;

use LWP::Simple;

my $siteurl = 'www.perlinterview.com/answers.php';

my $savefile = 'content.kml';

getstore($siteurl, $savefile);

27.  Which has the highest precedence, List or Terms? Explain?

Terms have the highest precedence in Perl. Terms include variables, quotes, expressions in parenthesis etc. List operators have the same level of precedence as terms. Specifically, these operators have very strong left word precedence.

28.  List the data types that Perl can handle?

Scalars ($): It stores a single value.

Arrays (@): It stores a list of scalar values.

Hashes (%): It stores associative arrays which use a key value as index instead of numerical indexes

Page 33: FAQ on Perl.docx

29.  Write syntax to use grep function?

?

1

2

3

grep BLOCK LIST

grep (EXPR, LIST)

30.  What is the use of -n and -p options?

The -n and -p options are used to wrap scripts inside loops. The -n option makes the Perl execute the script inside the loop. The -p option also used the same loop as -n loop but in addition to it, it uses continue. If both the -n and -p options are used together the -p option is given the preference.

31.  What is the usage of -i and 0s options?

The -i option is used to modify the files in-place. This implies that Perl will rename the input file automatically and the output file is opened using the original name. If the -i option is used alone then no backup of the file would be created. Instead -i.bak causes the option to create a backup of the file.

32.  Write a program that explains the symbolic table clearly.

In Perl, the symbol table is a hash that contains the list of all the names defined in a namespace and it contains all the functions and variables. For example:

?

1

2

3

4

5

6

7

8

sub Symbols

{

my($hashRef) = shift;

my(%sym);

my(@sym);

Page 34: FAQ on Perl.docx

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

%sym = %{$hashRef};

@sym = sort(keys(%sym));

foreach (@sym)

{

printf("%-10.10s| %s\n", $_, $sym{$_});

}

}

Symbols(\%Foo::);

package Foo;

$bar = 2;

sub baz {

$bar++;

}

Page 35: FAQ on Perl.docx

34

35

33.  How can you use Perl warnings and what is the importance to use them?

The Perl warnings are those in which Perl checks the quality of the code that you have produced. Mandatory warnings highlight problems in the lexical analysis stage. Optional warnings highlight cases of possible anomaly.

?

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

use warnings; # it is same as importing "all"

no warnings; # it is same as unimporting "all"

use warnings::register;

if (warnings::enabled()) {

warnings::warn("any warning");

}

if (warnings::enabled("void")) {

warnings::warn("void", "any warning");

}

34.  Which statement has an initialization, condition check and increment expressions in its body? Write a syntax to use that statement.

Page 36: FAQ on Perl.docx

?

1

2

3

4

5

6

7

for ($count = 10; $count >= 1; $count--)

{

print "$count ";

}

35.  How can you replace the characters from a string and save the number of replacements?

?

1

2

3

4

5

6

7

8

9

10

11

12

13

#!usr/bin/perl

use strict;

use warnings;

my $string="APerlAReplAFunction";

my $counter = ($string =~ tr/A//);

print "There are $counter As in the given string\n";

print $string;

36.  Remove the duplicate data from @array=(“perl”,”php”,”perl”,”asp”)

Page 37: FAQ on Perl.docx

?

1

2

3

4

5

6

7

8

9

10

11

12

13

sub uniqueentr

{

return keys %{{ map { $_ => 1 } @_ }};

}

@array = ("perl","php","perl","asp”);

print join(" ", @array), "\n";

print join(" ", uniqueentr(@array)), "\n";

37.  How can information be put into hashes?

When a hash value is referenced, it is not created. It is only created once a value is assigned to it. The contents of a hash have no literal representation. In case the hash is to be filled at once the unwinding of the hash must be done. The unwinding of hash means the key value pairs in hash can be created using a list, they can be converted from that as well. In this conversion process the even numbered items are placed on the right and are known as values. The items placed on the left are odd numbered and are stored as keys. The hash has no defined internal ordering and hence the user should not rely on any particular ordering.

Example of creating hash:

?

1

2

3

%birthdate = ( Ram => "01-01-1985",

Vinod => "22-12-1983",

Page 38: FAQ on Perl.docx

4

5

6

7

Sahil => "13-03-1989",

Sony => "11-09-1991");

38.  Why Perl aliases are considered to be faster than references?

In Perl, aliases are considered to be faster than references because they do not require any dereferencing.

39.  How can memory be managed in Perl?

Whenever a variable is used in Perl, it occupies some memory space. Since the computer has limited memory the user must be careful of the memory being used by the program. For Example:

?

1

2

3

4

5

6

7

8

9

10

11

12

13

14

use strict;

open(IN,"in");

my @lines = <IN>

close(IN);

open(OUT,">out");

foreach (@lines)

{

print OUT m/([^\s]+)/,"\n";

Page 39: FAQ on Perl.docx

15

16

17

18

19

}

close(OUT);

On execution of above program, after reading a file it will print the first word of each line into another file. If the files are too large then the system would run out of memory. To avoid this, the file can be divided into sections.

40.  How can you create anonymous subroutines?

?

1

2

3

4

5

6

7

sub BLOCK

sub PROTO BLOCK

sub ATTRS BLOCK

sub PROTO ATTRS BLOCK

41.  What do you mean by context of a subroutine?

It is defined as the type of return value that is expected. You can use a single function that returns different values.

42.  List the prefix dereferencer in Perl.

$-Scalar variables

%-Hash variables

@-arrays

&-subroutines

Page 40: FAQ on Perl.docx

Type globs-*myvar stands for @myvar, %myvar.

43.  In CPAN module, name an instance you use.

In CPAN, the CGI and DBI are very common packages

44.  What are the advantages of c over Perl?

There are more development tools for C than for PERL. PERL execute slower than C programs. Perl appears to be an interpreted language but the code is complied on the fly. If you don’t want others to use your Perl code you need to hide your code somehow unlike in C. Without additional tools it is impossible to create an executable of a Perl program

45.  “Perl regular expressions match the longest string possible”. What is the name of this match?

It is called as “greedy match” because Perl regular expressions normally match the longest string possible.

46.  How can you call a subroutine and identify a subroutine?

‘&myvariable’ is used to call a sub-routine and ‘&’ is used to identify a sub-routine.

47.  What is use of ‘->’ symbol?

In Perl, ‘->’ symbol is an infix dereference operator. if the right hand side is an array subscript, hash key or a subroutine, then the left hand side must be a reference.

?

1

2

3

4

5

6

7

@array = qw/ abcde/; # array

print "n",$array->[0]; # it is wrong

print "n",$array[0]; #it is correct , @array is an array

48.  Where do we require ‘chomp’ and what does it mean?

Page 41: FAQ on Perl.docx

We can eliminate the new line character by using ‘chomp’. It can used in many different scenarios.For example:

?

1

2

3

4

5

excuteScript.pl FstArgu.

$argu = $ARGV[0];

chomp $argu; --> to get rid of the carrige return.

49.  What does the’$_’ symbol mean?

The ‘$_’ is a default variable in Perl and $_ is known as the “default input and pattern matching space

50.  What interface used in PERL to connect to database? How do you connect to database in Perl?

We can connect to database using DBI module in Perl.

?

1

2

3

use DBI;

  my $dbh = DBI->connect(’dbi:Oracle:orcl’, ‘username’, ‘password’,)

1: What is a shell?

Shell is a interface between user and the kernel. Even though there can be  only one kernel ; a system can have many shell running simultaneously . Whenever  a user enters a command  through keyboard the shell communicates with the kernel  to execute it and then display the output to the user.

2: What are the different types of commonly used shells  on a typical linux system?

csh,ksh,bash,Bourne . The most commonly used and advanced shell used today is “Bash” .

Page 42: FAQ on Perl.docx

3:What is the equivalent of a file shortcut that we have on window on a Linux system?

Shortcuts are created using “links” on Linux. There are two types of links that can be used namely “soft link” and “hard link”

4:What is the difference between soft and hard links?

Shell Scripting

Soft links are link to the file name and can reside on different filesytem as well; however hard links are link to the inode of the file and has to be on the same filesytem as that of the file. Deleting the orginal file makes the soft link inactive (broken link) but does not affect the hard link (Hard link will still access a copy of the file)

5: How will you pass and access arguments to a script in Linux?

Arguments can be passed as:scriptName “Arg1” “Arg2”….”Argn” and can be accessed inside the script as $1 , $2 .. $n

6: What is the significance of $#?

$# shows the count of the arguments passed to the script.

7: What is the difference between $* and $@?

$@ treats each quoted arguments as separate arguments but $* will consider the entire set of positional parameters as a single string.

8: Use sed command to replace the content of the file (emulate tac command)Eg:

?

Page 43: FAQ on Perl.docx

1

2

3

4

5

6

7

8

9

10

if cat file1

       ABCD

        EFGH

Then O/p should be

      EFGH

      ABCD

  sed '1! G; h;$!d' file1

Here G command appends to the pattern space,

h command copies pattern buffer to hold buffer

and d command deletes the current pattern  space.

9: Given a file,  replace all occurrence of word “ABC” with “DEF” from 5th line till end in only those lines that contains word “MNO”

sed –n ‘5,$p’ file1|sed ‘/MNO/s/ABC/DEF/’

10: Given a file , write a command sequence to find the count of each word.

tr –s  “(backslash)040” <file1|tr –s  “(backslash)011”|tr “(backslash)040 (backslash)011” “(backslash)012” |uniq –c

where “(backslash)040” is octal equivalent of “space”

”(backslash)011” is octal equivalent of “tab character” and

“(backslash)012” is octal equivalent of newline character.

11: How will you find the 99th line of a file using only tail and head command?

tail +99 file1|head -1

12: Print the 10th line without using tail and head command.

Page 44: FAQ on Perl.docx

?

1sed –n ‘10p’ file1

13:In my bash shell I want my prompt to be of format  ‘$”Present working directory”:”hostname”>  and load a file containing a list of user defined functions as soon as I login , how will you automate this?

In bash shell we can create “.profile”  file which automatically gets invoked as soon as I login and write the following syntax into it.

?

1export PS1=’$ `pwd`:`hostname`>’ .File1

Here File1 is the file containing the user defined functions and “.” invokes this file in current shell.

14: Explain about “s” permission bit in a file?

“s” bit is called “set user id” (SUID) bit.

“s” bit on a file causes the process to have the privileges of the owner of the file during the instance of the program.

Eg: Executing “passwd” command to change current password causes the user to writes its new password to shadow file even though it has “root” as its owner.

15: I want to create a directory such that anyone in the group can create a file and access any person’s file in it but none should be able to delete a file other than the one created by himself.

We can create the directory giving read and execute access to everyone in the group and setting its sticky bit “t” on as follows:

?

1

2

3

mkdir direc1

 chmod g+wx direc1

 chmod +t direc1

16: How can you find out how long the system has been running?

Page 45: FAQ on Perl.docx

Command “uptime”

17: How can any user find out all information about a specific user like his default shell, real life name, default directory,when and how long he has been using the sytem?

finger  “loginName”                  …where loginName is the  login name of  theuser whose  information is expected.

18: What is the difference between $$ and $!?

$$ gives the process id of the currently executing process whereas $! shows the process id of the process that recently went into background.

19: What are zombie processes?

These are the processes which have died but whose exit status is still not picked by the parent process. These processes even if not functional still have its process id entry in the process table.

20: How will you copy file from one machine to other?

We can use utilities like “ftp” ,”scp” or “rsync” to copy file from one machine to other.

Eg: Using ftp:

ftp hostname>put file1>bye

Above copies file file1 from local system to destination system whose hostname is specified.

21: I want to monitor a continuously updating log file, what command can be used to most efficiently achieve this?

We can use tail –f filename     . This will cause only the default last 10 lines to be displayed on std o/p which continuously shows  the updating part of the file.

22: I want to connect to a remote server and execute some commands, how can I achieve this?

We can use telnet to do this:

telnet hostname –l user>Enter password>Write the command to execute>quit

Page 46: FAQ on Perl.docx

23: I have 2 files and I want to print the records which are common to both.

We can use “comm” command as follows:

comm -12 file1 file2               … 12 will suppress the content which areunique to 1st and 2nd  file respectively.

24: Write a script to print the first 10 elemenst of Fibonacci series.

?

1

2

3

4

5

6

7

8

9

10

11

12

#!/bin/sh

                 a=1

                 b=1

                 echo $a

                 echo $b

                for I in 1 2 3 4 5 6 7 8

                do

                c=a

                b=$a

                b=$(($a+$c))

                echo $b

                done

25: How will you connect to a database server from linux?

We can use isql utility that comes with open client driver  as follows:isql –S serverName –U username –P password

26: What are the 3 standard streams in Linux?

Output stream , represented as 0 , Input stream, represented as 1 and Error stream represented as 2.

27: I want to read all input to the command from file1 direct all output to file2 and error to file 3, how can I achieve this?

Page 47: FAQ on Perl.docx

command <file1 0>file2 2>file3

28: What will happen to my current process when I execute a command using exec?

“exec” overlays the newly forked process on the current  process ; so when I execute the command using exec  a new process corresponding to the command will be created and the current process will die.Eg: Executing “exec  com1”  on command prompt will execute com1 and return to login prompt since my logged in shell is superimposed with the new process of the command .

29: How will you emulate wc –l using awk?

awk ‘END {print NR} fileName’

30: Given a file find the count of lines containing word “ABC”.

grep –c  “ABC” file1

31: What is the difference between grep and egrep?

egrep is Extended grep that supports added grep features like “+” (1 or more occurrence of previous character),”?”(0 or 1 occurrence of previous character) and “|” (alternate matching)

32: How will you print the login names of all users on a system?

/etc/shadow file has all the users listed.

awk –F ‘:’ ‘{print $1} /etc/shadow’|uniq -u

33: How to set an array in Linux?

Syntax in ksh:Set –A arrayname= (element1 element2 ….. element)In bashA=(element1 element2 element3 …. elementn)

34: Write down the syntax of “for “ loop

Syntax:

for  iterator in (elements)doexecute commandsdone

35:How will you find the total disk space used by a specific user?

Page 48: FAQ on Perl.docx

du  -s /home/user1             ….where user1 is the user for whom the total diskspace needs to be found.

36: Write the syntax for “if” conditionals in linux?

Syntax

If  condition is successfulthenexecute commandselseexecute commandsfi

37:What is the significance of $? ?

$? gives the exit status of the last command that was executed.

38: How do we delete all blank lines in a file?

?

1sed ‘^ [(backslash)011(backslash)040]*$/d’ file1

where (backslash)011 is octal equivalent of space and

(backslash)040 is octal equivalent of tab

39: How will I insert a line “ABCDEF” at every 100th line of a file?

sed ‘100i\ABCDEF’ file1

40: Write a command sequence to find all the files modified in less than 2 days and print the record count of each.

find . –mtime -2 –exec wc –l {} \;

41: How can I set the default rwx permission to all users on  every file which is created in the current shell?

We can use:

?

1umask 777

Page 49: FAQ on Perl.docx

This will set default rwx permission for every file which is created to every user.

42: How can we find the process name from its process id?

We can use “ps –p ProcessId”

43: What are the four fundamental components of every file system on linux?

bootblock, super block, inode block and  datablock

44: What is a boot block?

This block contains a small program called “Master Boot record”(MBR) which loads the kernel  during system boot up.

45: What is a super block?

Super block contains all the information about the file system like size of file system, block size used by it,number of free data blocks and list of free inodes and data blocks.

46: What is an inode block?

This block contains the inode for every file of the file system along with all the file attributes except its name.

47: How can I send a mail with a compressed file as an attachment?

  zip file1.zip file1|mailx –s “subject” Recepients email id Email content EOF

48: How do we create command aliases in shell?

alias Aliasname=”Command whose alias is to be created”

49: What are “c” and “b” permission fields of a file?

“c “ and “b” permission fields are generally associated with a device file. It specifies whether a file is a character special file or a block special file.

50: What is the use of a shebang line?

Shebang line at top of each script determines the location of the engine which is to be used in order to execute the script.

Page 50: FAQ on Perl.docx

1) What is a flowchart and why it is important?

Flowchart shows complete flow of system through symbols and diagrams. It is important, because it makes the system easy to understand for developers and all concerned people.

2) Define Use Case Model?

Use case model shows sequence of events and stream of actions regarding any process performed by an actor.

3) What does UML stand for?

It stands for Unified Modeling Language.

4) Do you think Activity Diagram is important and how?

As the name implies, activity diagram is all about system activities. Main purpose of activity diagram is to show various activities taking place in an organization in different departments.

5) Can you name the two types of diagrams heavily used in your field?

The two diagrams are Use Case Diagram and  Collaboration Diagram

6) Do you know what is meant by an alternate flow in a use case?

It is the alternative solution or activity in a use case that should be followed in case of any failure in the system.

7) What are exceptions?

These are the unexpected situations or results in an application.

8) What are extends?

Extends are actions that must take place in a use case.

9) Name the two documents related to a use case?

The two documents are FRD (Functional Requirement Document) and SDD (System Design Document).

10) What is the difference between Business Analyst and Business Analysis?

Business Analysis is the process performed by the Business Analyst.

Page 51: FAQ on Perl.docx

11) As a business analyst, what tools, you think are more helpful?

There are many but I mostly use, Rational Tools, MS Visio, MS Word, MS Excel, Power Point, MS Project.

12) In your previous experience, what kind of documents you have created?

I have worked on, Functional Specification Documents, Technical Specification Documents, Business Requirements Documents, Use Case Diagram etc.

13) What INVEST stands for?

INVEST means Independent, Negotiable, Valuable, Estimable, Sized Appropriately, Testable. It can assist project managers and technical team to deliver quality products/services.

14) Define SaaS?

SaaS means Software as a Service. It is related to cloud computing. It is different from other software as you don’t need this type of software to be installed on your machine. All you need is an Internet connection and a Web Browser to use it.

15) What steps are required to develop a product from an idea?

You have to perform, Market Analysis, Competitor Analysis, SWOT Analysis, Personas, Strategic Vision and Feature Set, Prioritize Features, Use Cases, SDLC, Storyboards, Test Cases, Monitoring, Scalability.

16) What do you think is better, the Waterfall Model or Spiral Model?

It all depends on the type and scope of the project. Also a life cycle model is selected on the basis of organizational culture and various other scenarios to develop the system.

17) How can you explain the user centered design methodology?

Page 52: FAQ on Perl.docx

It all depends on the end users. In such scenario, we develop the system with a user’s point of view. Who are the end users, what they require etc. Personas are basically social roles, performed by any actor or character. It is derived from a Latin word meaning character. In marketing terminology, it represents group of customers/end users.

18) How do you define Personas?

Personas are used instead of real users that assist developers and technical team to judge the user behavior in different scenarios, more clearly. Personas are basically social roles, performed by any actor or character. It is derived from a Latin word meaning character. In marketing terminology, it represents group of customers/end users.

19) Define Application Usability?

Application usability is actually the quality of the system that makes the system useful for its end users. System’s usability is good if it is capable of achieving users’ goals. Personas are basically social roles, performed by any actor or character. It is derived from a Latin word meaning character. In marketing terminology, it represents group of customers/end users.

20) Explain in your words, what is database transaction?

When we perform any activity in a database, such as addition, deletion, modification, searching etc. is said to be a database transaction.

21) Define OLTP Systems?

OLPT stands for On-Line Transaction Processing; such systems are capable to perform database transactions and are meant to provide good speed for database transactions. These systems are mainly used for data entry and retrieving data from the database.

22) Do you have any idea about Pugh Matrix?

Pugh Matrix is used to decide about the most optimal and alternate solutions. This technique is now a standard part of Six Sigma technique. It is also known as problem or design matrix.

23) What FMEA stands for?

It means Failure Mode and Effects Analysis. It is a failure analysis, that is used mainly in product development, system engineering and operations management. This analysis is performed to figure out various failure modes and their severity in any system.

24) What is a 100-point method?

This method is used to assign priority to different steps in a process. Each group member is supposed to assign points to different steps. In the end all the points for each step are calculated. The step having the highest points has the highest priority.

Page 53: FAQ on Perl.docx

25) Do you know what 8-omega is?

It is a business framework that is mainly being adopted by firms and organizations for the betterment of their business. Its key factors are  Strategy, People, Process, Technology.

26) Can you define mis-use case?

It is a term derived from use-case. Unlike use case, a mis-use case is something that shows -what kind of malicious activities can be performed by an actor that may result in system failure.

27) What is SQUARE stands for?

SQUARE stands for Security Quality Requirements Engineering. It is one of the software engineering steps that mainly focus on documenting the security requirements of the system.

28) What is Pareto Analysis?

It is a decision making technique, also known as 80/20 rule.  It is used for quality control and defect resolution. It explains few factors that can be responsible for big problems. It is named as 80/20 rule, because as per this rule, 80 % effects in the system, arises from 20 % causes.

29) Do you have any idea about Agile Manifesto?

Agile Manifesto is a guide for software developers about the development principles to ensure iterative solutions.

30) What BPMN stands for?

It is Business Process Model and Notation. It is a graphical representation of business processes.

31) Define BPMN Gateway?

BPMN Gateway is a processing modeling component that is used to control flow of interaction, sequence of processes.

32) Name the five basic elements’ categories in BPMN?

They are Flow Objects, Data, Connecting Objects, Swimlanes and Artifacts.

33) Have you ever used Kano Analysis in your previous jobs and how do you define it?

Yes, I have used Kano Analysis in one of my previous jobs. Kano Analysis is used to analyze a system in terms of its requirements to identify its impact on customers’ satisfaction.

34) How many key areas are there in a Kano Analysis?

Page 54: FAQ on Perl.docx

They are three in number, namely as Unexpected Delighters, Performance Attributes and Must Have Attributes.

35) Define Pair-Choice Technique?

The pair-Choice Technique is used to give priority to various items in a process. It is mainly used when distinctive stakeholders are involved in the project. This technique asks from the group to compare each item with the other and select the one having highest priority.

36) Do you have suggestions to make an effective use-case model?

Yes, I would suggest making two separate diagrams. One serves as a use-case and the other serves as an actor diagram. So that we can highlight all the possible activities in a use case & in actor diagram and then we can merge both the diagrams to get an effective use-case diagram.

37) How many types of actor can be there in a Use-Case?

There are primary and secondary actors. Primary actors start the process and secondary actors assist them. Moreover, actors can be of four types such as Human, System, Hardware and Timer.

38) Define BCG Matrix?

The Boston Consulting Group (BCG) matrix is developed to analyze several of business processes and new product offerings from companies. It is a useful tool that can be used in portfolio analysis, strategic management, product management, and brand marketing.

39) How can you differentiate between pool and swimlane?

A swimlane is related to group activities on an activity diagram while a pool is dedicated activity to a single person.

40) Differentiate between Fish Model and V Model?

Fish model is comparatively very costly and time consuming, while, V model requires less time and cost. Moreover, Fish model is used when there were no ambiguities in the customers’ requirements. Otherwise, other model is preferred.

41) How do you manage frequently changing customers’ requirements while developing any system?

As a business analyst, I would develop a document stating clearly that no change will be accepted after a certain period of time and get it signed by the user.

42) Define Use Case points?

Use Case points are used to evaluate the cost of work done to develop the system.

Page 55: FAQ on Perl.docx

43) What does PEST stand for?

It means Political, Economic, Social, and Technological. It is used to analyze business environment, in which it has to be operated.

44) Name the four key phases of business development?

They are Forming, Storming, Norming, and Performing.

45) Define Benchmarking?

Benchmarking is about measuring performance of an organization to compete in the industry. In this process a company may measure its policies, performance, rules and other measures.

46) What do we mean by SWEBOK?

It means Software Engineering Body of Knowledge.

47) What do you know about GAP Analysis?

It is a process of comparing and determining the difference between two things or processes.

48) Define Agile?

Agile is basically a technique that uses several light-weight methodologies such as Rapid Application Development (RAD), Extreme Programming (XP) and SCRUM. All these methodologies focus on the development of iterative solutions.

49) Define Scrum Method?

It is one of the agile methods, used to develop iterative information systems. In this method a small team works on the assigned tasks for a time period of 30 days usually.

50) What does JAD stand for?

It means Joint Application Development.

1.How will you define a project?A project is a set of task/activities undertaken to create a product, services or results. These are temporary, in the sense that they are not routine work like production activity but most often one time set of activities undertaken.

2. Provide some examples.A project for a product will result in a complete product or part of a product. An example would be the creation of the Microsoft Surprise tablet that used a liquid magnesium deposition process to create the enclosure. The process developed in the project will be used for subsequent production of the tablet. Examples could include development of a new

Page 56: FAQ on Perl.docx

product or process (as in the example), constructing a road or a bridge (infrastructure in general), developing a computer/information system, etc.

3. What is your view of Project Management?Project management involves applying the knowledge & skills of the project team members including the project manager, application of tools and techniques available to ensure the defined tasks are completed properly. Proper completion means implies achievement of end results within given cost and time constraints. It usually means balancing of the constraints of scope, budget, schedule, quality, risks and resources.

4. Are there distinct kinds of activities in a project?Most often any project goes through some easily identifiable set of activities during its lifetime. Some typical activities can be identified as related initiating a project. Planning set of activities are required to plan the activities to be undertaken to achieve the defined goals. Executing group of activities help getting the project done. A related set of activities are required to monitor and correct the course of actions to keep the project on the planned course charted for it. Final set of activities are related to the systematic closure of the project. Most important of which is, of course, to formally record what has been learnt during the execution of the project. When documented, this set of documents, related forms to be used, the way estimates are to be made, database of estimates of similar projects etc. are often referred to as Organizational process assets.

5. What do you think is the difference between projects, programs and a portfolio?Projects are undertaken for a specific or a set of related purposes. A program is a set of projects managed in a coordinated manner to achieve different parts of an overall goal. For example the NASA lunar landing program had the development of the command module and the lunar landing modules as separate projects. A portfolio is a collection of projects, programs and even other portfolios that help an organization achieve some common high level business purpose.

6. Who is a stakeholder?Any person, organization or an entity whose interest is affected, positively or negatively, because of the project. The influence of stakeholders is an important issue to take into account in any planning and subsequently during execution of it as well.

Page 57: FAQ on Perl.docx

7. What are organizational influences?Every organization has a certain way of doing things, collective wisdom about how things can best be done, etc. and these influences the planning and execution processes. These influences need to be taken into account when estimating, planning for activities related to projects. These are often mentioned as organizational environmental factors.

8. Can you explain project life cycle?A project has distinct phases when the range of activities required to carry out the project work differ. There is a distinct “start” phase, followed by an organizing and preparing phase. “Carrying out” is the actual execution part of the project. “Closing” phase makes sure the temporary activities related to the project are closed systematically. The points in time when the phase changes happen are named variously as phase gate, exits, milestones or kill points. If a project is to be closed, it is decided at these stages based on the performance or if the need of the project has disappeared.

9.What to you understand by a project charter?This is a document where it all begins. Project authorization is done on this document and a project would be initiated with the top level requirements listed in this document. Initial requirements as seen by stakeholders and the outcomes of the project also are listed in it.

10. What do you understand by plan baselines?Baselines are the final version of all plans before the project execution starts. Project baselines are the starting versions of all related plans of a project, be it the time schedule, the quality plan, the communication plan or whatever. This acts as the reference against which project performance is measured.

11. What qualifications are required to be an effective project manager?Besides being a good professional manager, the PM needs to have additional personal skills for being effective. It is not only essential for him to have project management skills but be proficient in them. Attitude, core personality characteristics and leadership qualities are needed. Team management and leadership skills that help the team reach common objectives and goals are required.

12. What are processes and process groups?A process is a defined way of doing things. Not only does the process define the actions to be taken but also in what sequence they are to be carried out. Process groups are a set of processes that are applicable to various stages of a project. For example, initiating process group, planning process group, etc. Each of the processes has a defined set of inputs and produce defined outputs by applying a set of tools and techniques on the input.

13. What are the knowledge areas relevant to doing a project?Scope management, time and cost management knowledge areas are quite obvious. Same goes for quality management too. To complete a project in all its aspects one needs to be aware of the project integration knowledge area. Communications is an essential issue so is the communication management knowledge. Procurement and risk management are two vital

Page 58: FAQ on Perl.docx

support areas. Since people get things done Human resources management is also an equally important area.

14. What is RAID as it related to project management?RAID stand for risks, assumptions, issues and dependencies. These are vital items that a PM should always be aware of. There are always risks about actions and a PM must take least risk actions. Unless assumptions about any estimates or actions are clear, these can go wrong. Issues and dependencies also limit the choices of actions often.

15. What are the important processes for project integration management?It starts with a project charter development. Project management plan development is another important activity. Direct and manage project execution and monitor and control are plans that are to be followed all through the project. Closing of the project (or the current phase) is the final set of activities for integration management. Since changes are often unavoidable an integrated change management plan must be developed to guide all changes systematically.

16. What is a SOW?SOW or the statement of work is a detailed description of the outcomes of the project in terms of what products, services or results are expected from the project. Most detailed SOW are usually given by the customer if he is the one requesting the project.

17. What does Scope management involve?Typically this process involves collecting requirements, defining scope, creating WBS, verifying scope and controlling the scope. The project scope statement, WBS and WBS dictionary defines the scope baseline. Controlling the scope process must minimize scope creep.

18. How should changes controlled?Through the integrated change control process. Requested changes will have to be reviewed by a change control board. Only the approved changes shall be included in the document changes guiding project execution.

19. What is Work Breakdown Structure (WBD) and how does it affect the work estimates of tasks/activities?Work breakdown structure defines the work activities required for the project and the sub activities of each of the work requirement. The breakdown goes down to levels where all the work required is clearly understood. Work need not be broken down further than that. Work breakdown dictionary includes additional details that help define the tasks. Time and effort estimates can be accurate when everything about the work and dependencies are known.

20. How do you define a milestone?Milestone is a point in project schedule when some objective, a part of a result or a part of the planned services planned are achieved.

21. What are some techniques used for defining scope?Product breakdown, requirements analysis, systems engineering, systems analysis, value

Page 59: FAQ on Perl.docx

engineering, value analysis and alternatives analysis. Alternatives analysis can be helped by brain storming, lateral thinking and pair-wise comparisons, etc.

22. How do project scheduling help achieve project execution?When the activity effort and resource estimates are known getting the work done depends on how the tasks are sequenced. Dependencies with other activities have to be clearly known. The basic sequence is determined by what activities should be carried out first and what should follow. Unconnected tasks/activities can be sequenced in parallel to reduce project time. Most optimized sequencing would give you the best possible time needed given the resources allocation is ideal and there are no constraints there. Scheduling is done from activities list prepared after WBS has been finalized.

23. How is the “activity time” estimates done?Parametric estimates, three point estimates and analogous estimates are the techniques used for estimating activity time estimates.

24. How do you estimate in the three point estimating method?One optimistic estimate, a pessimistic estimate and one “most likey” estimate is considered for an activity. (Op estimate+6 X most likely+ pess. Estimate) is calculated and divided by 6. This result then may be further iterated. This is the estimate to be used.

25. How in the project time schedule represented most often?Activity scheduling network diagram is the most common form of representation for the project time schedule. This is often accompanied by milestone chart, and bar charts.

26. What is a critical path in schedule network diagram?When activity scheduling is done there will be activities whose start time and/or end times are not critical. It may be possible, due to dependencies, to start a task later than the date on the schedule, similarly an activity could be completed later as there are no other activity waiting for its completion. These time pads are called floats. There is always a path from start to finish, which does not have any floats. Not only all the activities in the path must be carried out in planned time, but also there cannot be any delays. Any delays will directly reflect on project completion time. This chain of activities or the path from start to finish is known as the critical path.

27. What are the ways a project time schedule can be compressed?Crashing and fast tracking are two methods of accelerating a project time schedule. Crashing method tries to optimize the schedule making use of the time floats available while keeping costs under control. Fast tracking is to make selected activities faster by applying additional resources if necessary. It may mean paying team members overtime, paying for the time of a consultant, etc.

28. What is effort variance?It is the difference in estimated effort and the effort actually needed. Work performance is monitored periodically to find if there is any variance in efforts so that corrective actions could be taken.

Page 60: FAQ on Perl.docx

29. What is EVM, earned value management?At every monitoring point the planned value (PV), earned value (EV) and actual cost (AC) are monitored. PMB, performance measurement baseline is the aggregation of all planned values. Variances from baselines are determined and Schedule variance (SV) and cost variance (CV) are calculated. If earned value is equal to the planned value then the project is achieving what it is supposed to. If there is schedule or cost variance is significant, appropriate action needs to be taken to correct the slips. Estimate at completion (EAC) is estimated and compared with budget at completion. In case there is a slip, the cost consequences will be known.

30. What does A processes ensure?According to a dictionary, “A is a way of systematic monitoring and evaluation of aspects of a project, service or facility to ensure that standards of quality are met”. Thus, whatever ensures products meet customer expectations are part of A efforts. Ensuring quality of everything that goes into making a product and that no mistakes are made while making it ensures quality.

31. What is quality control?QC procedures include inspections to ensure quality requirements are being met

32. What’s the need for process improvement plans?A cornerstone of A is that processes are continuously improved. Process improvements help mistakes in processes and thus help improve quality.

33. What is the tool used for arriving at improvements in processes?GM, or the goals, questions and metrics is the method used. Goals are set, questions are asked about what improvements can be made and metrics (measurements that tell us something about the process) are carried out

34. What are the important aspects of a HR plan for the project team?Acquiring the team, forming the team, assigning roles & responsibilities, appraisal policies, rewards & recognition are the areas where clear cut policies should exist and be well known to team members.

35. Why is the performance management process in the HR management plan important?People like to be recognized for their contributions. The project management team needs to recognize talent and reward and recognize the performers. The assessment should not only be fair but seen to be fair.

36.How do you determine the communication needs of stakeholders?The communication needs of stakeholders depend on their position in the power/influence grid, power/interest grid as also impact/influence grid. Salience modeling is another technique to determine who is the most effective for the interest of the project. This is a qualitative assessment and will determine the kind and details of communications they need on the project.

37. What are the types of risks you may encounter in a project?These could be categorized as technical, external, internal/organizational, etc. Depending on the type of projects other categories may have to be considered.

Page 61: FAQ on Perl.docx

38 What is a risk register?This is a register/document that contains all the identified risks of a project. List of actions of potential actions are also included.

39. Are there any positive aspects of the risk identification process?The risk identification process may be able to come up with some opportunities too.

40. What is risk impact and probability?When assessing risks the project team also tries to determine the probability of the risk actually happening and the impact it will have on the project when it does.

41. What is the role of Isikawa/ Fishbone diagrams in determining root causes of risks?This is a graphical method of determining cause and effect relationships leading to a specific risk. One could then determine mitigation actions for that risk.

42.What do you understand of Pareto (80/20) principle/analysis?This is a statistical analysis method that helps decide priorities between several actions to be taken. The basis is that there are about 20% action which when executed gets you 80% of the results. In QA this is used to identify the 20% of causes that create 80% of the problems.

43. What are fixed type contracts in procurement processes?The seller must supply the contracted items at a fixed price determined at the time of contract.

44. What are time & material contracts?In this type of contracts the contractor gets paid for time used on the project and expenses for material used and other agreed upon expenses.

45 What is the primary purpose of procurement management plan?To determine what exactly is to be procured, ensure they are procured at the best price and is made available to the project team at the right time.

46.What does procurement administrator involve?To keep monitoring and ensure that all open procurement contracts are progressing as expected.

47. Why does a PM need to be very proactive?A PM needs to be able to see any signs of a deviation in time and/or cost to project progress as early as possible. This gives the team as much reaction time as possible to correct the situation or to minimize the impact.

48.Forming a team, developing the team and improving knowledge are direct responsibilities of the project manager, do you agree?It is the team that executes the project. Thus ensuring you has right people is essential. Developing the team is important as whatever gaps are there need to be bridged. Improving self

Page 62: FAQ on Perl.docx

and the team knowledge is equivalent to the continuous improvement of A process and should impact the quality of the project outcome.

49. Do you think professionalism and integrity are essential qualities of a PM?PM is charged with managing all aspects of the project. Unless he is a professional and has integrity there are many things that can go wrong. Not so truthful progress reporting will easily boomerang on the PM but the organization will have a delayed or a failed project.

50. Explain the team forming process?After the members are collected as a project team there is a turmoil before everything settles down. This is known as the forming-storming-norming-performing process. The team people go through a storming of relationships when before settling to the role assignment. Over time they then get used to the structure of the relationship, that is the norming phase. It is only after everybody has settled into their new roles that the team starts performing.

http://www.gcrit.com/perl-script/

http://www.slideshare.net/utkarsh2012/perl-101-the-basics-of-perl-programming

http://www.f2finterview.com/web/Perl/

http://www.gointerviews.com/top-50-web-services-interview-questions/

On Product Testing

What will be the test cases for product testing? Give an example of test plan template. What are the advantages of working as a tester for a product based company as opposed to a

service based company? Do you know how a product based testing differs from a project based testing? Can you give a

suitable example? Do you know what is exactly meant by Test Plan? Name its contents? Can you give a sample

Test Plan for a Login Screen? How do you differentiate between testing a product and testing any web-based application? What is the difference between Web based testing and Client server testing? How to perform SOAP Testing manually? Explain the significance of Waterfall model in developing a product.

On Quality Assurance

How do you ensure the quality of the product? What do you do when there isn't enough time for thorough testing? What are the normal practices of the QA specialists with perspective of a software? Can you tell the difference between high level design and low level design? Can you tell us how Quality Assurance differs from Quality Control?

Page 63: FAQ on Perl.docx

You must have heard the term Risk. Can you explain the term in a few words? What are the major components of the risk?

When do you say your project testing is completed? Name the factors. What do you mean by a walk through and inspection? What is the procedure for testing search buttons of a web application both manually and using

Qtp8.2? Explain Release Acceptance Testing. Explain Forced Error Testing. Explain Data Integrity

Testing. Explain System Integration Testing. How does compatibility testing differ while testing in Internet explorer and testing in Firefox?

On Testing Scenarios

How do you know that all the scenarios for testing are covered? Can you explain the Testing Scenario? Also explain scenario based testing? Give an example to

support your answer. Consider a yahoo application. What are the test cases you can write? Differentiate between test scenario and test case? Is it necessary to create new Software requirement document, test planning report, if it is a

'Migrating Project'? Explain the difference between smoke testing and sanity testing? What are all the scenarios to be considered while preparing test reports? What is an 'end to end' scenario? Other than requirement traceability matrix, what are the other factors that we need to check in

order to exit a testing process ? What is the procedure for finding out the length of the edit box through WinRunner?

On Automated Testing

What automated testing tools are you familiar with? Describe some problems that you encountered while working with an automated testing tool. What is the procedure for planning test automation? What is your opinion on the question that can a test automation improve test effectiveness? Can you explain data driven automation? Name the main attributes of test automation? Do you think automation can replace manual testing? How is a tool for test automation chosen? How do you evaluate the tool for test automation? What are the main benefits of test automation according to you? Where can test automation go wrong? Can you describe testing activities? What testing activities you need to automate? Describe common issues of test automation. What types of scripting techniques for test automation are you aware of? Name the principles of good testing scripts for automation? What tools can you use for support of testing during the software development life cycle? Can you tell us, if the activities of a test case design can be automated? What are the drawbacks of automated software testing? What skills are needed to be a good software test automator?

On Bug Tracking

Can you have a defect with high severity and low priority and vice-versa i.e high priority and low severity? Justify your answer.

Can you explain the difference between a Bug and a Defect? Explain the phases of bug life cycle.

What are the different types of Bugs we normally see in any of the projects? Also include their severity.

Page 64: FAQ on Perl.docx

What is the difference between Bug Resolution Meeting and Bug Review Committee? Who all participate in Bug Resolution Meeting and Bug Review Committee?

Can you name some recent major computer system failures caused by software bugs? What do you mean by 'Reproducing a bug'? What do you do, if the bug was not reproducible? How can you tell if a bug is reproducible or not? On what basis do we give priority and severity for a bug. Provide an example for high priority

and low severity and high severity and low priority? Explain Defect Life Cycle in Manual Testing? How do you give a BUG Title & BUG Description for ODD Division? Have you ever heard of a build interval period?

1. What is the MAIN benefit of designing tests early in the life cycle?

It helps prevent defects from being introduced into the code.

2. What is risk-based testing?

Risk-based testing is the term used for an approach to creating a test strategy that is based on prioritizing tests by risk. The basis of the approach is a detailed risk analysis and prioritizing of risks by risk level. Tests to address each risk are then specified, starting with the highest risk first.

 

 

3. A wholesaler sells printer cartridges. The minimum order quantity is 5. There is a 20% discount for orders of 100 or more printer cartridges. You have been asked to prepare test cases using various values for the number of printer cartridges ordered. Which of the following groups contain three test inputs that would be generated using Boundary Value Analysis? 

4, 5, 99

4. What is the KEY difference between preventative and reactive approaches to testing? 

Preventative tests are designed early; reactive tests are designed after the software has been produced.

5. What is the purpose of exit criteria? 

To define when a test level is complete.

6. What determines the level of risk? 

  The likelihood of an adverse event and the impact of the event

Page 65: FAQ on Perl.docx

7. When is used Decision table testing? 

  Decision table testing is used for testing systems for which the specification takes the form of rules or cause-effect combinations. In a decision table the inputs are listed in a column, with the outputs in the same column but below the inputs. The remainder of the table explores combinations of inputs to define the outputs produced.

Learn More About Decision Table Testing Technique in the Video Tutorial here

 

8. What is the MAIN objective when reviewing a software deliverable?

To identify defects in any software work product.

9. Which of the following defines the expected results of a test? Test case specification or test design specification.

Test case specification.

10. Which is a benefit of test independence?

It avoids author bias in defining effective tests.  

11. As part of which test process do you determine the exit criteria?

Test planning.  

12. What is beta testing?

Testing performed by potential customers at their own locations.  

13. Given the following fragment of code, how many tests are required for 100% decision coverage?

if width > length

   then biggest_dimension = width

     if height > width

             then biggest_dimension = height

     end_if

else biggest_dimension = length  

Page 66: FAQ on Perl.docx

            if height > length 

                then biggest_dimension = height

          end_if

end_if

 

4  

14. You have designed test cases to provide 100% statement and 100% decision coverage for the following fragment of code. if width > length then biggest_dimension = width else biggest_dimension = length end_if The following has been added to the bottom of the code fragment above. print "Biggest dimension is " & biggest_dimension print "Width: " & width print "Length: " & length How many more test cases are required?

None, existing test cases can be used.  

15. Rapid Application Development ?

Rapid Application Development (RAD) is formally a parallel development of functions and subsequent integration. Components/functions are developed in parallel as if they were mini projects, the developments are time-boxed, delivered, and then assembled into a working prototype. This can very quickly give the customer something to see and use and to provide feedback regarding the delivery and their requirements. Rapid change and development of the product is possible using this methodology. However the product specification will need to be developed for the product at some point, and the project will need to be placed under more formal controls prior to going into production.

16. What is the difference between Testing Techniques and Testing Tools?

Testing technique: – Is a process for ensuring that some aspects of the application system or unit functions properly there may be few techniques but many tools.

Testing Tools: – Is a vehicle for performing a test process. The tool is a resource to the tester, but itself is insufficient to conduct testing  

Learn More About Testing Tools  here

17. We use the output of the requirement analysis, the requirement specification as the input for writing …

User Acceptance Test Cases  

Page 67: FAQ on Perl.docx

18. Repeated Testing of an already tested program, after modification, to discover any defects introduced or uncovered as a result of the changes in the software being tested or in another related or unrelated software component:

Regression Testing

19. What is component testing ?

Component testing, also known as unit, module and program testing, searches for defects in, and verifies the functioning of software (e.g. modules, programs, objects, classes, etc.) that are separately testable. Component testing may be done in isolation from the rest of the system depend-ing on the context of the development life cycle and the system. Most often stubs and drivers are used to replace the missing software and simulate the interface between the software components in a simple manner. A stub is called from the software component to be tested; a driver calls a component to be tested.

Here is an aswesome video on Unit Testing

20. What is functional system testing ?

Testing the end to end functionality of the system as a whole.

21. What is the benefits of Independent Testing

Independent testers see other and different defects and are unbiased.  

22. In a REACTIVE approach to testing when would you expect the bulk of the test design work to be begun?

After the software or system has been produced.

23. What are the different Methodologies in Agile Development Model?

There are currently seven different Agile methodologies that I am aware of:

1. Extreme Programming (XP)2. Scrum3. Lean Software Development4. Feature-Driven Development5. Agile Unified Process6. Crystal7. Dynamic Systems Development Model (DSDM)

24. Which activity in the fundamental test process includes evaluation of the testability of the requirements and system?

Page 68: FAQ on Perl.docx

A Test analysis and design.

25. What is typically the MOST important reason to use risk to drive testing efforts?

  Because testing everything is not feasible.  

26. Which is the MOST important advantage of independence in testing?

An independent tester may be more effective at finding defects missed by the person who wrote the software.  

27. Which of the following are valid objectives for incident reports?

i. Provide developers and other parties with feedback about the problem to enable identification, isolation and correction as necessary.

ii. Provide ideas for test process improvement.

iii. Provide a vehicle for assessing tester competence.

iv. Provide testers with a means of tracking the quality of the system under test.

i. Provide developers and other parties with feedback about the problem to enable identification, isolation and correction as necessary,

ii.Provide ideas for test process improvement,

iv.Provide testers with a means of tracking the quality of the system under test

 

28. Consider the following techniques. Which are static and which are dynamic techniques?

i. Equivalence Partitioning.

ii. Use Case Testing.

iii.Data Flow Analysis.

iv.Exploratory Testing.

v. Decision Testing.

vi. Inspections.

Page 69: FAQ on Perl.docx

Data Flow Analysis and Inspections are static, Equivalence Partitioning, Use Case Testing, Exploratory Testing and Decision Testing are dynamic.

29. Why are static testing and dynamic testing described as complementary?

Because they share the aim of identifying defects but differ in the types of defect they find.  

30. What are the phases of a formal review ?

In contrast to informal reviews, formal reviews follow a formal process. A typical formal review process consists of six main steps:

1. Planning 2. Kick-off 3. Preparation 4. Review meeting 5. Rework 6. Follow-up.

 

31. What is the role of moderator in review process?

The moderator (or review leader) leads the review process. He or she deter-mines, in co-operation with the author, the type of review, approach and the composition of the review team. The moderator performs the entry check and the follow-up on the rework, in order to control the quality of the input and output of the review process. The moderator also schedules the meeting, disseminates documents before the meeting, coaches other team members, paces the meeting, leads possible discussions and stores the data that is collected.

Learn More About Review process in Video Tutorial here

 

32. What is an equivalence partition (also known as an equivalence class)?

An input or output range of values such that only one value in the range becomes a test case.  

33. When should configuration management procedures be implemented?

During test planning.

34. A Type of functional Testing, which investigates the functions relating to detection of threats, such as virus from malicious outsiders.

Security Testing  

Page 70: FAQ on Perl.docx

35. Testing where in we subject the target of the test , to varying workloads to measure and evaluate the performance behaviors and ability of the target and of the test to continue to function properly under these different workloads. Load Testing

36. Testing activity which is performed to expose defects in the interfaces and in the interaction between integrated components is:

Integration Level Testing  

37. What are the Structure-based (white-box) testing techniques ?

Structure-based testing techniques (which are also dynamic rather than static) use the internal structure of the software to derive test cases. They are com-monly called 'white-box' or 'glass-box' techniques (implying you can see into the system) since they require knowledge of how the software is implemented, that is, how it works. For example, a structural technique may be concerned with exercising loops in the software. Different test cases may be derived to exercise the loop once, twice, and many times. This may be done regardless of the func-tionality of the software.  

38. When should be performed Regression testing ?

After the software has changed or when the environment has changed

39. When should testing be stopped?

It depends on the risks for the system being tested

40. What is the purpose of a test completion criterion?

To determine when to stop testing  

41. What can static analysis NOT find?

For example memory leaks  

42. What is the difference between re-testing and regression testing?

Re-testing ensures the original fault has been removed; regression testing looks for unexpected sideeffects  

43. What are the Experience-based testing techniques ?

In experience-based techniques, people's knowledge, skills and background are a prime contributor to the test conditions and test cases. The experience of both technical and business people is important, as they bring different perspectives to the test analysis and design process.

Page 71: FAQ on Perl.docx

Due to previous experience with similar systems, they may have insights into what could go wrong, which is very useful for testing.  

44. What type of review requires formal entry and exit criteria, including metrics? Inspection 45. Could reviews or inspections be considered part of testing?

Yes, because both help detect faults and improve quality  

46. An input field takes the year of birth between 1900 and 2004 What are the boundary values for testing this field ? 1899,1900,2004,2005  

47. Which of the following tools would be involved in the automation of regression test? a. Data tester b. Boundary tester c. Capture/Playback d. Output comparator.

d. Output comparator  

48. To test a function,what has to write a programmer, which calls the function to be tested and passes it test data.

  Driver

49. What is the one Key reason why developers have difficulty testing their own work?

Lack of Objectivity

50.“How much testing is enough?”

The answer depends on the risk for your industry, contract and special requirements. 51. When should testing be stopped? It depends on the risks for the system being tested.  

52. Which of the following is the main purpose of the integration strategy for integration testing in the small?

To specify which modules to combine when, and how many at once.

53. What is the purpose of a test completion criterion?

  To determine when to stop testing  

54. Given the following code, which statement is true about the minimum number of test cases required for full statement and branch coverage?

        Read p

        Read q

Page 72: FAQ on Perl.docx

        IF p+q> 100

                  THEN Print "Large"

      ENDIF

      IF p > 50

                  THEN Print "p Large"

      ENDIF

 

  1 test for statement coverage, 2 for branch coverage

55. What is the difference between re-testing and regression testing?

  Re-testing ensures the original fault has been removed; regression testing looks for unexpected side-effects.  

56. Which review is normally used to evaluate a product to determine its suitability for intended use and to identify discrepancies?

Technical Review.

57. Why we use decision tables?.

The techniques of equivalence partitioning and boundary value analysis are often applied to specific situations or inputs. However, if different combinations of inputs result in different actions being taken, this can be more difficult to show using equivalence partitioning and boundary value analysis, which tend to be more focused on the user interface. The other two specification-based tech-niques, decision tables and state transition testing are more focused on business logic or business rules. A decision table is a good way to deal with combinations of things (e.g. inputs). This technique is sometimes also referred to as a 'cause-effect' table. The reason for this is that there is an associated logic diagramming technique called 'cause-effect graphing' which was sometimes used to help derive the decision table

58. Faults found should be originally documented by who?

By testers.  

59. Which is the current formal world-wide recognized documentation standard?

There isn’t one.  

Page 73: FAQ on Perl.docx

60. Which of the following is the review participant who has created the item to be reviewed?

Author

61. A number of critical bugs are fixed in software. All the bugs are in one module, related to reports. The test manager decides to do regression testing only on the reports module.

Regression testing should be done on other modules as well because fixing one module may affect other modules.

62. Why does the boundary value analysis provide good test cases?

Because errors are frequently made during programming of the different cases near the ‘edges’ of the range of values.  

63. What makes an inspection different from other review types?

It is led by a trained leader, uses formal entry and exit criteria and checklists.

64. Why can be tester dependent on configuration management?

Because configuration management assures that we know the exact version of the testware and the test object.

65. What is a V-Model ?

A software development model that illustrates how testing activities integrate with software development phases

66. What is maintenance testing?

Triggered by modifications, migration or retirement of existing software  

67. What is test coverage?

Test coverage measures in some specific way the amount of testing performed by a set of tests (derived in some other way, e.g. using specification-based techniques). Wherever we can count things and can tell whether or not each of those things has been tested by some test, then we can measure coverage.  

68. Why is incremental integration preferred over “big bang” integration?

Because incremental integration has better early defects screening and isolation ability  

Page 74: FAQ on Perl.docx

69. When do we prepare RTM (Requirement traceability matrix), is it before test case designing or after test case designing?

The would be before. Requirements should already be traceable from Review activities since you should have traceability in the Test Plan already. This question also would depend on the organisation. If the organisation do test after development started then requirements must be already traceable to their source. To make life simpler use a tool to manage requirements.

70. What is called the process starting with the terminal modules ?

Bottom-up integration  

71. During which test activity could faults be found most cost effectively?

During test planning  

72. The purpose of requirement phase is

To freeze requirements, to understand user needs, to define the scope of testing

73. How much testing is enough?

The answer depends on the risks for your industry, contract and special requirements 74. Why we split testing into distinct stages? Each test stage has a different purpose.

75. Which of the following is likely to benefit most from the use of test tools providing test capture and replay facilities? a) Regression testing b) Integration testing c) System testing d) User acceptance testing

  Regression testing  

76. How would you estimate the amount of re-testing likely to be required?

Metrics from previous similar projects and discussions with the development team

77. What studies data flow analysis ?

The use of data on paths through the code.

78. What is Alpha testing?

Pre-release testing by end user representatives at the developer’s site.

79. What is a failure?

Failure is a departure from specified behaviour.  

Page 75: FAQ on Perl.docx

80. What are Test comparators ?

Is it really a test if you put some inputs into some software, but never look to see whether the software produces the correct result? The essence of testing is to check whether the software produces the correct result, and to do that, we must compare what the software produces to what it should produce. A test comparator helps to automate aspects of that comparison.

81. Who is responsible for document all the issues, problems and open point that were identified during the review meeting Scribe  

82. What is the main purpose of Informal review

Inexpensive way to get some benefit  

83. What is the purpose of test design technique?

Identifying test conditions and Identifying test cases

84. When testing a grade calculation system, a tester determines that all scores from 90 to 100 will yield a grade of A, but scores below 90 will not. This analysis is known as:

  Equivalence partitioning  

85. A test manager wants to use the resources available for the automated testing of a web application. The best choice is Tester, test automater, web specialist, DBA  

86. During the testing of a module tester ‘X’ finds a bug and assigned it to developer. But developer rejects the same, saying that it’s not a bug. What ‘X’ should do?

Send to the detailed information of the bug encountered and check the reproducibility

87. A type of integration testing in which software elements, hardware elements, or both are combined all at once into a component or an overall system, rather than in stages.

Big-Bang Testing  

88. In practice, which Life Cycle model may have more, fewer or different levels of development and testing, depending on the project and the software product. For example, there may be component integration testing after component testing, and system integration testing after system testing.

V-Model

89. Which technique can be used to achieve input and output coverage? It can be applied to human input, input via interfaces to a system, or interface parameters in integration testing.

Page 76: FAQ on Perl.docx

Equivalence partitioning  

90. “This life cycle model is basically driven by schedule and budget risks” This statement is best suited for…

V-Model  

91. In which order should tests be run?

The most important tests first  

92. The later in the development life cycle a fault is discovered, the more expensive it is to fix. why?

The fault has been built into more documentation,code,tests, etc  

93. What is Coverage measurement?

It is a partial measure of test thoroughness.  

94. What is Boundary value testing?

Test boundary conditions on, below and above the edges of input and output equivalence classes.

95. What is Fault Masking ?

Error condition hiding another error condition.

96. What does COTS represent?

Commercial Off The Shelf.  

97.The purpose of wich is allow specific tests to be carried out on a system or network that resembles as closely as possible the environment where the item under test will be used upon release?

Test Environment

98. What can be though of as being based on the project plan, but with greater amounts of detail?

Phase Test Plan  

99. What is exploratory testing?

Page 77: FAQ on Perl.docx

  Exploratory testing is a hands-on approach in which testers are involved in minimum planning and maximum test execution. The planning involves the cre-ation of a test charter, a short declaration of the scope of a short (1 to 2 hour) time-boxed test effort, the objectives and possible approaches to be used. The test design and test execution activities are performed in parallel typi-cally without formally documenting the test conditions, test cases or test scripts. This does not mean that other, more formal testing techniques will not be used. For example, the tester may decide to use boundary value analysis but will think through and test the most important boundary values without necessarily writing them down. Some notes will be written during the exploratory-testing session, so that a report can be produced afterwards.  

100. What is failure?

Deviation from expected result to actual result

http://www.guru99.com/istqb-test-1.html

http://careerride.com/Software-Testing-Interview-Questions.aspx

http://website.informer.com/terms/Automation_Testing_Interview_Questions_Pdf