Interview Questions and Answers - Order By Newest Q661. What will be the output of following code ?
Base Interface
public interface BaseInterface {
int i = 4;
}
Derived Interfaces
public interface DerivedInterface1 extends BaseInterface{
int i = 5;
}
public interface DerivedInterface2 extends BaseInterface{
int i=6;
}
Implementing Class
public class Class implements DerivedInterface1,DerivedInterface2 {
int i=10;
public static void main(String[] args){
System.out.println(new Class().i);
}
}
What will be the output upon executing main and Why ? Core Java
Ans. 10 Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  interfaces  coding  code intermediate Q662. What is the difference between compilation and decompilation ? Core Java
Ans. Compilation is the process of converting Java source files to class files which can be executed by the Java runtime environment whereas Decompilation is the process of converting class files back to the Java Source code. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  compilation vs decompilation  compiler vs decompilerAns. Performance of a system doesn't solely rely on size of processor or it's communication size. It should also be compatible with other resources like memory, storage etc. Moreover it makes no sense to have 64 bit systems when there is hardly any software than can run on 64 bit system. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q664. Create a Table with 2 Columns and Insert a row into it Database
Ans. CREATE TABLE TABLE_NAME (
ID NUMBER PRIMARY KEY,
NAME VARCHAR(50) NOT NULL,
);
INSERT INTO TABLE_NAME(ID, NAME) VALUES(1, "Abc"); Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  ddl  dml  create table  insert records into table Asked in 1 Companies Q665. What is the difference between circular queue and priority queue ? Data Structures
Ans. https://qr.ae/TWK2Ok Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  circular queue  priority queue  queue  data structures  collections Q666. What are the different primitive data types in Java ? Core Java
Ans. boolean
byte
char
double
float
int
long
short
void Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  data types  primitive data types Asked in 1 Companies Basic Q667. What are the different operators in Java ? Core Java
Ans. && - AND
|| - OR
! - LOGICAL NOT Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  operators Basic Q668. Difference between save and flush in Hibernate ? Hibernate
Ans. Save is used to save the entity to the session whereas flush is to save the session content to DB. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q669. What is a fetch mode in Hibernate ? Hibernate
Ans. It specifies an association fetching strategy. It could be DEFAULT, JOIN or SELECT as following
@Fetch(FetchMode.SELECT) Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q670. Upon compiling the following class, What .class files will get created
public class OuterClass{
class InnerClass{
}
}
Core Java
Ans. OuterClass.class AND OuterClass$InnerClass.class Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  class files  compilation  compile  inner classes   nested classes Q671. Write a Program to validate an email address Core Java
Ans. public class Class{
public static void main(String[] args){
String str = "xyz@123.com";
if(!str.contains("@") && !str.contains(".") && (str.indexOf('.') < str.indexOf('@'))){
System.out.println("Not a Valid Email Address");
}
}
} Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  validate an email address  coding  code Asked in 3 Companies Q672. Difference between Singleton and Factory Design Pattern ? Design
Ans. Both are creational design patterns but singleton facilitates in creation and reuse of single object whereas Factory deals with creation of multiple objects. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  Design pattern  singleton  factory  singleton vs factory Asked in 4 Companies Q673. How to enable Cross Site scripting protection in WCS ? IBM WCS
Ans. By specifying XSiteScriptingProtection within wc-server.xml. Prohibited characters and attributes are specified within XSiteScriptingProtection to protect the application from any XSS attach. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  Cross site scripting  XSS attack  XSS  XSiteScriptingProtection  wc-server.xml Q674. What is an Attribute Dictionary and What are its benefits ? IBM WCS
Ans. Attribute dictionary is a set of common attributes that can be reused by multiple products.
The attribute dictionary provides a central place to manage shared attributes, with the following features:
The ability to standardize attributes.
The ability to easily compare attributes shared by products and SKUs.
The ability to quickly change attributes in one place to affect all catalog entries. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  Attribute dictionary Q675. Describe Catalog subsystem and the tables used in WCS for managing this ? IBM WCS
Ans. The catalog subsystem or Catalog Management provides online catalog navigation, partitioning, categorization, and associations. In addition, the catalog subsystem includes support for personalized interest lists and custom catalog display pages. The catalog subsystem contains all logic and data relevant to an online catalog, including catalog groups (or categories), catalog entries, and any associations or relationships among them.
Tables used for Catalog subsystem
1. CATENTRY
2. CATENTREL Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  catalog subsystem Q676. What is the difference between && and & in Java ? Core Java
Ans. && is a Logical whereas & is a bitwise operator Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  operators  logical vs bitwise operator Q677. What are the methods to connect to database in Java ? Database
Ans. JDBC ( Java Database Connectivity ),ODBC (Open Database Connectivity), Hibernate, JPA ( Java Persistence API ), JOOQ,MyBatis Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  database connection  jdbc  ORM  Hibernate Asked in 1 Companies Frequently asked Spring interview question. Q678. What are the components of Spring framework ? Spring
Ans. Core: [Core, Bean, Context, Expression Language]
Web: [Web, Portlet, Servlet, etc]
Data Access [JMS, JDBC, etc]
AOP, Aspect Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  spring  spring framework components Asked in 12 Companies Q679. What are the core OOPs concepts ? Core Java
Ans. Abstraction, Encapsulation, Polymorphism , Composition and Inheritance Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  core oops concepts Asked in 65 Companies basic   frequent Q680. How are the concept of Association related to Composition and Inheritance ? Core Java
Ans. Composition and Inheritance are the different types of Associations for Classes.
Composition is a has-a association between classes.
Inheritance is a is-a association between classes. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  composition  object oriented programming (oops)  oops concepts  inheritance  object oriented programming (oops)  oops concepts  association  relationship between objects Q681. What is the difference between GIT Commit and Push ? GIT
Ans. Git commit commit the changes to local repository whereas Push commits the changes to Remote repository. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  GIT  Configuration Management  commit vs push Q682. What is cloning in GIT ? GIT
Ans. Cloning is the process of making a copy. It could be creating local copy of another local repository or local copy of remote repository. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  GIT  Configuration Management  GIT Cloning Q683. Name few creational design patterns ? Design
Ans. Factory,Abstract Factory,Singleton,Prototype and Builder Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  Design Pattrns  Creational Design Patterns Intermediate Q684. Name few structural Design Patterns ? Design
Ans. Adapter,Bridge,Composite,Decorator,Facade,Flyweight,Proxy Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  Design Patterns  Structural Design Patterns Intermediate Q685. Name few Behavioral Design Patterns ? Design
Ans. Interpreter,Chain of Responsibility,Command,Iterator,Observer,Mediator,Memento Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  Behavioral Design Patterns Intermediate Q686. Which is your favorite Design pattern, each in Creational , Structural and Behavioral and Why ? Design
Ans. [Open Ended Answer] Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  Design Patterns Intermediate Q687. What is Exception Wrapping ?
Ans. Exception wrapping is wrapping an exception object within another exception object and then throwing the outer exception. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  exception handling  exception wrapping  exceptions intermediate   rare Q688. Where do you see yourself in next 5 years? General
Ans. Sample Answers -
Getting better with upcoming technologies and be a Lead developer.
In accordance with the company, working as a permenant employee.
Be an associate architect.
Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 2 Companies Q689. Can we have 2 entity fields mapped to the same column in Hibernate ? Hibernate
Ans. No, it's not legal in hibernate. 1 column should be mapped to only one field in entity. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q690. If we would like to load just the mapping id for the mapped entity, how can we accomplish that.
For example -
Employee entity is mapped to department entity through department id. We want that when we load employee.getDepartment().getDepartmentId(), it shouldn't load the complete department object but just the Id. Hibernate
Ans. We can use
@AccessType("property") for getDepartmentId() method within Department class in that case. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve