Wednesday, May 9, 2018

Upwork Perl Test

1. Context in Perl can be.
Answers:

• conditional, referenced, literal, null

• numeric, string, list, scala

• associative, numeric, scalar, sparse

• inary, string, list, scala

• Boolean, numeric, string, null



2. A label, in Perl, is.
Answers:

• a marker for the Perl interprete

• a heading

• a switch statement

• the name of an operator

• a component embedded in the code

3. How many times does the do statement allow you to execute the block of statements in a loop?
Answers:

• Does not allow you to execute statements in a loop

• At least once

• Twice

• Depends on the number of times specified

• An indefinite number of times

4. A directory handle.
Answers:

• is a program that handles your operating system

• is a link from your computer program to the directory on your file system

• does not have its own namespace

• cannot be considered equivalent to a file handle

• does not require the opendir function

5. A scalar variable can contain.
Answers:

• only one data item at a time

• several data items at a time, the number of which needs to be declared beforehand

• unlimited items

• two items at a time

• an array of data items

6. How are hash references created?
Answers:

• % $ reference

• $ reference = \ % hash;

• @ reference = \ % hash;

• % hash=$reference;

• $$reference= \ % hash;

7. How is an array assigned to an array?
Answers:

• @array1=@array[1...6];

• @array1=@array2;

• @array=(1, "string", 4,5, \@ array z);

• By creating another array object

• An array cannot be assigned to an array

8. Non-associative operators are those that.
Answers:

• do not bind at all

• change their associativity depending on the context

• do not show precedence

• ind themselves to whichever expression they are adjacent to

• do not associate the lvalue with the expression on the right

9. Dereferencing refers to:
Answers:

• accessing an array that contains a reference to another array

• removing the reference

• an undefined or empty reference

• accessing values referred to by Perl references

• a scalar variable that keeps track of where another variable is stored in memory

10. Context in Perl can be:
Answers:

• conditional, referenced, literal, null

• numeric, string, list, scalar

• associative, numeric, scalar, sparse

• inary, string, list, scalar

• Boolean, numeric, string, null

11. A scalar variable can contain:
Answers:

• only one data item at a time

• several data items at a time, the number of which needs to be declared beforehand

• unlimited items

• two items at a time

• an array of data items

12. Non-associative operators are those that:
Answers:

• do not bind at all

• change their associativity depending on the context

• do not show precedence

• bind themselves to whichever expression they are adjacent to

• do not associate the lvalue with the expression on the right


61 NOT Answered Yet Test Questions:
(hold on, will be updated soon)
13. What does the abs_path method do?
Answers:

• Gets the current working directory

• Gets the absolute path of the paramete

• Gets the absolute path of the input paramete

• Gets the absolute path of the current working directory

• Gets the current paramete

14. An atom cannot be
Answers:

• a single character or digit, A-Z, a-z, 0-9

• an escaped meta-characte

• an escaped special meaning characte

• a regular expression enclosed in parenthesis

• a meta characte

15. Which of the following is not an alignment character?
Answers:





• |

• &

• #

16. Which of the following translation modifiers matches all characters that are not part of the search string?
Answers:

• d

• s

• c

• x

• z

17. The value assigned to an array cell must be.
Answers:

• a scalar value

• a variable value

• a scalar or a variable value that resolves to a scalar value

• null

• None of the above

18. Which of the following characters denotes a comment in Perl?
Answers:

• //

• #

