Tag: programming languages

Questions Related to programming languages

  1. Can have only one constructor

  2. a.Cannot have a constructor

  3. Can have more than one constructor

  4. May or May not have constructors


Correct Option: B

The following code creates one array and one string object. which object is eligible for garbage collection after the code executes? ... String[] students = new String[10]; String studentName = "Peter Parker"; students[0] = studentName; studentName = null; ...

  1. Array Object

  2. Neither Object

  3. String Objec

  4. Both of the Objects


Correct Option: B
  1. More than one Object

  2. No Objects

  3. Only One Objects.

  4. Two Objects.


Correct Option: C

Identify the following. x. public final String getDetails(final File file, final String key) throws IOException y. getDetails(File, String)

  1. X is a method Signature and Y is a method Header

  2. Both X and Y is a method Header

  3. X is a method Header and Y is a method Signature

  4. Both X and Y is a method Signature


Correct Option: C

Static nested classes do not have access to

  1. Its non-static members

  2. Static members of the enclosing class

  3. Its Static members

  4. Non-Static members of the enclosing class


Correct Option: D
  1. Reading data through key board

  2. Using system properties and environment variables

  3. Running non-java programs from within a java application.

  4. All of the Above

  5. None of the Above


Correct Option: D
  1. They can be applied to both data & methods

  2. They must precede a class's data variables or methods

  3. They can follow a class's data variables or methods

  4. They can appear in any order

  5. They must be applied to data variables first and then to methods


Correct Option: A,B,D
  1. Public

  2. Private

  3. Abstract

  4. Final

  5. Protected


Correct Option: A,C,D
  1. Compile failure

  2. sucessfully compiled, but through exception in run time

  3. It runs sucessfuly and prints "without the main method"

  4. It runs sucessfuly, but No output.


Correct Option: C

Class C { public static void main(String[] args) { int[]a1[]=new int[3][3]; //3 int a2[4]={3,4,5,6}; //4 int a2[5]; //5 } } What is the result of attempting to compile and run the program ?

  1. compiletime error at lines 3,4,5

  2. compiltime error at line 4,5

  3. compiletime error at line 3

  4. Runtime Exception


Correct Option: B