Java - Advance & Core Java Interview Question and Answers | Search Java Coding Interview Question - javasearch.buggybread.com
Javasearch.buggybread.com
Share

Search Java Interview Questions


 2137 questions in repository.
 There are more than 200 unanswered questions.
Click here and help us by providing the answer.
Label / Company      Label / Company / Text

   



Interview Question and Answers - 2137 question(s) found - Order By Newest

next 100

More than 2000 results found, Please refine your Search by either doing the exact search and/or specifying the framework or framework group.

 Q2004. When String literals are compared using ==, they always returns true if the string values are same because .. Core Java
a. of overridden compareTo method
b. of overridden compare method
c. of String Pool
d. == means that the object contents are equal

Ans.c. of String Pool

 Q2005. Which of the following is true ?Core Java
a. Composition is Tightly Bound
b. Inheritance is Tightly Bound
c. Object can only hold reference of only one other object
d. A Class cannot be extended by multiple classes

Ans.b. Inheritance is Tightly Bound

 Q2006. In case of String Literals ..Core Java
a. x==y on all literals always returns false
b. x.equals(y) on all literals always returns false
c. if x.equals(y) returns true, x==y returns true too
d. if x.equals(y) returns false, x==y returns true

Ans.c. if x.equals(y) returns true, x==y returns true too

 Q2007. What is a default constructor ?Core Java
a. Constructor without parameters declared by user
b. Constructor provided by Java if no constructor is declared
c. Constructor with empty body
d. All of the above

Ans.b. Constructor provided by Java if no constructor is declared

 Q2008. How can we create objects if we make the constructor private ?Core Java
a. We can't create objects if constructor is private
b. We can only create objects if we follow singleton pattern
c. We can only create one object
d. We can create new object through static method or static block

Ans.d. We can create new object through static method or static block

 Q2009. What will be the output of following ?

String str1 = new String("String1");
String str2 = new String("String1");
System.out.print(str1 == str2);
System.out.print(str1.equals(str2));
str1 = str2;
System.out.print(str1 == str2);
Core Java
a. falsetruetrue
b. truetruetrue
c. truetruefalse
d. falsetruefalse

Ans.a. falsetruetrue

 Q2010. What will be the output of following code ?

String str1 = "String1";
String str2 = "String1";
System.out.print(str1 == str2);
System.out.print(str1.equals(str2));
str1 = str2;
System.out.print(str1 == str2);
Core Java
a. falsetruetrue
b. falsefalsetrue
c. truetruetrue
d. falsefalsefalse

Ans.c. truetruetrue

 Q2011. What will be the output of following code ?

String str1 = "String1";
String str2 = "String2";
str1.concat("String3");
System.out.print(str1);
System.out.print(str2);
Core Java
a. String1String2
b. String1String3String3
c. String1String3String1String3
d. String1String1

Ans.a. String1String2

 Q2012. What will be the output of following code ?

String str1 = "String1";
String str2 = "String2";
str1=str1.concat("String3");
System.out.print(str1);
System.out.print(str2);
Core Java
a. String1String2
b. String1String3String2
c. String1String2String3
d. String1Stringg3String1

Ans.b. String1String3String2

 Q2013. Which method needs to be implemented if a class is implementing comparable interface ?Core Java
a. comp
b. compare
c. compareTo
d. compareEquals

Ans.c. compareTo

 Q2014. Which of the following is false ?Core Java
a. A Class cannot override both hashcode and equals method.
b. A class can override both hashcode and equals method.
c. A Class must override hashCode method if its overridding equal method.
d. A Class can override hashCode even if its not overridding equals method.

Ans.a. A Class cannot override both hashcode and equals method.

 Q2015. Collections is a / an ..Core Java
a. interface
b. abstract class
c. final class
d. util class

Ans.d. util class

 Q2016. Which of the following can throw ClassCastException ?Core Java
a. UpCasting
b. DownCasting
c. Casting to incompatible data type
d. Casting to Strings

Ans.b. DownCasting

 Q2017. Which of the following can be overridden ?Core Java
a. final instance methods
b. final static methods
c. non final instance methods
d. non final static methods

