Alien head

Simple Java Quiz - 1

Description: Simple Java Quiz - 1
Number of Questions: 7
Created by:
Tags: java

Overriding and Overloading is for ?

  1. Methods and variables

  2. Class

  3. Variables

  4. Methods

Answer: 4

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

  1. Object of super class

  2. Inheritance

  3. Both

  4. None

Answer: 2

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) { }

Answer: 1,2

Which variables have the longest scope?

  1. Block variables

  2. Instance variables

  3. Static variables

  4. Local variables

Answer: 3

Which are the default value for the Primitives and Reference Types ?

  1. Object reference =null

  2. double =0.0

  3. byte=0

  4. char = '\u0000'

Answer: 1,2,3,4

Which two are true about the objects created within main(), and eligible for garbage collection when line 14 is reached?

  1. Two objects are eligible for GC

  2. Five objects were created

  3. Four objects were created.

  4. Three objects are eligible for GC

Answer: 1,2

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

Answer: 3
+ View questions