Java Programming Fundamentals
Test your knowledge of core Java concepts including arrays, strings, exceptions, collections, garbage collection, and server-side development
Questions
Java enabled portable server-side applications are
- Web services
- Enterprise JavaBeans
- Java Servlets
- All the above
What will be the output ?
- Inside TRY Inside FINALLY
- Inside TRY
- Inside TRY Inside CATCH Inside FINALLY
- None of the above
Guess the output ?
- 6
- 33
- 123
- Exception
Guess the output :
- 15
- 123
- 6
- Exception
Can inner class have static members?
- True
- False
Which one is faster in java ?
- No difference
- 1
- 2
- Cannot be determined
After the following code fragment, what is the value in a? String s; int a; s = "Foolish boy."; a = s.indexOf("fool");
- -1
- 0
- 4
- none
Given the following code fragment: int A[]; int i = 0; A = new int A[4]; while (i < 4) { A[i] = 10; i = i + 1; } What is the value of A[3]?
- 0
- 3
- 10
- Compile Error
What is the purpose of this bit of code void init() { ... } ?
- a class that initializes the applet
- A required method in an applet
- A place to declare variablesA place to declare variables
- none of the above
What is the value of k after the following code fragment? int k = 0; int n = 12 while (k < n) { k = k + 1; }
- 0
- 11
- 12
- -1
If you have reference variable of parent class type and you assign a child class object to that variable and invoke static method. Which method will be invoked? Parent/Child.
- Parent
- Child
- Both
- None of these
Can we declare derived class first and then base class in java?
- True
- False
Is Array operations are faster than Vector.
- True
- False
Final variables declared without initialization can be initialized in static initializer ( static final var) or in constructor( final var). True/False?
- True
- False
Is the following statement correct: char ch = 'd'; if(ch < 32.00){ }
- True
- False
If there is an exception in finalize method, will the object be garbage collected?
- True
- False
Which one of these statements are valid? Char \u0061r a =’a’; Char \u0062 = ’b’; Char c =’\u0063’Which one is not correct A. x = = Float.NaN B. Float.isNan(x); C. Myobject .equals(float.NaN);
- A
- B
- C
- All