Upwork Perl Test Answers.
Question:
To execute blocks of code depending on whether a condition is met, you use:
Answers:
both are correct
Upwork Perl Test Answers.
Question:
How do I dereference a hash reference?
Answers:
%{$ref}
Upwork Perl Test Answers.
Question:
What should be the output of @nums = (1..10); splice(@nums, 5,5,21..25)?
Answers:
1 2 3 4 5 21 22 23 24 25
Upwork Perl Test Answers.
Question:
How can you install a module?
Answers:
cpan; install [module name]
Upwork Perl Test Answers.
Question:
What's is DBI and DBD?
Answers:
DBI is the common interface to database where DBD is database specific driver
Upwork Perl Test Answers.
Question:
What statement immediately ends a subroutine?
Answers:
return;
Upwork Perl Test Answers.
Question:
what is the default separator in split operator
Answers:
white space
Upwork Perl Test Answers.
Question:
What does $! show?
Answers:
Errors
Upwork Perl Test Answers.
Question:
All arguments to a subroutine are passed as:
Answers:
single, flat list of scalars
Upwork Perl Test Answers.
Question:
How many scalars will the array @num have after the following command: my @days = qw (Sunday Monday Tuesday Wednesday Thursday Friday Saturday); my @num = (1..scalar @days);
Answers:
7
Upwork Perl Test Answers.
Question:
How do I create an object?
Answers:
bless [class parameter] [class name]
Upwork Perl Test Answers.
Question:
What is @INC?
Answers:
It contains a list of directories from which Perl modules and libraries can be loaded
Upwork Perl Test Answers.
Question:
What option do I use to check the existence of a file?
Answers:
"-e"
Upwork Perl Test Answers.
Question:
lc function stands for?
Answers:
lower case
Upwork Perl Test Answers.
Question:
my $x=join(':','a','b') What will be the output of $x?
Answers:
a:b
Upwork Perl Test Answers.
Question:
What are the types of variables in PERL?
Answers:
array, hash, scalar
Upwork Perl Test Answers.
Question:
How would you output the list of keys in a hash?
Answers:
keys %hash
Upwork Perl Test Answers.
Question:
To dereference $arrayref and then find the second element of that array, you use:
Answers:
all are correct
Upwork Perl Test Answers.
Question:
Does perl require variables be declared with a type? (ie: int, float, double, etc.)
Answers:
No
Upwork Perl Test Answers.
Question:
What does the "shift" function do?
Answers:
Removes the first value of an array and returns its value
Upwork Perl Test Answers.
Question:
What will the following program do: foreach (reverse 1..10) { print; }
Answers:
Print the numbers from 10 to 1.
Upwork Perl Test Answers.
Question:
seek FILEHANDLE, POSITION, OPTION; What's meant by option value as 0 ?
Answers:
Sets the new position of the file
Upwork Perl Test Answers.
Question:
Which of the following functions is not used for array processing?
Answers:
chop
Upwork Perl Test Answers.
Question:
What function is used to check the length of a string?
Answers:
using length()
Upwork Perl Test Answers.
Question:
What is a correct way to instantiate parallel processing in PERL?
Answers:
my $pm = new Parallel::ForkManager(50);
Upwork Perl Test Answers.
Question:
What module is used to scrape contents from website?
Answers:
LWP::Simple
Upwork Perl Test Answers.
Question:
What will the following code output? for ($count = 10; $count >= 1; $count--) { print "$count "; }
Answers:
10 9 8 7 6 5 4 3 2 1
Upwork Perl Test Answers.
Question:
What does die() do?
Answers:
Set the error code based on $! or $? if the exception is uncaught
Upwork Perl Test Answers.
Question:
Which regular expression deletes all tags specified as text enclosed by "<" and ">" from a document stored in a string, but deletes nothing else?
Answers:
$string =~ s/<.*?>//g;
Upwork Perl Test Answers.
Question:
What does Perl -e on the command line do?
Answers:
Allow you to execute an expression coming immediately after.
Upwork Perl Test Answers.
Question:
How do I call subroutines in Perl?
Answers:
All of these
Upwork Perl Test Answers.
Question:
1 $a="cat"; 2 $$acatches="rat"; Which of following is equivalent to second line.?
Answers:
$catcatches=''rat";
Upwork Perl Test Answers.
Question:
Which takes care of garbage collection?
Answers:
DESTROY method
Upwork Perl Test Answers.
Question:
What is known as a reference to a function that is, usually, passed into another function for use?
Answers:
Callback
Upwork Perl Test Answers.
Question:
Which of the following is not used to control scoping?
Answers:
call
Upwork Perl Test Answers.
Question:
Which of the following is not used for assigning a value to a variable?
Answers:
==
Upwork Perl Test Answers.
Question:
What does unshift do?
Answers:
Adds an element to the beginning of an array
Upwork Perl Test Answers.
Question:
What does cdup () do in FTP?
Answers:
Change the directory to the parent of the current directory
Upwork Perl Test Answers.
Question:
The bitwise AND operator is:
Answers:
&
Upwork Perl Test Answers.
Question:
Which one of the following regexes matches between 1 to 4 ab's followed by a tab and an integer number?
Answers:
(ab){1,4}\t\d+
Upwork Perl Test Answers.
Question:
What is the shebang?
Answers:
#!
Upwork Perl Test Answers.
Question:
Which of the following is a correct use of IMAP?
Answers:
use Net::IMAP::Simple; $server = new Net::IMAP::Simple( 'someserver' ); $server->login( 'someuser', 'somepassword' );
Upwork Perl Test Answers.
Question:
Perl stores numbers internally as:
Answers:
all are correct • signed integers • none are correct • double-precision floating-point values
Upwork Perl Test Answers.
Question:
Does Perl provide the defined function that allows you to check up if a variable has the undef value or not?
Answers:
Yes
Upwork Perl Test Answers.
Question:
Which will check the script's syntax?
Answers:
perl -c
Upwork Perl Test Answers.
Question:
What does Perl -T do?
Answers:
use for taint checks
Upwork Perl Test Answers.
Question:
What is %INC?
Answers:
It is used to cache the names of the files and the modules that were successfully loaded and compiled by use(), require() or do() statements
Upwork Perl Test Answers.
Question:
What are the ways one can run an Unix command?
Answers:
All of these
Upwork Perl Test Answers.
Question:
What's the system() success value?
Answers:
0
Upwork Perl Test Answers.
Question:
What does the pop function do?
Answers:
Returns the last value of the array
Upwork Perl Test Answers.
Question:
$@ is associated with the ____ function.
Answers:
eval()
Upwork Perl Test Answers.
Question:
How do I numericaly sort an array in decending order?
Answers:
sort ($b <=> $a)
Upwork Perl Test Answers.
Question:
@values = ( "value1", "value2", ("value3", "value4") ); How does Perl store the nested list shown above?
Answers:
The list is flattened by removing all internal bracketing
Upwork Perl Test Answers.
Question:
The for loop has few semicolon-separated expressions within its parentheses. These expressions function as:
Answers:
all are correct
Upwork Perl Test Answers.
Question:
The prototype symbol for a scalar is:
Answers:
$
Upwork Perl Test Answers.
Question:
Can I call the method of a class without creating an object?
Answers:
Yes, using :: operator
Upwork Perl Test Answers.
Question:
What can be used in PERL for communicating with an FTP server?
Answers:
Net::FTPNet::FTP
Upwork Perl Test Answers.
Question:
Perl -I, what is 'l" meant for?
Answers:
Inplace edit
Upwork Perl Test Answers.
Question:
What must be done to pass more than one array or hash into or out of a function and have them maintain their integrity?
Answers:
you pass references to them as arguments
Upwork Perl Test Answers.
Question:
What is the MOST correct answer?
Answers:
NEW! tests, articles, cover letters and job interviews
Collapse | Expand
122 Answered Test Questions:
1. What is @INC?
Answers:
• It contains all the sources of external information
• it contains all the list of variables defined within the script
• It contains unix's environment variables
• It contains a list of directories from which Perl modules and libraries can be loaded
2. What function is used to check the length of a string?
Answers:
• using len()
• using count()
• using strlen()
• using length()
3. Why would I include strict in PERL code?
Answers:
• To display warnings to the browser
• When strict is in use and the package name is not used to fully qualify the variable, this error will be reported
• To hide errors and warnings
• To hide errors
4. What does the pop function do?
Answers:
• Add the last value of the array,
• Returns the last value of the array
• Returns the first value of the array
• Add the first value of the array,
5. What's is DBI and DBD?
Answers:
• DBI is the interface to Oracle Database and DBD is the Oracle Driver
• DBD is the common interface to database where DBI is database specific driver
• DBI is the common interface to database where DBD is database specific driver
• Both are common pipeline to hetergenous database
6. How do I call subroutines in Perl?
Answers:
• $some_object->sub();
• sub();
• &sub();
• All of these
7. Can a pattern search be done in a split function in PERL?
Answers:
• No
• Yes
8. How would you output the list of keys in a hash?
Answers:
• count %hash
• scalar %hash
• key %hash
• keys %hash
9. How do you check the existence of a key in a hash?
Answers:
• isused $hash {'key'}
• isexists $hash {'key'}
• isnull $hash {'key'}
• exists $hash {'key'}
10. The for loop has few semicolon-separated expressions within its parentheses. These expressions function as:
Answers:
• the initialization (e.g., $i = 1;)
• the re-initialization (e.g., $i++)
• the condition (e.g., $i < 10;)
• all are correct
11. Which of the following gets you an array of all numbers matched in a string?
Answers:
• my @numbers = $string =~ /\W+/e;
• my @numbers = $string =~ /\d+/g;
• my @numbers = $string =~ /\S+/g;
• my @numbers = $string =~ /\S+/e;
12. Which will check the script's syntax?
Answers:
• perl -check
• perl -C
• perl -Check
• perl -c
13. What is $_ ?
Answers:
• The default input and pattern-searching space.
• it displays warnings
• it display errors
• shows current processid
14. Which conditional statement is equivalent to "if (!)"?
Answers:
• failure ()
• ifn ()
• fails ()
• unless ()
15. my @b=(1,2,3);my $a=scalar(@b);What will be the output of $a?
Answers:
• 3
• 12
• 45
• 1
16. Does perl require variables be declared with a type? (ie: int, float, double, etc.)
Answers:
• Yes
• No
17. What can be used in PERL for communicating with an FTP server?
Answers:
• Net::SMTP
• WWW::FTP
• FTP
• Net::FTP
18. You may force yourself to declare your variables by:
Answers:
• using &variables;
• using &$variables;
• including the 'use strict' pragma in your program
• including the 'use autouse' module in your program
19. To remove any line-ending characters of each string in a @list, you use the function:
Answers:
• remove
• deleol
• trunc
• chomp
20. $m=ucfirst("test"); What will be the output of $m?
Answers:
• TEST
• tesT
• Test
• test
21. Unless it is the final statement in a block, every simple statement must end in:
Answers:
• end of line
• ;
• nothing
• .
22. lc function stands for?
Answers:
• less than
• leastcount
• lower case
• last call();
23. Will perl be installed in Windows by default?
Answers:
• Yes
• No
24. my $x=join(':','a','b') What will be the output of $x?
Answers:
• a:b
• b:a
• ab
• ba
25. How can perl be called which gives the same functionality of "use warnings"?
Answers:
• perl -Warn
• perl -warn
• perl -W
• perl -w
26. What will the following code output? for ($count = 10; $count >= 1; $count--) { print "$count "; }
Answers:
• 9 9 8 7 6 5 4 3 2 1
• 9 8 7 6 5 4 3 2 1
• 10 9 8 7 6 5 4 3 2 1
• 10 9 8 7 6 5 4 3 2
27. The prototype symbol for a scalar is:
Answers:
• *
• &
• %
• $
28. What will $count= scalar keys %hashname; return?
Answers:
• error
• number of elements in hash
• executes but blank output
• values of only keys in hash
29. What does the "shift" function do?
Answers:
• Removes the first value of an array and returns its value
• Passes parameters to the subrotuines
• Shifts operators bitwise
• Swaps array indexes
30. What are the ways one can run an Unix command?
Answers:
• within backquote
• All of these
• system ()
31. What does cdup () do in FTP?
Answers:
• Change the directory to the parent of the current directory.
• Change directory to the child of the current directory.
• shows uptime
• change to any directory in any level
32. Does Perl provide the defined function that allows you to check up if a variable has the undef value or not?
Answers:
• No
• Yes
33. Perl programs have this filehandle that is automatically opened:
Answers:
• STDDAT
• STDERR
• STDREF
• STDLOG
34. What is the shebang?
Answers:
• @!
• #!
• &!
• $!
• %!
35. What is a hash identified as?
Answers:
• &
• $
• @
• %
36. How can you install a module?
Answers:
• copy the file
• install [module name]
• cpan; install [module name]
• cd cpan; install [module name]
37. Which of the following functions is not used for array processing?
Answers:
• shift
• splice
• chop
• push
38. Perl has a 'goto' command.
Answers:
• False, the command is 'go'
• False, the command is 'branch'
• True
39. What will the following program do: foreach (reverse 1..10) { print; }
Answers:
• Syntax error.
• Print nothing.
• Print the numbers from 10 to 1.
• Infinite loop.
• Print the numbers from 1 to 10.
40. How do I close a file?
Answers:
• file_close fh
• close fh
• close $_
• fclose fh
41. What's the preferable mode of executing one CGI script?
Answers:
• 755
• 776
• 766
• 744
42. How many scalars will the array @num have after the following command: my @days = qw (Sunday Monday Tuesday Wednesday Thursday Friday Saturday); my @num = (1..scalar @days);
Answers:
• 7
• 0
• 2
• 1
43. how would you execute a shell command from within a perl script
Answers:
• use the escape function , ie escape("ls")
• use the execute function , ie, execute("ls")
• enclose within #{}, ie, #{ls}
• enclose within back ticks , ie `ls`
44. What are the types of variables in PERL?
Answers:
• hash, scalar, var, scalar
• array, hash, scalar
• hash, array, var
• array,var
45. How would you remove an element from hash?
Answers:
• $hash{'key'}=''
• empty $hash{'key'}
• remove $hash{'key'}
• delete $hash{'key'}
46. $_ is used by default:
Answers:
• all are correct
• as the default iterator variable in a foreach loop
• by unary functions like ord and int
• by list functions like print and unlink
47. my @b=(1,2,3);my $a=@b;What will be the output of $a?
Answers:
• 2
• 3
• 1
• 0
48. Using which of the below would declare a global variable?
Answers:
• ~g
• my
• /g
• our
49. What does Perl -e on the command line do?
Answers:
• Give you the version number
• Allow you to execute an expression coming immediately after.
• Die on warnings on the program coming after it
• Interpret perl from standard in
50. what is the default separator in split operator
Answers:
• semi colon
• colon
• white space
• comma
51. To disable a database error, what parameter is set in the database initialization?
Answers:
• raise_error=-1
• raise_error=0
• raise_error=255
• raise_error=1
52. How do I numericaly sort an array in decending order?
Answers:
• sort ($b cmp $a)
• sort ($a <=> $b)
• sort ($b <=> $a)
53. Which of the following functions is not used for hash processing?
Answers:
• all are used for hash processing
• each
• delete
• exists
54. Which of the following is not used for assigning a value to a variable?
Answers:
• ==
• .=
• *=
• &&=
55. Which one of the following regexes matches between 1 to 4 ab's followed by a tab and an integer number?
Answers:
• ab[ababab]\t[0-9]
• {ab,4}\t\d+
• (ab)+{4}\t\d*
• (ab){1,4}\t\d+
56. How do I lock a file?
Answers:
• using uflock()
• using lock()
• using filelock()
• using flock()
57. To execute blocks of code depending on whether a condition is met, you use:
Answers:
• both are correct
• the if statement
• the unless statement
58. You can create a reference to an existing variable or subroutine by prefixing it with a:
Answers:
• \
• $
• \\
• $$
59. The bitwise AND operator is:
Answers:
• |
• &
• ||
• &&
60. What does append do in FTP?
Answers:
• append to the end of the remote file
• Same as put but uses the STOU command.
• same as put()
• Returns TRUE if the remote server supports the given command.
61. What will be the output of variable $firstVar after completion of this code line: $firstVar = substr("0123BBB789", 4, 3);
Answers:
• 789
• BBB
• B789
• 3BB
62. What must be done to pass more than one array or hash into or out of a function and have them maintain their integrity?
Answers:
• you put them in a list and pass this list
• all answers are wrong
• you pass references to them as arguments
• you put them in an hash (associative array) and pass that
63. Can I call the method of a class without creating an object?
Answers:
• Yes, using Super class object
• by calling new()
• Yes, using :: operator
• No
64. What is closure referencing?
Answers:
• referencing file through hash
• referencing subroutines through variable
• referencing hash through variable
• referencing array through variable
65. our @ISA (person); What does @ISA mean?
Answers:
• current class inherits person class
• create a subclass person
• require person class
• include person module
66. Which regular expression deletes all tags specified as text enclosed by "<" and ">" from a document stored in a string, but deletes nothing else?
Answers:
• $string =~ s/<*&>//g;
• $string =~ s/<.*?>//g;
• $string =~ s/<\s*>//g;
• $string =~ s/<\S*>//g;
67. I can capture output of any unix command through which process?
Answers:
• using execute()
• Using system ()
• using exec () using execute ()
• Using backquote
68. To dereference $arrayref and then find the second element of that array, you use:
Answers:
• $arrayref->[1] = "man";
• all are correct
• ${$arrayref}[1] = "man";
• $$arrayref[1] = "man";
69. What does $! show?
Answers:
• Errors
• Process id
• Warnings
• Perdioda
70. You may call a subroutine called 'subrout' with arguments 'args', using:
Answers:
• all are correct
• subrout(args);
• subrout args;
• &subrout(args);
71. What's the system() success value?
Answers:
• -1
• 255
• 1
• 0
72. How do I dereference a hash reference?
Answers:
• %{%ref}
• ${$ref}
• ${%ref}
• %{$ref}
73. What statement immediately ends a subroutine?
Answers:
• return;
• goto;
• break;
• exit;
74. Which of the following is not used to control scoping?
Answers:
• local
• call
• package
• my
• use
75. What option do I use to check the existence of a file?
Answers:
• "-d"
• "-f"
• "-e"
• "-s"
76. How to create a super class object?
Answers:
• $superclass->new(parameter)
• $class->SUPER::new(parameter)
• $class->[super class name]::new(parameter)
• $class->[super class]->new(parameter)
77. What does unshift do?
Answers:
• Removes an element to the beginning of an array
• Adds an element to the end of an array
• Removes an element to the end of an array
• Adds an element to the beginning of an array
78. Which takes care of garbage collection?
Answers:
• _class name
• remove [class object]
• unlink method
• DESTROY method
79. $@ is associated with the ____ function.
Answers:
• begin block
• eval()
• die()
• main()
80. All arguments to a subroutine are passed as:
Answers:
• distinct scalars
• distinct lists, one per variable
• hashes (associative arrays)
• single, flat list of scalars
81. What does Perl -T do?
Answers:
• timeout parameter
• configuration check
• threaded mode
• use for taint checks
82. What does chop do in PERL?
Answers:
• Removes the last character of a string and returns the removed character
• Removes the last blank space from a string
• Removes the last line feed character from a string
• Removes all new lines from a string
83. What is known as a reference to a function that is, usually, passed into another function for use?
Answers:
• hashreference
• Callback
• dereference
• Closures
84. How can you write content using CGI?
Answers:
• cgiobject->header();cgiobject->start_html(); and cgiobject->end_html();
• cgiobject->header();
• cgiobject->start_html(); and cgiobject->end_html();
• cgiobject->header();cgiobject->write_html();
85. How would you check which version of perl you are using?
Answers:
• perl -version
• None of these
• perl -Verz
• perl -v
86. What would be $x after my $x = "5" x "4";
Answers:
• 5555
• 20
• Depends on the variable type.
• A value of undef and an error messages.
87. How do I create an object?
Answers:
• class name ( [class parameter] )
• bless [class parameter]
• new [class parameter] [class name]
• bless [class parameter] [class name]
88. What do the @- and @+ arrays do?
Answers:
• Store first and last index of a given array
• Store start and end positions of all regular expression group captures
• Store first and last command line arguments
• Store first and last arguments passed to functions
89. What is the MOST correct answer?
Answers:
• Perl includes the syntax of awk.
• Every awk program can be rewritten in perl, but with a different syntax.
• The use awk functionality one must execute awk from perl using the backward apostrophe `
• To parse a column based text file, awk is better than perl as perl do not support column separation.
90. Perl -I, what is 'l" meant for?
Answers:
• Inplace edit
• Quote filename
• Compile Perl script
91. if $as=="x", then what is the output of the following print "as".'$as'.$as.""
Answers:
• as$as
• asx$asx
• asasx
• as$asx
92. @values = ( "value1", "value2", ("value3", "value4") ); How does Perl store the nested list shown above?
Answers:
• The list is flattened by removing all internal bracketing.
• The list is stored as a hierarchical list.
• The list is stored as a hash with the offsets as keys to the hash.
• The list stores two values, "value1" and "value2", plus a pointer to the internal list.
93. Which list items of stat() returns the mode of the file?
Answers:
• 3
• 4
• 6
• 5
94. 1 $a="cat"; 2 $$acatches="rat"; Which of following is equivalent to second line.?
Answers:
• acatcatches="rat"
• $catcatches=.rat;
• $catcatches=''rat";
• acatcatches="rat";
95. What module is used to scrape contents from website?
Answers:
• None of these
• Net::LWP
• LWP::Simple
• Data::Dumper
96. What is a correct way to instantiate parallel processing in PERL?
Answers:
• my $pm = new Parallel::ForkManager(50,20);
• my $pm = new ForkManager(50);
• my $pm = new Parallel::ForkManager($$,50);
• my $pm = new Parallel::ForkManager(50);
97. Perl stores numbers internally as:
Answers:
• all are correct
• signed integers
• none are correct
• double-precision floating-point values
98. seek FILEHANDLE, POSITION, OPTION; What's meant by option value as 0 ?
Answers:
• sets position to the end of the file .
• does not make any change
• set new position plus position
• Sets the new position of the file
99. How would I display an error during CGI application?
Answers:
• use CGI::Carp qw(Display Error)
• use CGI::Carp qw(On Error)
• use CGI::Carp qw(fatalsTo Browser)
• use CGI::Carp qw(fatalsToCGI)
100. What does shift(ARRAY) do?
Answers:
• Shifts the first value of the array off and returns it, shortening the array by 1 and moving everything towards the end.
• Shifts the last value of the array off and returns it, shortening the array by 1 and moving everything towards the front.
• Shifts the last value of the array off and returns it, shortening the array by 1 and moving everything towards the end.
• Shifts the first value of the array off and returns it, shortening the array by 1 and moving everything towards the front.
101. Which of the following is a correct use of IMAP?
Answers:
• use Net::IMAP; $server = new Net::IMAP( 'someserver', 'someuser', 'somepassword' );
• use Net::IMAP::Simple; $server = new Net::IMAP::Simple( 'someserver' ); $server->login( 'someuser', 'somepassword' );
• use Net::IMAP::Simple; $server = new Net::IMAP::Simple( 'someserver' ); $server->login( 'someuser', 'somepassword','some port' );
• use Net::IMAP::Simple; $server = new Net::IMAP::Simple( 'someserver' , 'someuser', 'somepassword' );
102. A perl program file name prog.pl starts with the following line: #!/usr/bin/perl -w The file has execute permissions. What would be the difference between: (a) ./prog.pl (b) perl prog.pl
Answers:
• Command (b) will invoke the program without warnings.
• Second command will not work
• First command will not work
• No difference
103. ?!pattern means regular expression is:
Answers:
• a positive look-behind assertion
• a positive look-ahead assertion
• a negative look-ahead assertion
• a negative look-behind assertion
104. How do I check PERL Module's version?
Answers:
• using $]
• using $$
• using $|
• using $?
105. $b = $a++ + ++$a; What is the value of $b?
Answers:
• 0
• 1
• undef
• 3
• 2
106. What should be the output of @nums = (1..10); splice(@nums, 5,5,21..25)?
Answers:
• 1 2 3 4 5 5 21 22 23 24
• 1 2 3 4 5 21 22 23 24 25 26
• 1 2 3 4 5 21 22 23 24 25
• 1 2 3 4 21 22 23 24 25
107. what is the output of $x="AGAAA"; $x=~tr/AG/C/ds; print $x;
Answers:
• CGCCC
• C
• AAAA
• CCCCC
108. which operator has highest precedence
Answers:
• ++
• +
• *
• ^
109. Which of the following will remove a cookie?
Answers:
• my $cookie1 = new CGI::Cookie( -name=>'Test', -expires=>100, -domain=>"teste.com", -path=>'/', -secure=>0 );
• my $cookie1 = new CGI::Cookie( -name=>'Test', -expires=>1h, -secure=>0 );
• my $cookie1 = new CGI::Cookie( -name=>'Test', -expires=>, -domain=>"teste.com", -path=>'/', -secure=>0 );
• my $cookie1 = new CGI::Cookie( -name=>'Test', -expires=>-1, -domain=>"teste.com", -path=>'/', -secure=>0 );
110. What will be in $test variable? my $test = ( ($a,$b) = (7,7,7,5,45));
Answers:
• 7
• 5
• 45
• 2
• ARRAY(0x1d06760)
111. What is %INC?
Answers:
• It is used to cache the names of the files and the modules that were successfully loaded and compiled by use(), require() or do() statements
• it contains all system objects
• It contains all the inlcuded file's within the script
• It's same as @INC, just stores the information in a hash instead of an array
112. What does +>> signify in file handling?
Answers:
• write/append
• read/write/append
• append
• read/append
113. What is the difference between require and use?
Answers:
• require is verified during compile time and runtime, use is verified during run time
• require is verified during compile time, use is verified during run time
• use is verified during compile time and runtime, require is verified during run time
• require is verified during runtime, use is verified during compile time
114. How can you get the current postion of the file?
Answers:
• tell $_;
• tell FILEHANDLE;
• getpostion tell FILEHANDLE;
• getpos FILEHANDLE;
115. Which of the following expressions allow you to enter the perl debugger without running a program?
Answers:
• perl -d null
• perl -d
• perl -V
• perl -de0
116. How can I read character by character from a file?
Answers:
• getchar FileHandle
• getc FileHandle
• getchar @_
• getc $_
117. When is begin block evaluated?
Answers:
• at the beginning of any script
• it's evaluated as it's being called
• as soon as it is defined
• at the end
118. How do I handle transaction control in PERL?
Answers:
• Set Autocommit=0;use commit and rollback
• Set Autocommit=1;use BEGIN TRANSACTION and END TRANSACTION
• Set Autocommit=0;use BEGIN TRANSACTION and END TRANSACTION
• Set Autocommit=1;use commit and rollback
119. What does $1 hold? $x= "a walk in the park";$x=~/(.+)a/;
Answers:
• a walk in the p
• a w
• empty string
120. For the string "2011/12/04" and regular expression "/(\d+)\/(\d+)\/(\d+)/", you can use $3 to return "04". What other variable can be used to return "04"?
Answers:
• $'
• $+
• $&
• $`
• $^
121. What does die() do?
Answers:
• Exits the process
• Sets error code as 0
• Set the error code based on $! or $? if the exception is uncaught
• It does not throw any exceptions
122. Which one of the following completely defines scalars?
Answers:
• A pointer, a stack, or a heap
• An int, float, double, or char
• A single string, number, or reference
• A string, a lexical array, or a numeric value
Recent:
- Benefits of being freelancer. Short 5 stories
- I got first job with experience in Google Reports
- How I got my first freelancing job
- How Indian student began work as a freelancer
Popular:
- Getting your first project
- Upwork(oDesk) For Beginners
- Tips to complete Upwork(oDesk) profile
Related Tests Answers:
Access 2015
Actionscript 3 2015
Active Directory 2015
Adobe ColdFusion 2015
Ajax 2015
Amazon Web Services 2015
Android (Developer) 2015
Antispam and Antivirus 2015
Apache Flex 2015
Apache 2015
ASP.NET 2015
Blackberry (Native SDK Development) 2015
Box 2015
C 2015
CakePHP 2015
CCNA 2015
CISCO 2015
Clojure 2015
Cocoa Programming for Mac OS X 2015
Computer Networking 2015
Core Java 2015
CSS 3 2015
CSS 2015
Data Mining 2015
Data Structures and Algorithms 2015
Data Warehousing 2015
DB2 Administration 2015
DB2 Programming 2015
DHTML 2015
Django 2015
Dojo 2015
DOS 2015
Drupal 2015
Ebay Development 2015
Enterprise Java Beans (EJB) 2015
ExtJs 2015
Facebook (Development) 2015
Firewall Concepts 2015
Gamification 2015
Git 2015
Google App Engine 2015
Google Glass (Development) 2015
Google Maps (API and development) 2015
Google Web Toolkit 2015
Hibernate 2015
HTML 5 2015
HTML 2015
Internet Security 2015
Introduction to Programming 2015
iOS Technical Test 2015
Java 2015
JavaScript 2015
JDBC 2015
Joomla 2015
jQuery 2015
JSON 2015
JSP and Servlets 2015
LAMP 2015
Linux 2015
Magento 2015
Microsoft MVC Framework 2015
MySQL 2015
.NET 2015
Objective C 2015
PHP 5 2015
PHP 2015
Python 2015
Ruby on Rails 2015
Microsoft Silverlight 2015
Microsoft SQL Server 2015
Mobile App Design 2015
MongoDB 2015
Networking 2015
Node.js 2015
OOPS Concepts 2015
OpenGL 2015
Oracle Database 2015
PayPal (Development) 2015
PhoneGap 2015
PostgreSQL 2015
PrototypeJS Javascript Framework 2015
RDF (Resource Description Framework) 2015
Red Hat Linux 2015
RESTful Services 2015
RSS 2015
Salesforce (Development) 2015
Samba 2015
SAP ABAP 2015
SAP 2015
Scala 2015
Sencha 2015
SharePoint 2015
Shopify 2015
Skype Development 2015
Software Quality Assurance 2015
Software Testing 2015
Solaris 2015
Spring Framework 2015
SQL 2015
Symfony2 2015
System Analysis 2015
System Programming 2015
TCP/IP 2015
Technical Aptitude 2015
Twitter (Development) 2015
Unix 2015
VB.NET 2015
VBA 2015
Visual Basic 2015
VMware 2015
Windows 7 2015
Windows 8 2015
Windows Azure (Developer) 2015
Windows Phone Development 2015
Windows Vista Administration 2015
WordPress 2015
XHTML 2015
XML 2015
Yola 2015
Zoho Creator 2015
Upwork Perl Test Answers.
Question:
What does chop do in PERL?
Answers:
Removes the last character of a string and returns the removed character
Upwork Perl Test Answers.
Question:
What will $count= scalar keys %hashname; return?
Answers:
number of elements in hash
Upwork Perl Test Answers.
Question:
our @ISA (person); What does @ISA mean?
Answers:
current class inherits person class
Upwork Perl Test Answers.
Question:
What does append do in FTP?
Answers:
append to the end of the remote file
Upwork Perl Test Answers.
Question:
How can perl be called which gives the same functionality of "use warnings"?
Answers:
perl -w
Upwork Perl Test Answers.
Question:
Which of the following will remove a cookie?
Answers:
my $cookie1 = new CGI::Cookie( -name=>'Test', -expires=>, -domain=>"teste.com", -path=>'/', -secure=>0 );
Upwork Perl Test Answers.
Question:
$_ is used by default:
Answers:
all are correct
Upwork Perl Test Answers.
Question:
I can capture output of any unix command through which process?
Answers:
Using backquote
Upwork Perl Test Answers.
Question:
What does shift(ARRAY) do?
Answers:
Shifts the first value of the array off and returns it, shortening the array by 1 and moving everything towards the end.
Upwork Perl Test Answers.
Question:
What will be in $test variable? my $test = ( ($a,$b) = (7,7,7,5,45));
Answers:
5
Upwork Perl Test Answers.
Question:
Why would I include strict in PERL code?
Answers:
When strict is in use and the package name is not used to fully qualify the variable, this error will be reported
Upwork Perl Test Answers.
Question:
How would you remove an element from hash?
Answers:
delete $hash{'key'}
Upwork Perl Test Answers.
Question:
What will be the output of variable $firstVar after completion of this code line: $firstVar = substr("0123BBB789", 4, 3);
Answers:
BBB
Upwork Perl Test Answers.
Question:
What is $_ ?
Answers:
The default input and pattern-searching space.
Upwork Perl Test Answers.
Question:
What's the preferable mode of executing one CGI script?
Answers:
755
Upwork Perl Test Answers.
Question:
What does $1 hold? $x= "a walk in the park";$x=~/(.+)a/;
Answers:
a walk in the p
Upwork Perl Test Answers.
Question:
How do I close a file?
Answers:
close fh
Upwork Perl Test Answers.
Question:
Unless it is the final statement in a block, every simple statement must end in:
Answers:
;
Upwork Perl Test Answers.
Question:
You may force yourself to declare your variables by:
Answers:
including the 'use strict' pragma in your program
Upwork Perl Test Answers.
Question:
How can I read character by character from a file?
Answers:
getc FileHandle
Upwork Perl Test Answers.
Question:
You can create a reference to an existing variable or subroutine by prefixing it with a:
Answers:
\
Upwork Perl Test Answers.
Question:
Which list items of stat() returns the mode of the file?
Answers:
3
Upwork Perl Test Answers.
Question:
How do I handle transaction control in PERL?
Answers:
Set Autocommit=0;use commit and rollback
Upwork Perl Test Answers.
Question:
Which of the following functions is not used for hash processing?
Answers:
all are used for hash processing
Upwork Perl Test Answers.
Question:
$m=ucfirst("test"); What will be the output of $m?
Answers:
Test
Upwork Perl Test Answers.
Question:
how would you execute a shell command from within a perl script
Answers:
enclose within back ticks , ie `ls`
Upwork Perl Test Answers.
Question:
Will perl be installed in Windows by default?
Answers:
No
Upwork Perl Test Answers.
Question:
How would you check which version of perl you are using?
Answers:
perl -v
Upwork Perl Test Answers.
Question:
Which of the following gets you an array of all numbers matched in a string?
Answers:
my @numbers = $string =~ /\d+/g;
Upwork Perl Test Answers.
Question:
To disable a database error, what parameter is set in the database initialization?
Answers:
raise_error=0
Upwork Perl Test Answers.
Question:
How to create a super class object?
Answers:
$class->SUPER::new(parameter)
Upwork Perl Test Answers.
Question:
How can you get the current postion of the file?
Answers:
tell FILEHANDLE;
Upwork Perl Test Answers.
Question:
if $as=="x", then what is the output of the following print "as".'$as'.$as.""
Answers:
as$asx
Upwork Perl Test Answers.
Question:
Perl has a 'goto' command.
Answers:
True
Upwork Perl Test Answers.
Question:
What is closure referencing?
Answers:
referencing subroutines through variable
Upwork Perl Test Answers.
Question:
Which of the following expressions allow you to enter the perl debugger without running a program?
Answers:
perl -de0
Upwork Perl Test Answers.
Question:
How do you check the existence of a key in a hash?
Answers:
exists $hash {'key'}
Upwork Perl Test Answers.
Question:
my @b=(1,2,3);my $a=scalar(@b);What will be the output of $a?
Answers:
3
Upwork Perl Test Answers.
Question:
$b = $a++ + ++$a; What is the value of $b?
Answers:
2
Upwork Perl Test Answers.
Question:
How do I lock a file?
Answers:
using flock()
Upwork Perl Test Answers.
Question:
How would I display an error during CGI application?
Answers:
use CGI::Carp qw(fatalsTo Browser)
Upwork Perl Test Answers.
Question:
what is the output of $x="AGAAA"; $x=~tr/AG/C/ds; print $x;
Answers:
C
Upwork Perl Test Answers.
Question:
What would be $x after my $x = "5" x "4";
Answers:
5555
Upwork Perl Test Answers.
Question:
Perl programs have this filehandle that is automatically opened:
Answers:
STDERR
Upwork Perl Test Answers.
Question:
How can you write content using CGI?
Answers:
cgiobject->header();cgiobject->start_html(); and cgiobject->end_html();
Upwork Perl Test Answers.
Which conditional statement is equivalent to "if (!
Question:
Which conditional statement is equivalent to "if (!)"?
Answers:
unless ()
Upwork Perl Test Answers.
Question:
You may call a subroutine called 'subrout' with arguments 'args', using:
Answers:
• all are correct • subrout(args); • subrout args; • &subrout(args)
Upwork Perl Test Answers.
Question:
To remove any line-ending characters of each string in a @list, you use the function:
Answers:
chomp
Upwork Perl Test Answers.
Question:
When is begin block evaluated?
Answers:
as soon as it is defined
Upwork Perl Test Answers.
Question:
my @b=(1,2,3);my $a=@b;What will be the output of $a?
Answers:
3
Upwork Perl Test Answers.
Question:
What is the difference between require and use?
Answers:
require is verified during runtime, use is verified during compile time
Upwork Perl Test Answers.
Question:
What do the @- and @+ arrays do?
Answers:
Store start and end positions of all regular expression group captures
Upwork Perl Test Answers.
Question:
How do I check PERL Module's version?
Answers:
using $]
Upwork Perl Test Answers.
Question:
Which one of the following completely defines scalars?
Answers:
An int, float, double, or char
Upwork Perl Test Answers.
Question:
Can a pattern search be done in a split function in PERL?
Answers:
Yes
Upwork Perl Test Answers.
Question:
?!pattern means regular expression is:
Answers:
a negative look-ahead assertion
Upwork Perl Test Answers.
Question:
which operator has highest precedence
Answers:
++
Upwork Perl Test Answers.
Question:
Using which of the below would declare a global variable?
Answers:
our
Upwork Perl Test Answers.
Question:
What does +>> signify in file handling?
Answers:
read/append
Upwork Perl Test Answers.
Question:
A perl program file name prog.pl starts with the following line: #!/usr/bin/perl -w The file has execute permissions. What would be the difference between: (a) ./prog.pl (b) perl prog.pl
Answers:
No difference
Upwork Perl Test Answers.
Question:
What is a hash identified as?
Answers:
%
Upwork Perl Test Answers.
No comments:
Post a Comment