Tag: science & technology

Questions Related to science & technology

  1. The program has a syntax error

  2. The program has a runtime error

  3. The program runs fine, but displays nothing

  4. The program runs fine and displays It is even!


Correct Option: D
  1. The program has a syntax error because the required break statement is missing in the switch statement

  2. The program has a syntax error because the required default case is missing in the switch statement

  3. The switch control variable cannot be double

  4. No errors


Correct Option: C

What will be the value of str after line no.7?1 class string 2 {3 public static void main String ds[])4 {5 String str="A";6 str.concat("B");7 str+="C";8 }9 }

  1. A

  2. AB

  3. AC

  4. ABC

  5. compile-time error


Correct Option: C
  1. The program cannot compile because the compiler cannot determine which max method should be invoked

  2. The program cannot compile because you cannot have the print statement in a non-void method

  3. The program runs and prints "max(int, double) is invoked" followed by 2

  4. The program runs and prints "max(double, int) is invoked" followed by 2


Correct Option: A
  1. The program runs and prints 2 once

  2. The program runs and prints 2 twice

  3. The program has a syntax error because the second m method is defined, but not invoked in the main method

  4. The program has a syntax error because the two methods m have the same signature


Correct Option: D