The 'Near Hire 2017 Pretest' focuses on Java programming fundamentals, assessing knowledge in compilation, code snippets, and object lifecycle.
Rate this question:
The program will fail to compile.
The program will throw a NullPointerException when run with zero arguments.
The program will print "no arguments" when called with zero argument and "1 arguments" when called with one argument.
The program will print "no arguments" and "2 arguments" when called with zero and one arguments.
The program will print "no arguments" and "3 arguments" when called with zero and one arguments.
Rate this question:
An import statement
A field declaration
A method declaration
A package declaration
Rate this question:
Obj.destroy();
Runtime.getRuntime().gc();
Obj = null;
Obj.finalize();
Obj.name = null; as well as obj = null;
Rate this question:
DB Configuration f; return f;
Return DBConfiguration;
Return new DBConfiguration();
Return 0;
Rate this question:
Int a = b = c = 100;
Int a, b, c; a = b = c = 100;
Int a, b, c=100;
Int a=100, b, c;
Int a= 100 = b = c;
Rate this question:
I = this.i1;
I = this.i2;
This = new Test( );
This.i = 4;
This.i1 = i2;
The class will fail to compile, since the class OtherClass is used before it is defined.
There is no problem with the code.
The class will fail to compile, since the class OtherClass must be defined in a file called OtherClass.java
The class will fail to compile.
None of the above.
Rate this question:
A static method can call other non-static methods in the same class by using the 'this' keyword.
A class may contain both static and non-static variables and both static and non-static methods.
Each object of a class has its own copy of each non-static member variable.
All methods in a class are implicitly passed a 'this' parameter when called.
Rate this question:
The program will fail to compile, since the static method main is trying to call the nonstatic method func.
The program will fail to compile, since the non-static method func cannot access the static member variable ref.
The program will fail to compile, since the argument args passed to the static method main cannot be passed on to the non-static method func.
The program will fail to compile, since method func is trying to assign to the nonstatic member variable 'arguments' through the static member variable ref.
The program will compile and run successfully.
Rate this question:
Import java.lang.*;
Package p.util;
Public class MyClass{ }
Abstract class MyClass{ }
Rate this question:
Replace the method body of m2() with a ; (semi-colon).
Replace the ; at the end of m1() with a method body.
Remove abstract from m2().
Remove abstract from the class declaration.
Rate this question:
Import static x.y.*
Import static x.y.SM;
Import static x.y.SM.foo;
Import static x.y.SM.foo();
Import static x.y.SM.*;
Rate this question:
Quiz Review Timeline (Updated): Mar 21, 2024 +
Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.
Wait!
Here's an interesting quiz for you.