Ans.c. non final instance methods

 Q2018. x instanceOf y returns false ..Core Java
a. if x is an instance of y class
b. if x is an instance of class implementing y interface
c. if x is an instance of class extending y class
d. if x is an instance of Class which is a parent of Y class

Ans.d. if x is an instance of Class which is a parent of Y class

 Q2019. notify(), notifyAll(), wait() are found in which classCore Java
a. java.lang.Object
b. java.lang.Thread
c. java.lang.Runnable
d. java.lang.Implement

Ans.a. java.lang.Object

 Q2020. if classes B and C extends Class A, Which of the following initialization is correct ?Core Java
a. B b = new C();
b. C c = new B();
c. B b = new A();
d. A a = new B();

Ans.d. A a = new B();

 Q2021. If X implements Y and Y extends Z, Which of the following initialization is correct ?Core Java
a. X x = new Y();
b. X x = new Z();
c. Z z = new Y();
d. Z z = new X();

Ans.d. Z z = new X();

 Q2022. If class A implements X interface, and Class B implements Y interface, and X is the parent of Y, Which of the following initialization is correct ?Core Java
a. A a = new B();
b. Y y = new A();
c. X x = new B();
d. Y y = new A();

Ans.c. X x = new B();

 Q2023. What will be the output of executing following class ?

public class BuggyBread {

static {
System.out.println("Static Block");
}

{
System.out.println("Initialization Block");
}

BuggyBread(){
System.out.println("Constructor");
}

public static void main(String[] args){
System.out.println("Main Method");
}
}
Core Java
a. Static Block
Main Method
b. Static Block
Instance Initialization Block
Main Method
c. Static Block
Constructor
Main Method
d. Static Block
Instance Initialization Block
Constructor
Main Method

Ans.a. Static Block
Main Method

 Q2024. What will be the output upon executing following class ?

public class BuggyBread {

static {
System.out.println("Static Block");
}

{
System.out.println("Instance Initialization Block");
}

BuggyBread(){
System.out.println("Constructor");
}

public static void main(String[] args){
System.out.println("Main Method");
new BuggyBread();
}
}
Core Java
a. Instance Initialization Block
Constructor
Static Block
Main Method
b. Static Block
Instance Initialization Block
Constructor
Main Method
c. Main Method
Static Block
Instance Initialization Block
Constructor
d. Static Block
Main Method
Instance Initialization Block
Constructor

Ans.d. Static Block
Main Method
Instance Initialization Block
Constructor

 Q2025. With the following code, Which is a valid way to initialize ?
public class BuggyBread {

   private String element1;

   private String element2;

   private BuggyBread(String element1, String element2){
      this.element1 = element1;
      this.element2 = element2;
   }

   public static class Builder {
   
      private String element1;

      private String element2;

      Builder(BuggyBread buggybread){
         element1 = buggybread.element1;
         element2 = buggybread.element2;
      }

      Builder withElement1(String element1){
         this.element1 = element1;
         return this;
      }

      Builder withElement2(String element2){
         this.element2 = element2;
         return this;
      }

      BuggyBread build(){
         BuggyBread buggybread = new BuggyBread(element1,element2);
         return buggybread;
      }
   }
}
Core Java
a. BuggyBread buggybread = new BuggyBread();
b. BuggyBread buggybread = new BuggyBread("element1","element2");
c. BuggyBread.Builder builder = new BuggyBread.Builder();
d. BuggyBread.Builder builder = new BuggyBread.Builder("element1","element2");

Ans.d. BuggyBread.Builder builder = new BuggyBread.Builder("element1","element2");

 Q2026. What will be the output of following code ?

public class BuggyBread {
   
   private int x;
   private int y;
   
   BuggyBread(int x,int y){};
   
   public static void main(String[] args){
      BuggyBread buggybread = new BuggyBread();
      System.out.println(buggybread.x);
   }
}
Core Java
a. 0
b. null
c. compilation error due to uninitialized element
d. compilation error due to constructor

Ans.d. compilation error due to constructor

 Q2027. What will be the output of following ?

public class BuggyBread {

   private int x;
   private Integer y;

   BuggyBread(int x,int y){};

