0

programming languages Online Quiz - 345

Description: programming languages Online Quiz - 345
Number of Questions: 20
Created by:
Tags: programming languages
Attempted 0/20 Correct 0 Score 0

Which one of these is a valid method declaration?

  1. void method1 { /* ... */ }

  2. void method2() { /* ... */ }

  3. void method3(void) { /* ... */ }

  4. method4() { /* ... */ }


Correct Option: B
  1. abstract class Link { }

  2. native class Link { }

  3. final class Link { }

  4. abstract final class Link { }


Correct Option: C

Which of these combinations of switch expression types and case label value types are legal within a switch statement?

  1. switch expression of type int and case label value of type char

  2. switch expression of type float and case label value of type int

  3. switch expression of type byte and case label value of type float

  4. switch expression of type char and case label value of type long


Correct Option: A
  1. {{}} is a valid statement block

  2. { continue; } is a valid statement block

  3. block: { break block; } is a valid statement block

  4. block: { continue block; } is a valid statement block


Correct Option: A,C
  1. Compilation error.

  2. Runtime error

  3. Compiles Fine

  4. Depends on the code where you use


Correct Option: A

Which statements are true?

  1. Inheritance defines a has-a relationship between a superclass and its subclasses

  2. Every Java object has a public method named equals

  3. A class can extend any number of other classes

  4. A non-final class can be extended by any number of classes


Correct Option: B,D
  1. Runtime error.

  2. Depends on the code where you use

  3. Compiles Fine

  4. Compilation error.


Correct Option: D

1.Set s = new TreeSet(); 2.s.add("JAVA"); 3.s.add(new Integer(5)); Line 3 will give ClassCast Exception because Two different types of object are getting added.

  1. True

  2. False


Correct Option: A

1.Set s = new TreeSet(); 2.s.add("JAVA"); 3.s.add(new Integer(5)); Line 3 will give ClassCast Exception because Two different types of object are getting added.

  1. True

  2. False


Correct Option: A

1.Set s = new TreeSet(); 2.s.add("JAVA"); 3.s.add(new Integer(5)); Line 3 will give ClassCast Exception because Two different types of object are getting added.

  1. True

  2. False


Correct Option: A
- Hide questions