• /*

• &

• *

19. What does the pop function do?
Answers:

• Takes elements off the end of an array

• Puts elements into the first cell index of an array

• Adds an element to the end of an array

• Takes elements off the first index of the array

• Modifies or deletes elements from the array

20. Which one of the following is a part of the if family of branching statements in Perl?
Answers:

• if

• if else

• if elsif

• if, if else, and if elsif

• None of the above

21. Which of the following loops is usually used to process arrays?
Answers:

• while

• until

• do

• for / foreach

22. Which of the following can replace if else?
Answers:

• ? :

• : ?

• ! :

• / ?

• ? /

23. Which of the following is not a rule for switches using the Getopt function?
Answers:

• Switches begin with a dash character (-)

• Switches that do not take a parameter are set to the value 0

• Switches that take a parameter may or may not have space between the switch name and the switch value

• Switches are not required to be in any orde

• Switches are case-sensitive

24. What is the following code an example of?

        $hitCounter=sub {print "This page has been called $hits times";};
Answers:

• Anonymous array

• Anonymous hash

• Object reference

• Subroutine

• Anonymous subroutine

25. Of which of the following switch syntax options is the following code an example of?

        GetOptions("extension:s");
Answers:

• Sets the default syntax

• Allows the option to be negated

• Sets the input option to include a mandatory string argument

• Sets the input option to include a mandatory integer argument

• Sets the input option to include an optional string argument

26. What does @ARGV refer to?
Answers:

• The number of elements in an array

• An array loaded with the command-line arguments

• A file handle used when processing an array

• A file associated with a file handle

• The name of your program

27. What are bare words?
Answers:

• Comments with the # sign missing

• Improperly declared variables

• Operators

• Character strings without surrounding quotation marks

• Characters denoting a string

28. What does the following error indicate?


"Can't Locate Function in @INC"
Answers:

• You misspelled a function name

• The last line of the required file returned a zero or null value

• You forgot to type the comma after the first argument of a function

• Your code is using a function that has been replaced by a newer function

• You used an uninitialized value

29. Which of the following begins or ends a system command string in Perl?
Answers:

• font size=5>"</font

• font size=5>'</font

• font size=5><></font

• font size=5><!</font

• font size=5>`</font

30. Dereferencing refers to.
Answers:

• accessing an array that contains a reference to another array

• emoving the reference

• an undefined or empty reference

• accessing values referred to by Perl references

• a scalar variable that keeps track of where another variable is stored in memory

31. Which of the following is not true of labels?
Answers:

• A label can go on any line

• A label must begin with a character followed by any combination of letters or numbers that end with a colon

• Reserved words cannot be used as labels

• Labels are case sensitive

• A label performs the same function as the last command

32. Which of the following operators is associated with writing to a program?
Answers:

• +





• | filename

• filename |

33. Which of the following characters is the variable designator for scalar variables?
Answers:

• @

• %

• $

• *

• &

34. The syntax of the sort function without a special purpose sort subroutine is:
Answers:

• sort ( ) {$b cmp $a ;}

• lvalue=sort list

• $ name= ~tr/+/ /;

• sortDescending ( ) {$b cmp $a;}

• lvalue=sort subroutineName list;

35. Which of the following meta characters creates a single expression or atom?
Answers:

• { }

• ( )

• *

• +

• ?

36. What does the following compound assignment operator signify?


     | =
Answers:

• Exclusive OR the expression on the left of the operator with the expression on the right of the operator

• Logical OR the expression on the left of the operator with the expression on the right of the operator

• Left shift the expression on the left of the operator by the expression on the right of the operator

• Binary OR the expression on the left of the operator with the expression on the right of the operator

• Append the expression on the left of the operator with the expression on the right of the operator

37. The keyword 'my' is used to declare
Answers:

• comments

• are words

• default variables

• Lexical variables

38. Which of the following is not a feature of Perl?
Answers:

• Portability

• Interpreted language

• Compiled language

• Is used for CGI applications

• Was originally used to generate reports that tracked errors

39. The foreach loop is usually used to process.
Answers:

• arrays and hashes

• a block of statements a number of times

• lists

• multi-dimensional arrays

• namespaces

40. Which of the following is not a type of reference variables?
Answers:

• Direct

• Constant

• Subroutine

• Numeric

• Symbolic

41. What does the switch syntax :f do?
Answers:

• It allows the option to be negated

• It sets the default syntax

• It sets the input option to include an optional real-number argument

• It sets the input option to include an optional integer argument

• It sets the input option to include a mandatory real-number argument

42. The syntax of assigning to an array cell is.
Answers:

• array=new Array(n);

• scalar=@array[cellIndex]

• @array[cellIndex]=scalar;

• $array[cellIndex]=scalar;

• $array[n]=newArray;

43. Which of the following pertains to IO: :Handle?
Answers:

• Base class for IO classes

• Interface to file-open functions

• Get the file descripto

• Interface to IO: : *classes

• Export file symbols

44. The s/// function.
Answers:

• substitutes one string for another string

• eturns the first position of a substring

• eturns the last position of a substring

• eturns the number of characters of a string

• eturns or modifies a substring

45. Which of the following operators has/have the highest precedence?
Answers:

• Increment/decrement

• NOT, escape, sign operator

• Dereference operator

• Exponential operator

• Parenthesis, function, quotation marks

46. Which of the following Getopt::Long Configuration variables refers to an internal error flag?
Answers:

• debug

• orde

• pass_through

• null

• error

47. The syntax of the heredoc operator is.
Answers:

• print >>heredoc - marker;

• print <<heredoc - marker;

• select <<heredoc - marker;

• print << heredoc -label;

• printlist <<heredoc -label;

48. When are the environment variables created?
Answers:

• Each time you run a program

• When you save a program

• When you compile a program

• The first time you run a program

• When you run a program in the Unix command shell

49. Which of the following file functions gets the file descriptor of a file handle?
Answers:

• fcntl

• flock

• getc

• fileno

• link

50. What is meant by variable interpolation?
Answers:

• Exchanging the values of one variable with anothe

• Passing a variable as an argument to a function

• The process of making a variable part of the namespace table

• The process of assigning some value to a variable

• The process of interpreting characters in a string literal surrounded by double quotation marks

No comments:

Post a Comment