   public static void main(String[] args){
      BuggyBread buggybread = new BuggyBread(1,2);
      System.out.println(buggybread.x);
      System.out.println(buggybread.y);
   }
}
Core Java
a. 0 0
b. 0 null
c. null 0
d. null null

Ans.b. 0 null

 Q2028. What will be the output of following code ?

public class BuggyBread {

   private int x;
   private Integer y;

   private BuggyBread(int x,int y){};

   public static void main(String[] args){
      BuggyBread buggybread = new BuggyBread(1,2);
      System.out.println(buggybread.x);
   }
}
Core Java
a. compilation error due to private constructor
b. compilation error due to uninitialized elements
c. 0 null
d. 0 0

Ans.c. 0 null

 Q2029. What will be the output of following code ?

public class BuggyBread {

   private int x;

   private BuggyBread(int x){
      x = x;
   };

   public static void main(String[] args){
      BuggyBread buggybread = new BuggyBread(5);
      System.out.println(buggybread.x);
   }
}
Core Java
a. compilation error
b. undefined
c. 0
d. 5

Ans.c. 0

 Q2030. What will be the output of exceuting main method ?

public static void main(String[] args){
      List list = new ArrayList();
      list.add(1);
      list.add(2);
      list.add(3);
      System.out.println(list);
   }
Core Java
a. 1,2,3
b. Order cannot be determined
c. compilation error
d. 3,2,1

Ans.a. 1,2,3

 Q2031. What will be the output upon executing main method ?

public static void main(String[] args){
      Set set = new HashSet();
      set.add(1);
      set.add(2);
      set.add(3);
      System.out.println(set);
   }
Core Java
a. 1,2,3
b. Order cannot be determined
c. Compilation error
d. 3,2,1

Ans.b. Order cannot be determined

 Q2032. What will be the ouput upon executing main method ?

public class Vehicle {
   public void move(){
      System.out.println("Vehicle is moving");
   }
}

public class Car {
   public void move(){
      super().move();
      System.out.println("Car is moving");
   }

   public static void main(String[] args){
      new Car().move();
   }
}
Core Java
a. Vehicle is moving
b. Car is moving
c. Vehicle is moving Car is moving
d. Compilation Error

Ans.d. Compilation Error

 Q2033. What will be the output upon exceuting main method ?

public class Vehicle {
   private void move(){
      System.out.println("Vehicle is moving");
   }
}

public class Car extends Vehicle{
   public void move(){
      System.out.println("Car is moving");
   }

   public static void main(String[] args){
      Vehicle vehicle = new Car();
      vehicle.move();
   }
}
Core Java
a. Vehicle is moving
b. Car is moving
c. Vehicle is moving Car is moving
d. Compilation error

Ans.d. Compilation error

 Q2034. What will be the output upon executing the main method ?

public class Vehicle {
   public void move(){
      System.out.println("Vehicle is moving");
   }
}

public class Car extends Vehicle{
   public void move(){
      System.out.println("Car is moving");
   }

   public static void main(String[] args){
      Vehicle vehicle = new Vehicle();
      ((Car)vehicle).move();
   }
}
Core Java
a. Vehicle is moving
b. Car is moving
c. Cimpilation Error
d. Runtime Exception

Ans.d. Runtime Exception

 Q2035. Which of the following is not the dependency scope in Maven ?Maven
a. Compile
b. Runtime
c. Debug
d. Test

Ans.c. Debug

 Q2036. Which of the following is true for == operator ?Core Java
a. For primitives, == checks if the variables on left and right have same data type
b. For primitives, == checks if the variables on left and right have same value
c. For Objects, == checks if the references on left and right have same data type
d. For Objects, == checks if the references on left and right have same value

Ans.b. For primitives, == checks if the variables on left and right have same value

 Q2037. Which of following uniquely identify the artifact or dependency in Maven ?Maven
a. Artifact Id
b. Group Id
c. Version
d. All of the above

Ans.d. All of the above

 Q2038. Which of following is not type of Maven Repository ?Maven
a. Local
b. Remote
c. Central
d. State

Ans.d. State

 Q2039. Which of the following is equivalent to following logic ?

