0

Simple Java Quiz - 1

Description: Simple Java Quiz - 1
Number of Questions: 7
Created by:
Tags: java
Attempted 0/7 Correct 0 Score 0

Overriding and Overloading is for ?

  1. Methods and variables

  2. Class

  3. Variables

  4. Methods


Correct Option: D

For a subclass outside the package, the protected member can be accessed through ?

  1. Object of super class

  2. Inheritance

  3. Both

  4. None


Correct Option: B

Which, inserted independently at line 6, will compile? (Choose all that apply.)

  1. static void doStuff(int... doArgs) { }

  2. static void doStuff(int x, int... doArgs) { }

  3. static void doStuff(int[] doArgs) { }

  4. static void doStuff(int... doArgs, int y) { }


Correct Option: A,B

Which variables have the longest scope?

  1. Block variables

  2. Instance variables

  3. Static variables

  4. Local variables


Correct Option: C
  1. Object reference =null

  2. double =0.0

  3. byte=0

  4. char = '\u0000'


Correct Option: A,B,C,D
  1. Two objects are eligible for GC

  2. Five objects were created

  3. Four objects were created.

  4. Three objects are eligible for GC


Correct Option: A,B

What will be the output?

  1. y string = Java,y string = Java

  2. y string = Javay string = Java

  3. y string = Java, y string = Java

  4. y String = Java, y string = Java


Correct Option: C
- Hide questions