Tag: programming languages

Questions Related to programming languages

  1. With assertions enabled it prints 210210-1 followed by an AssertionError message.

  2. With assertions enabled it prints 210210 followed by an AssertionError message.

  3. With assertions enabled it prints only 210210

  4. With assertions enabled it prints nothing.

  5. With assertions disabled it prints 210210-1

  6. With assertions disabled it prints only 210210


Correct Option: B,E
  1. With assertions enabled it prints ABC followed by an AssertionError message.

  2. With assertions disabled it prints ABC followed by an AssertionError message.

  3. Assertions should not be used within the default case of a switch statement.

  4. In this code example a throw statement must be used in place of the assert statement.

  5. Compile-time error


Correct Option: D,E
  1. If assertions are not enabled at run time it prints an error message.

  2. If assertions are not enabled at run time it prints nothing.

  3. With assertions enabled it prints an error message.

  4. With assertions enabled it prints nothing.

  5. The assert statement is being used to check a class invariant--something that must be true about each instance of the class

  6. The assert statements are being used to check a precondition--something that must be true when the method is invoked.


Correct Option: B,D,E
  1. text always precedes the

  2. text always precedes the end of the end

  3. text always precedes the end of the

  4. None of the above


Correct Option: C

What is the output of the following code snippet: $mystring = "[2009/02/14] The date of this article."; if($mystring =~ m/(\d+)/) { print "$1"; }

  1. 14

  2. 02

  3. 2009

  4. Valentine's Day


Correct Option: C

a\Sz

  1. would match any three-character string starting with "a" and ending with "z" whose second character was not a space, tab or newline.

  2. the second character could be a letter, number or symbol

  3. would match any three-character string starting with "a" and ending with "z" whose second character was a newline

  4. None of the above


Correct Option: A,B
  1. p is a function that accepts an argument which is a pointer to a character and returns a pointer to a 10 element integer array

  2. p is a pointer to a function that accepts an argument which is a pointer to a character and returns an integer quantity

  3. p is a function that accepts an argument which is a pointer to a character and returns an integer quantity

  4. None of the above


Correct Option: B
  1. p is a function that accepts an argument which is a pointer to a character and returns an integer quantity

  2. p is a function that accepts an argument which is a pointer to a character and returns a pointer to an integer quantity

  3. p is a function that returns a pointer to an integer quantity

  4. None of the above


Correct Option: C
  1. will match "cyclopentane"

  2. will match "tri-pentane"

  3. will match "n-pentane"

  4. will match "neopentane"


Correct Option: A,B,D