Not X && Not Y
Core Java
a. x || Y
b. Not(X || Y)
c. Not(X && Y)
d. Not X && Y

Ans.b. Not(X || Y)

 Q2040. Which of the following http response means the resource is not found ?Java EE
a. 500
b. 200
c. 404
d. 400

Ans.c. 404

 Q2041. What is Dirty Read in Database Transactions ?Database
a. Data Read by Transaction 2 which hasn't yet updated by Transaction 1
b. Data Read by Transaction 2 which has been updated and commited by Transaction 1
c. Data Read by Transaction 2 which has been updated but not commited by Transaction 1
d. Inability of Transaction 2 to read Data when Transaction 1 is updating.

Ans.c. Data Read by Transaction 2 which has been updated but not commited by Transaction 1

 Q2042. Which of following annotation is used to initialize objects before executing set of tests ?Junit
a. @Test
b. @Ignore
c. @After
d. @Before

Ans.d. @Before

 Q2043. Optional has been introduced in Java 8 to get away with which of following exception ?Core Java
a. ArithmeticException
b. ParseException
c. NullPointerException
d. FileNotFoundException

Ans.c. NullPointerException

 Q2044. Which of the following is not true for abstract classes ?Core Java
a. Abstract Class is only meant to be sub classed and not supposed to be instantiated.
b. Abstract class handlers can be used to handle derived class objects.
c. We can't have an abstract class without abstract methods.
d. Abstract class has member elements.

Ans.c. We can't have an abstract class without abstract methods.

 Q2045. Which of the following is not true for static keyword ?Core Java
a. Static members are shared by all objects of the class.
b. We can override static methods.
c. Static methods operate on static variables only.
d. Static Elements are accessed using class name.

Ans.b. We can override static methods.

 Q2046. Which of the following class creates immutable objects ?Core Java
a. String
b. StringBuffer
c. StringBuilder
d. None of these create immutable objects.

Ans.a. String

 Q2047. Which of the following class is synchronized ?Core Java
a. String
b. StringBuffer
c. StringBuilder
d. None of these

Ans.b. StringBuffer

 Q2048. Which of the following methods are used by Java Garbage Collection Mechanism ?Core Java
a. final
b. finally
c. finalize
d. All of the above

Ans.c. finalize

 Q2049. Which of the following about Garbage collection is false ?Core Java
a. We can call Garbage collection explicitly
b. Garbage Collection guarantees that the application will not run out of memory
c. finalize method is used by Java for Garbage Collection
d. Garbage Collection Mechanism delete unclaimed objects that are no longer required

Ans.b. Garbage Collection guarantees that the application will not run out of memory

 Q2050. What is Lazy Initialization in Hibernate ?Hibernate
a. Feature to load the dependencies from Cache
b. Feature to load all objects and relationships in advance before they can be used
c. Feature to not load dependencies and relationship in advance and load when required
d. Feature to not load the dependencies and relationships at all

Ans.c. Feature to not load dependencies and relationship in advance and load when required

 Q2051. Which of the following is not the benefit of Lazy Initialization in Hibernate ?Hibernate
a. Laod When required provides better performance
b. Object stays lighter
c. Less number of Database calls
d. Less load on Database

Ans.c. Less number of Database calls

 Q2052. Which of the following is not an advantage of JSON over XML ?JSON
a. Lighter and Faster
b. Object Representation
c. Supports multiple data types
d. Backward compatible with all XML applications

Ans.d. Backward compatible with all XML applications

 Q2053. JSON is a ..JSON
a. Programming Language
b. Markup Language
c. Scripting Language
d. Database Language

Ans.b. Markup Language

 Q2054. Binary Search requires that the collection should beAlgorithm
a. Sorted in Ascending Order
b. Sorted in Descending Order
c. Sorted in any Order
d. Unsorted

Ans.c. Sorted in any Order

 Q2055. Which of the following can be declared abstract ?Core Java
a. static methods
b. instance methods
c. static variable
d. instance variables

Ans.b. instance methods

 Q2056. Which of the following class types in MVC should have Business Logic ?Design
a. Model
b. View
c. Controller
d. JSP

Ans.a. Model

 Q2057. Which of the following web status code means "Resource not found" ? Java EE
