Interview Questions and Answers - Order By Newest This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  memory management  heap memory   heap allocation expert Related Questions What is a String Pool ? Which kind of memory is used for storing object member variables and function local variables ? Why do member variables have default values whereas local variables don't have any default value ? Difference between Stack and Heap memory ? What is OutOfMemoryError in Java? How many heaps will be there with 3 threads ? Do threads have a distinct heap ? Q842. Do you ever merge changes from one feature branch to another ? Why ? SCM
This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  SCM  Source Code Management  Configuration Control  Git  SvnRelated Questions How can you check if a String is a 10 digit number by using regular expression ? Write a program to print two digit numbers that fulfil following criteria
Summing their digits and then multiplying with 3 should result in the number
For ex - 27 , (2+7) * 3 = 27
What is the difference between GIT Commit and Push ? What is cloning in GIT ? Difference between git init and git clone ? difference between git add , git commit and git push ? What is the purpose of rebasing the branch Difference between git fetch and git pull ? How to calculate distance between 2 points using latitude longitude ? write a program for 4 digit otp generation? Q843. Is it safe to use session storage ? Javascript
Ans. Session storage can be accessed from XSS (Cross site Scripting) attacks but cookies (if set with "HttpOnly" and "Secure" flags) are more safer against these attacks. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  session storage  securityRelated Questions a. interface b. abstract class c. final class d. util classAns.d. util class
Q845. 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 MethodAns.a. Static Block
Main Method
Q846. 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
ConstructorAns.d. Static Block
Main Method
Instance Initialization Block
Constructor
Q847. 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,1Ans.a. 1,2,3
Q848. 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,1Ans.b. Order cannot be determined
Q849. 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
Q850. Which of following annotation is used to initialize objects before executing set of tests ? Reference Junit
a. @Test b. @Ignore c. @After d. @BeforeAns.d. @Before
Q851. Optional has been introduced in Java 8 to get away with which of following exception ? Reference Core Java
a. ArithmeticException b. ParseException c. NullPointerException d. FileNotFoundExceptionAns.c. NullPointerException
Q852. Which of the following methods are used by Java Garbage Collection Mechanism ? Core Java
a. final b. finally c. finalize d. All of the aboveAns.c. finalize
Q853. 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 requiredAns.b. Garbage Collection guarantees that the application will not run out of memory
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 allAns.c. Feature to not load dependencies and relationship in advance and load when required
Q855. 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 DatabaseAns.c. Less number of Database calls
Q856. 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 )
Q857. 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 )
Q858. 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 problemAns.d. There is no problem
Q859. Which of the following collections stores its elements in natural sorting order ? Core Java
a. HashMap b. LinkedHashMap c. TreeMap d. EnumMapAns.c. TreeMap
Q860. Which of following stores its elements in natural Sorting Order ? Core Java
a. AbstractSet b. HashSet c. LinkedHashSet d. TreeSetAns.d. TreeSet
Q861. What kind of thread is Garbage collection thread ? Core Java
a. Daemon Thread b. User Thread c. System Thread d. Active ThreadAns.a. Daemon Thread
Q862. Which of following are serialized ? Core Java
a. static variables b. transient variables c. instance variables d. method local variablesAns.c. instance variables
Q863. 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 ErrorAns.d. Compilation Error
Q864. Which of following memory segment is cleaned by Garbage Collection Mechanism ? Core Java
a. Stack b. Heap c. Code d. CacheAns.b. Heap
Q865. 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 2Ans.d. Either 1 or 2
Q866. Which of the following is not an Hibernate Annotation Hibernate
a. @Id b. @JoinTable c. @ManyToMany d. @AutowiredAns.d. @Autowired
Q867. Which of following is not Spring MVC annotation ? Spring
a. @Autowired b. @Controller c. @JoinColumn d. @TransactionalAns.c. @JoinColumn
Q868. Which of the following is true ? Core Java
a. throw and throws are used to throw an exception b. throw is used to throw an exception whereas throws is a declaration that the method can throw the exception c. throws is used to throw an exception whereas throw is a declaration that the method can throw the exception d. throw and throws are used to declare that an exception can be thrown by the methodAns.b. throw is used to throw an exception whereas throws is a declaration that the method can throw the exception
Q869. throws is a declaration that the ..... is expected to throw an exception ? Core Java
a. Variable b. Method c. Class d. InterfaceAns.b. Method
Q870. Which of the following collection classes store their elements as Key Value pairs ? Core Java
a. Set b. List c. Map d. QueueAns.c. Map