NAME

Question types


Start with


Question limit

of 62 available terms

Print test

62 True/False questions

  1. Describe the command substitution in perlopen(FILEHANDLE, file_mode, "filename.txt")
    - file mode is either ">", "<" or ">>"; write, read and append respectively

          

  2. Explain common hash functionskeys(%hash)
    values(%hash)
    each(%hash)
    delete($hash{keyName})
    exists($hash{keyName})
    reverse(%hash)

          

  3. substr($string, $startindex, $numchars)return the sub string starting at index $startindex and ending after $numchars chars in the string $string

          

  4. Describe hash variables in perl- Singular variable, starts with "$"
    - Number, characer or string
    - Perl does automatic type conversion of scalar variables

          

  5. join(':', @array)Sort and array alphabetically

          

  6. Identify the variable that provides the last index of an array1. Editing
    2. Execution

          

  7. Explain how to read an entire file into an array (one line per element)@array=("el1", "el2", "el3", 16, 12);
    - Elements need not be similar data types
    - Arrays can be assigned or read in scalar context (Ex: $myArray[4] = 2)
    - Special array $#arrayName give value of last index available in the array. Ex an array of size 5 will have its $#arrayName = 4
    - scalar(@arrayName) returns the size of the array

          

  8. Describe array variables in perl- A collection of data (static data, scalar variables, arrays or hashes can all be stored in an array element)

          

  9. Define the open() statement in perlopen(FILEHANDLE, file_mode, "filename.txt")
    - file mode is either ">", "<" or ">>"; write, read and append respectively

          

  10. lc($string)returns a copy of the string as all lower case

          

  11. values(%hash)returns all of the keys of the hash as an array

          

  12. split(/\s/, $string)split string into an array using spaces as delimeter

          

  13. Explain the @ARGV array in perlA special system variable used to pass arguments to script
    - Ex: perl ./myScript.pl arg1 arg2
    --$ARGV[0] will be "arg1", $ARGV[1] will be "arg2"

          

  14. Explain how to read a line from a file handle$line=<FILEHANDLE>
    To get rid of the newline in $line, you could now chomp() (Ex: chomp($line);)

          

  15. each(%hash)returns all of the keys of the hash as an array

          

  16. Explain assignment of hash variables in perl (when oringally defining the hash)%hashname = (key1=>"value1", key2=>"value2", key3=>"Value3")

          

  17. Explain the use of "if" "if-else" and "if-elsif-else"Define the execution block of the if statement. Unlike C, the {} braces ARE REQUIRED

          

  18. Define the two primary methods of executing system commands in perlopen(FILEHANDLE, file_mode, "filename.txt")
    - file mode is either ">", "<" or ">>"; write, read and append respectively

          

  19. Describe scalar variables in perl- Singular variable, starts with "$"
    - Number, characer or string
    - Perl does automatic type conversion of scalar variables

          

  20. unshift(@array, $newValue)Removes the first element of the array

          

  21. Define common string manipulation functionssubstr($string, $start, $numchars);
    length($string)
    lc($string)
    uc($string)
    chomp($string)
    chomp(@string)
    join(':", @string)
    split(/\s/, $string)
    lcfirst($string)
    ucfirst($string)

          

  22. Summarize the size string comparison operators<
    >
    ==
    <=
    >=
    !=

          

  23. What does $#arrayName returnThe value of the last index of the array (NOT the data stored in that array element)

          

  24. ucfirst($string)returns a copy of the string with the first letter lower case

          

  25. length($string)returns the length of the string including escape sequences

          

  26. exists($hashName{keyName})delete the hash entry with the key given

          

  27. Two basic binding operators in regular expressions=~ Contains
    !~ Does not contain

          

  28. shift(@array)Sort and array alphabetically

          

  29. Identify what modules are in perl- Documenting code
    - Created by placing a "#" on a line.
    - Comments are not multi-line

          

  30. chomp(@string)remove trailing newline from each element in the array

          

  31. pop(@array)Removes the last element from the array

          

  32. Identify the two phases of creating a PERL programwhile
    until
    for
    foreach

          

  33. Regular Expression Quantifiersswap keys for values and values for keys. Will cause issues if there are multiple hash entries with the same value

          

  34. List the conditions which evaluate as false0
    undef
    () -- arrays
    "" -- string
    EOF -- end of file
    "0"

          

  35. Summarize the siz arithmetic comparison operatorseq
    ne
    lt
    le
    gt
    ge

          

  36. Explain the %ENV hash arrayA special system variable used to pass arguments to script
    - Ex: perl ./myScript.pl arg1 arg2
    --$ARGV[0] will be "arg1", $ARGV[1] will be "arg2"

          

  37. Identify the purpose of {} in an "if" statementDefine the execution block of the if statement. Unlike C, the {} braces ARE REQUIRED

          

  38. reverse(%hashName)swap keys for values and values for keys. Will cause issues if there are multiple hash entries with the same value

          

  39. Regular Expression chararcter classes\w - alphanumeric word including underscor
    \d - digits 0-9
    \s any whitespace
    . - any character

          

  40. Identify the use of comments in perl- Documenting code
    - Created by placing a "#" on a line.
    - Comments are not multi-line

          

  41. Explain assignment of a hash variable for a single hash element$hashName{keyName}="Value to Add"

          

  42. Interpret the syntax of the foreach loopforeach $element(@arrayName)
    {
    CODE TO EXECUTE
    }

    In this case $element is a reference to a specific element of @arrayName. If you change the value of $element, the value will change in the array as well

          

  43. sort(@array)Sort and array alphabetically

          

  44. uc($string)returns a copy of the string as all lower case

          

  45. Explain variable context in perl- can be scalar, array, or hash context
    - tells the interpreter what you are looking for (Ex: "$arrayname[$index_number]")

          

  46. Interpret the syntax of a while loopwhile(condition)
    {
    CODE TO EXECUTE
    }

          

  47. What does scalar(@arrayName) returnThe value of the last index of the array (NOT the data stored in that array element)

          

  48. reverse(@array)reverse the elements of the array

          

  49. Describe the system() function in perl- used to execute an external command
    -will output results of command to terminal
    - returns the exit status of the program that ran
    - use this for commands that you dont care about SAVING the output to a variable

          

  50. delete($hashName{key})delete the hash entry with the key given

          

  51. Identify the four types of loops in perl- Synonymous with header files in C
    - Collection of like functions and variables that may be used in your program

          

  52. lcfirst($string)returns a copy of the string with the first letter lower case

          

  53. Explain how to write to a filehandleprint(FILEHANDLE "Data to output\n");

          

  54. Explain the assignment of arrays in perlA special system variable used to pass arguments to script
    - Ex: perl ./myScript.pl arg1 arg2
    --$ARGV[0] will be "arg1", $ARGV[1] will be "arg2"

          

  55. Identify the interpreters role in handling syntax errors- In perl, the interpreter will recognize syntax errors and halt execution BEFORE it begins
    - Interpreter will output statements; it does not understand and the line which it encountered the error on

          

  56. List the three basic file access modes of the open() functionforeach $element(@arrayName)
    {
    CODE TO EXECUTE
    }

    In this case $element is a reference to a specific element of @arrayName. If you change the value of $element, the value will change in the array as well

          

  57. push(@array, $newValue)Add a new element to the from of the array with the value $newwValue

          

  58. keys(%hash)returns a two element ray of the next key value pair; resultArray[0] is the key resultArray[1] is the value

          

  59. Explaing assignment of scalar variables in perl- Singular variable, starts with "$"
    - Number, characer or string
    - Perl does automatic type conversion of scalar variables

          

  60. Identify how to include modules in perluse moduleName;
    Ex: use Roman;

          

  61. chomp($string)returns a copy of the string as all upper case

          

  62. Explain common array functionspop(@array)
    push(@array, $new Value)
    shift(@array)
    unshift(@array, $newValue)
    sort(@array)
    reverse(@array)