a. 500
b. 200
c. 401
d. 404

Ans.d. 404

 Q2058. What is the relationship between Vehicle and Engine in this example ?

public class Vehicle {
   Enginer engine;
   public void move(){
      engine = new Engine();
      engine.start();
   }
}
Core Java
a. Composition ( Vehicle has a Engine )
b. Composition ( Engine has a Vehicle )
c. Inheritance ( Vehicle is a Engine )
d. Inheritance ( Engine is a Vehicle )

Ans.a. Composition ( Vehicle has a Engine )

 Q2059. What is the relationship between Car and Vehicle in the following code ?

public class Car extends Vehicle{
   Engine engine;   
   
   public static void main(String[] args){
      Vehicle vehicle = new Car();
      car.move();
   }   

   public void move(){
      engine = new Engine();
      engine.start();
   }
}
Core Java
a. Composition ( Vehicle has a Car )
b. Composition ( Car has a Vehicle )
c. Inheritance ( Vehicle is a Car )
d. Inheritance ( Car is a Vehicle )

Ans.d. Inheritance ( Car is a Vehicle )

 Q2060. What is the problem with the following code ?

public class Car extends Vehicle{
   Vehicle vehicle;
   
   Car(){
      super();
      this.vehicle = new Vehicle();
   }
}
Core Java
a. There is an Inheritance as well as Composition relationship between Vehicle and Car which is not permitted
b. We cannot initialize the parent class instance within the constructor
c. Call to super is illegal
d. There is no problem

Ans.d. There is no problem

 Q2061. What is the problem with this code ?

public class Car extends Vehicle{   
   int x;
   
   Car(int y){
      x = 5;
   }
   
   Car(){
      this(5);
      super();
   }
}
Core Java
a. We cannot overload constructors
b. Constructors should have type
c. we should have called super() before this(5)
d. We cannot have both super() and this() in a constructor

Ans.d. We cannot have both super() and this() in a constructor

 Q2062. What is the problem with this code ?

public class Car extends Vehicle{
   int x;

   Car(int y){
      x = 5;
   }

   Car(){
      super();
      this.x = 5;
   }
}
Core Java
a. We cannot overload constructors
b. We cannot call super in overloaded constructor
c. we cannot have this and super in constructor
d. There is no problem

Ans.d. There is no problem

 Q2063. The following code is an example of

public class Car extends Vehicle{
   int x;

   Car(int y){
      x = 5;
   }

   Car(){
      this(5);
   }
}
Core Java
a. Constructor Overloading
b. Constructor Chaining
c. Both Constructor Overloading and Chaining
d. None of above

Ans.c. Both Constructor Overloading and Chaining

 Q2064. What is the problem with following code ?

public class Car extends Vehicle{
   int x;

   void Car(int y){
      x = 5;
   }

   void Car(){
      this(5);
   }
}
Core Java
a. We cannot use this() within normal method
b. We cannot chain methods
c. We cannot overload constructors
d. We cannot use return type void with overloaded methods

Ans.a. We cannot use this() within normal method

 Q2065. How to append the output of a command to file Unix
a. command < file
b. command > file
c. command <> file
d. command >> file

Ans.d. command >> file

 Q2066. Which command helps you know in which folder you currently are ?Unix
a. cat
b. pwd
c. vi
d. who am i

Ans.b. pwd

 Q2067. What is the command to move to your home directory ?Unix
a. cd
b. cd..
c. cd home
d. cd .

Ans.a. cd

 Q2068. Which Database feature assist in ACID capabilities ?Core Java
a. Indexes
b. Stored Procedures
c. Locking
d. Cursors

Ans.c. Locking

 Q2069. The use of volatile keyword facilitates ..Core Java
a. Making Use of Cache for better Performance
b. Avoiding use of Cache
c. Making use of Backward as well as Forward Cache
d. Keeping only one copy of variable in Cache

Ans.b. Avoiding use of Cache

 Q2070. Function variables are kept in ..Core Java
a. Stack
b. Heap
c. Both Stack and Heap
d. None of them

Ans.a. Stack

 Q2071. Which of the following is a Marker Interface ?Core Java
