AmbitionBox
Discover Best Places to work in India
Discover best places to work
Compare & find best workplace
Bring your workplace to life
Highlight your company's perks
Read reviews for 6L+ companies
Rate your former or current company
Discover salaries for 8L+ companies
Calculate your take home salary
Check your market value
Help other jobseekers
Read interviews for 90K+ companies
Interviews questions for 1K+ colleges
Contribute your interview questions
Java Programming
Which of the following statements is false?
A. A set is a collection that does not allow duplicates.
B. A map can store duplicate values.
C. A list is a collection that is ordered by index.
D. A list is a collection that cannot have duplicates.
Which of the following statements is not true about the hashcode?
A. The hashcode values of two equal objects must be equal.
B. The hashcode values of two unequal objects must be unequal.
C. If the hashcode values of two unequal objects are always unequal, it improves the performance.
D. A function that always returns a constant is not a very efficient function.
Consider the following code fragment:
1. int i = 5;
2. printIt(i);
3. void printIt(Integer wi) {
4. int j = wi;
5. System.out.println("The value is: " + j);
6. }
What is the output of this code?
A. The value is: 5
B. Compiler error at line 3
C. Compiler error at line 2
D. Runtime error
Which of the following classes implements the java.util.List interface?
A. Java.util.HashMapTable
B. Java.util.LinkedList
C. Java.util.HashTable
D. Java.util.OrderedList
1. package RobotDrivers ;
2. import robots.*;
3. public class RobotPlayer extends FunnyRobot {
4. static int i =5;
5. public static void main(String[] args){
6. i = 6;
7. RobotPlayer rp = new RobotPlayer();
8. rp.dance();
9. }
10. }
Which of the following statements is true about this code fragment?
A. The code will compile and execute correctly and generate the output: The funny robot is dancing!.
B. There would be a compiler error at line 7 because the method dance() is protected and the classes RobotPlayer and FunnyRobot are in different packages.
C. There would be a compiler error at line 6.
D. The code will compile but generate a runtime exception.
1. class MyClass {
2. public void message (int i) {
3. public int j= i;
4. System.out.println("Value of j: " + j);
5. }
6. public static void main(String[] args) {
7. MyClass ma = new MyClass();
8. ma.message(15);
Which of the following statements is true about this code?
A. The code will compile and execute fine, and the output will be Value of j: 15
B. Line 2 will generate a compiler error.
C. The code will compile but will give an error at execution time.
D. None of the above
Which of the following statements is true?
A. The final variable may only be used with a variable or a method.
B. The final variable may not be copied to a file during object serialization.
C. The final method may not be overridden.
D. The class that has a final method may not be extended.
Which of the following statements is true about the static modifier?
A. A static variable cannot change its value.
B. A static method cannot be overridden to be non-static.
C. A static method is often overridden in a non-Java language and exists outside of JVM.
D. The static code lies outside of any class.
1. class MySuperClass {
2. static void message() {
3. System.out.println("From the super class!");
4. }
6. public class MySubClass extends MySuperClass {
7. void message() {
8. System.out.println("From the subclass!");
10. public static void main(String args[]) {
11. MySubClass mysub = new MySubClass(); 12. mysub.message();
13. }
14. }
Which of the following modifiers placed in the beginning of line 7 will make the code compile and execute without error?
A. Static
B. Public
C. Protected
D. Transient
Assume that a variable exists in a class and that the variable must not be copied into a file when the object corresponding to this class is serialized. What modifier should be used in the declaration of this variable?
A. Private
B. Protected
C. Native
Join India’s largest community to research company culture
Are you a student or working professional?
Student/Never worked
I am a student/I have never worked
Working Professional
I am working/I have worked before
What are your preferred job locations?
Popular Cities
Other Cities
Follow your preferred designations/job profiles
Suggestions based on your job profile
vs
Similar Companies