Tag: programming languages

Questions Related to programming languages

  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
  1. The program cannot compile because you cannot have the print statement in a non-void method

  2. The program cannot compile because the compiler cannot determine which max method should be invoked

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

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


Correct Option: B