a. Runnable
b. Serializable
c. Cloneable
d. Both Serializable and Cloneable

Ans.d. Both Serializable and Cloneable

 Q2072. Static Polymorphic in Java is achieved through .. Core Java
a. Method Overloading
b. Method Overriding
c. Variable Overloading
d. Variable Overriding

Ans.a. Method Overloading

 Q2073. Runtime Polymorphism in Java is achieved through ..Core Java
a. Method Overloading
b. Method Overriding
c. Variable Overloading
d. Variable Overriding

Ans.b. Method Overriding

 Q2074. Which of the following collections stores its elements in natural sorting order ?Core Java
a. HashMap
b. LinkedHashMap
c. TreeMap
d. EnumMap

Ans.c. TreeMap

 Q2075. Which of following stores its elements in natural Sorting Order ?Core Java
a. AbstractSet
b. HashSet
c. LinkedHashSet
d. TreeSet

Ans.d. TreeSet

 Q2076. Thread thats executed before the JVM exits is called ..Core Java
a. final thread
b. finally thread
c. daemon thread
d. shutdown hook

Ans.d. shutdown hook

 Q2077. What kind of thread is Garbage collection thread ?Core Java
a. Daemon Thread
b. User Thread
c. System Thread
d. Active Thread

Ans.a. Daemon Thread

 Q2078. Which of following is Daemon Thread ?Core Java
a. Thread Scheduler
b. Daemon Thread
c. Both of above
d. None of above

Ans.c. Both of above

 Q2079. Which of following can be nested into another ?Core Java
a. class within another class
b. class within interface
c. interface within class
d. All of above

Ans.d. All of above

 Q2080. Which of following are serialized ?Core Java
a. static variables
b. transient variables
c. instance variables
d. method local variables

Ans.c. instance variables

 Q2081. In which case finally won't get executed ?Core Java
a. in case of exception
b. in case of normal execution
c. in case of return statement before end of try block
d. in case of force program termination

Ans.d. in case of force program termination

 Q2082. Which Java version introduced Lambda expressions ?Core Java
a. Java 5
b. Java 7
c. Java 8
d. Java 9

Ans.c. Java 8

 Q2083. Which of following is not the method of object class ?Core Java
a. run
b. notify
c. wait
d. clone

Ans.a. run

 Q2084. Which of following is not true ?XML
a. Dom Parser loads the whole doument at once in memory
b. A DOM Parser is much more memory efficient
c. Dom Parser doesn't load the whole doument at once in memory
d. A SAX Parser is much more memory efficient

Ans.b. A DOM Parser is much more memory efficient

 Q2085. Which of the following file is called deployment descriptor ?Java EE
a. application.xml
b. web.xml
c. config.xml
d. web-application.xml

Ans.b. web.xml

 Q2086. Which of the following is not true ?Core Java
a. A Java class can extend multiple classes
b. A Java class can implement multiple interfaces
c. A Java interface can extend multiple interfaces
d. All of above are true

Ans.a. A Java class can extend multiple classes

 Q2087. Which of following class types in MVC holds Business logic ?Java EE
a. Model
b. View
c. Controller
d. Accessor

Ans.a. Model

 Q2088. Which memory segment holds String Pool ?Core Java
a. Stack
b. Heap
c. Code Segment
d. Class Segment

Ans.b. Heap

 Q2089. In this code

public class BuggyBread1{
   private static String staticVariable = "static Variable";
   
   private String instanceVariable = "instance Variable";
   
   public static void main (String args[]) {
String localVariable = "local Variable";
}
}

Where will the value 'static Variable' be stored ?
Core Java
a. Stack Memory Segment
b. Heap Memory Segment
c. Runtime Constant Pool within Heap Segment
d. Code Segment

Ans.c. Runtime Constant Pool within Heap Segment

 Q2090. In this code

public class BuggyBread1{
   private static String staticVariable = "static Variable";
   
   private String instanceVariable = "instance Variable";
   
   public static void main (String args[]) {
String localVariable = "local Variable";
}
}

Where will the value 'static Variable' be stored ?
Core Java
a. Stack Memory Segment
b. Heap Memory Segment
c. Runtime Constant Pool within Heap Segment
d. Code Segment

