Tag: programming languages

Questions Related to programming languages

If $string contains abcdabcd , what will the following call return? index ($string, “cd”, 3);

  1. 6

  2. 4

  3. -1

  4. 2


Correct Option: A

Which modifier can be used when matching in Perl to match any character?

  1. S

  2. V

  3. I

  4. C


Correct Option: A

Running your Perl scripts with a d switch will perform which task?

  1. Invoke the Perl debugger

  2. Disable the Perl debugger

  3. Disable breakpoints

  4. Display a stack trace


Correct Option: A

Which file test can be done to see if a file is a socket?

  1. -s

  2. -l

  3. -S

  4. -k


Correct Option: A

How can you include code from another file in your program?

  1. With the #include preprocessor command

  2. Adding the file’s directory to @INC and then passing the filename to require.

  3. Both A & B

  4. None


Correct Option: C
  1. grep(! /^ !/, @array);

  2. Every non empty list element

  3. Every list element that does not start with an exclamation mark.

  4. Every list element.


Correct Option: B