Ans.c. Runtime Constant Pool within Heap Segment

 Q2091. In this code

public class BuggyBread1{
   private static String staticVariable = "static Variable";
   
   private String instanceVariable = "instance Variable";
   
   public static void main (String args[]) {
String localVariable = new String("local Variable");
}
}

Where will the value 'local Variable' be stored ?
Core Java
a. Stack Memory Segment
b. Heap Memory Segment
c. Runtime Constant Pool within Heap Segment
d. Code Segment

Ans.a. Stack Memory Segment

 Q2092. In this code

public class BuggyBread1{
   private static String staticVariable = new String("static Variable");
   
   private String instanceVariable = "instance Variable";
   
   public static void main (String args[]) {
String localVariable = "local Variable";
}
}

Where will the value 'static Variable' be stored ?
Core Java
a. Stack Memory Segment
b. Heap Memory Segment
c. Runtime Constant Pool within Heap Segment
d. Code Segment

Ans.b. Heap Memory Segment

 Q2093. What will be the output of this code

ArrayList list = new LinkedList();
list.add(3);
list.add(2);
list.add(1);
System.out.println(list);
Core Java
a. 1,2,3
b. 3,2,1
c. Order cannot be determined
d. Compilation Error

Ans.d. Compilation Error

 Q2094. Which of following keyword is not allowed for Outer Class ?Core Java
a. public
b. private
c. abstract
d. final

Ans.b. private

 Q2095. Which of following memory segment is cleaned by Garbage Collection Mechanism ?Core Java
a. Stack
b. Heap
c. Code
d. Cache

Ans.b. Heap

 Q2096. Default Constructor is provided by Java , if ..Core Java
a. No constructor is provided by coder
b. No argument constructor is not provided by Coder
c. No Constructor is provided by coder initializing fields to null and primitive default values
d. No argument constructor is provided by coder

Ans.a. No constructor is provided by coder

 Q2097. Default Constructor is provided by Java ... Core Java
a. To Reserve Memory
b. To provide at least one instance method
c. To Make it look good
d. To initialize the object state

Ans.d. To initialize the object state

 Q2098. Which of following is an application server ?Server
a. Tomcat
b. MySql
c. Oracle
d. All of above

Ans.a. Tomcat

 Q2099. Which of the following wildcard is used to import multiple packages at once ?Core Java
a. .
b. ?
c. *
d. &

Ans.c. *

 Q2100. In Case a method is declared to throw an exception , We can only use a call to that method if ...Core Java
a. We use the call within try block and catch the exception
b. We declare that the method is expected to throw the exception using throws
c. Both 1 and 2
d. Either 1 or 2

Ans.d. Either 1 or 2

 Q2101. Which of the following Java feature specify hash-a relationship between objects ?Core Java
a. Inheritance
b. Composition
c. Polyorphism
d. Encapsulation

Ans.b. Composition

 Q2102. Which of the following keyword restrict the class from being extended ?Core Java
a. Private
b. Abstract
c. Final
d. Static

Ans.c. Final

 Q2103. Which of the following keyword restrict the class from being instantiated ?Core Java
a. Private
b. Abstract
c. Final
d. Static

Ans.b. Abstract

next 100


Subscribe to Java News and Posts. Get latest updates and posts on Java from Buggybread.com
Enter your email address:
Delivered by FeedBurner



comments powered by Disqus
 

Help us and Others Improve. Please let us know the questions asked in any of your previous interview.

Any input from you will be highly appreciated and It will unlock the application for 10 more requests.

Company Name:
Questions Asked:
         

X Close this

Redis: Its not a database but a kind ... Amit

Cassandra: Frequently used these days. Apt for storing ... Anonymous

Spring Boot: Though there is bit of learning curve ... Amit

Bank Of America: what value will be printed if A ... Anonymous

ZipRecruiter: It used to be good many years ... Anonymous

CareerBuilder: Carrier Builder is user friendly and you ... Anonymous

StackOverflow Jobs: I like stackoverflow and linkedin specifically for ... James

X Close this

Help Us Improve.
Please share your
interview experience.

Company Name:   


Questions Asked: