Interview questiosn

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

equals compare two objects and it depends if the method has been override, instead == compare two reference of the objects.

Equals vs ==

Java messaging services, API is a Java Message Oriented Middleware API for sending messages between two or more clients.

What is JMS

Web Services Description Language, Information that is needed to be asked to provider to access web service(SOAP)

What is WSDL?

A "Spring Bean" is simply a Java object. When Java objects are created by the Spring Container, then Spring refers to them as "Spring Beans". Spring Beans are created from normal Java classes .... just like Java objects.

What is a Spring Bean?

Static block is used for initializing the static variables. This block gets executed when the class is loaded in the memory. A class can have multiple Static blocks, which will execute in the same sequence in which they have been written into the program.

What is a Static block?

It is a thread-safe object and it is used by all the threads of an application. I need to create on session factory for each database using separate configuration file.

What is a session factory?

It is a physical connection with the database. It is designed to be instantiated each time an interaction is needed with the database. A session object should not keep open for long time, because it is not thread safe, use should create and destroy it as needed.

What is a session object?

Composition is a "has-a". You do composition by having an instance of another class C as a field of your class, instead of extending C .

What is composition?

teams produce software in short cycles, ensuring that the software can be reliably released at any time

What is continuous deployment/delivery?

Yes we can create we have to override equals and hashcode

What is hashMap? Can we create an object as a key in hashmap?

Singleton patterns are used in logging, caches, thread pools, configuration settings, device driver objects.

What is singleton?

It is a framework and Inversion Control container for dependency injections. Spring handles the infrastructure and we can be more focus in the development of the app.

What is spring?

Belongs to the class no to the object. We can have a static field or static method, it is the same to say a global attribute or method. we don't need to instantiated the object to access to them.

What is static?

Object oriented programming languages follow all concepts belonging to OOP.Object-based language doesn't support all the features of OOPs like Polymorphism and Inheritance

What is the difference between object oriented language and object based language?

It to identify the class as entity bean, and the class should include a constructor with non-argument.

What is the propose of @Entity annotation in hibernate?

PreparedStatement interfaces define the methods and properties that enable you to send SQL or PL/SQL commands and receive data from your database.

what is the purpose of prepare statement?

6. Did you design database by yourself?

x7. JUnit,

If there is no exception return 1 if there is exception return 2 Finally block is always executed after try/catch, 3 will be returned.

you have two classes A and B return type is int and you have try (return 1) catch (return 2) and final (return 3) blocks if there is exception which what is returned if there is no exception what is returned

Yes, I have faced that, the app starting to be slow, it used to have a lot insertions and deletions, and I check the log, and I didn't find anything wrong there, so I checked the code and I discovered that implementation was made with an arrayLiat instead to use an linked list, so I update the code to linked list and after that the app was faster. Queue

1. Have you faced performance issues in your previous projects? If so what measures you took?

I am a java developer with two years of experience with experience in the banking and educational field, and also as freelancer. I have experience in all the SDLF, analysis, coding, testing, and software trainer. I have technical experience using J2EE, Apache Tomcat, SQL, Spring, Hibernate, Maven, JSP...

13. Tell me about yourself?

Anotations define mapping without using xml

14. Can you tell me something about annotation

Hibernate

19. What ORM tools have you used?

I implmented online classes platform for the school from scratch, and after the requiriements from the staff were growing up, so research about php, I haven't used if form long time, and I learning it very fast.

2. Tell us about the most challenging experience from your last job

no, but I can lerning, I know it is a script to make more efficient the machine

3. Do you have experience with MySQL tuning

I think the most important things is stop to thinking in individual way, and think as a team, respect to each other job, and help us, trust in the people qualifications and feel proud to be part of it, the motivation is very important.

4. How did you handle challenges with in a team

Eclipe, Intellij, netbeans, Spring Tool suite

5. What IDE tools do you use?

No, I didn't but sometimes I need to implement them in code, ORM

6. Did you design database by yourself?

Dependency injection

@Autowired

Spring will automatically register that bean = bean id in xml

@Component annotation in spring

= init() - Code will be execute after constructor and after injection of dependencies

@PostConstruct

= destroy() - Code execute before to destroy the bean

@PreDestroy

Abstract to inherent fields and methods. We cannot inherent fields from interfaces and in Java 8 we can simulate multiple inheritance.

Abstract vs Interface?

@Entity, @Table, @Id, @GenerateValue, @Column

Annotations used by hibernate

It is a container, it only works with servlets, it means only with java

Apache tomcat

COnsturctor injection, setter injection, and field injection

Autowiring injections

Distribute our API with various data types.

Benefits of generics

- Faster application development - Simplifies the basic configuration and dependency management - Developer can be more focus in the application development and remove concerns about server life cycle, deployment, management - Automatic servlet mapping, - Embedded DB with DML (Data manipulation language)

Benefits of spring boot?

Open source, lightweight, layered architecture, DI and IoC

Benefits of spring?

We can create a constructor but we can not instantiate it we have to inherit it

Can we instantiate an abstract class? Can we create constructor of abstract class?

Contains the business logic and send it to the appropriate view

Controller

the same name of the class but the first letter is lower case

Default id bean @Component annotation

helper objects to create the final one

Dependency Injection

1.SOAP, A XML message protocol. REST an architecture style protocol. 2.SOAP uses WSDL for communication between consumer and provider. REST uses XML or JSON to send an receive data. 3.SOAP Invokes services by calling RPC method. REST simply calls services via URL path. 4.SOAP doesn't return a readable human result. REST is readable which is just plain XML or JSON 5.SOAP transfer is over HTTP, also uses other protocols such as SMTP, FTP, etc. REST transfer is over HTTP only 6.SOAP JavaScript can call SOAP, but is difficult to implement it. REST easy to call JavaScript 7.SOAP performance is not great compared to REST. REST much better, less cpu intensive, learner code, etc

Difference between SOAP and REST

Singleton and factory

Do you know anything about design pattern?

No its not inorder to make it thread safe you need to write the keyword volatile

Is plus class thread safe in java?

Design your domain model Configuration: security, persistence, application config load in the web.xml file, controller, service, repository, and view Starting from config -> accessing repository -> display result on JSON (Java Script Object notation)

Flow to create an spring application

Hashset, treeset, since we don't have to duplicate

For example we have a word 'Hello' how do we write it in java 'H, e, l, o' (datastructure)

private static SessionFactory factory; Session session = factory.openSession(); Transaction tx = null; tx = session.beginTransaction(); String hla = "FROM Employee E where E.id >10 ORDER BY E.firstName DESC, E.salary DESC"; Query query = session.createQuery(hql); List results = query.list();

HQL example

constructor is no longer necessary if the target bean only defines one constructor to begin with. However, if several constructors are available, at least one must be annotated to teach the container which one to use.

Is @Autowired necessary?

Query query = session.createQuery("from Person p where p.name = :fname "); query.setParameter("fname", "John"); List<Person> persons= query.list();

How would you retrieve the person with name "john" out of database using hibernate > Using HQL

The approach of outsourcing the construction and management of objects.

Inversion of Control - IoC

default and implemented methods in interfaces, functional programming (streams and lambdas)

Java 8 features

Apache Tomcant

Java aplication server

private void sortUsingJava8(List<Person> height) { Collections.sort(height, (s1, s2) -> s1.compareTo(s2)); }

Lets say you have a class called Person this class has firstname, lastname age, height, and you have List<Person> how you sort it using height

It is a design pattern where you divide the software development in three parts, Model for the business logic, View for the response, and controller.

MVC?

Set, List and Queue

Mention some interfaces in collection framework

Store/retrieve data via backend and place in into the model

Model

Json, xml

Name two format used as a method of exchanging data in webservices?

microservices and Restful

Project architectures?

Called just one time and when it is requiere, all access to the same one in memory, one instance

Scope bean -singleton

List: Control of the when insert the element and you can access to the element through an index. Instead a set doesn't include duplicate elements, the order of the elements depends of the implementation, and it doesn't have positional access

Set vs List

Spring is a framwork with IoC where I don't have the control about to instantiated objects

What is IoC - Inversion of Control?

Create and manage objects (IoC), and inject objects dependency (DI)

Spring container

Dependency of objects is injected by external entity

Spring container/ Bean Factory

JTA

Transaction manager impl in Spring + Hibernate

Display the data normally in JSP+JSTL

View

Can execute a lot of web applications, resources, requests, and it can contain a container.

Web server

It is the SQL for hibernate, we can use native SQL but we will loss the benefits of the hibernate if we don't use HQL. HQL translate to SQL.

What is HQL?

When we want to inherent fields and methods from the parent class.

When should we use abstract class?

If I want multiple inheritance and if I want to have different implementations for a common method.

When will you use interface?

package com.java2novice.algos; import java.util.HashMap; import java.util.Map; import java.util.Set; public class DuplicateCharsInString { public void findDuplicateChars(String str){ Map<Character, Integer> dupMap = new HashMap<Character, Integer>(); char[] chrs = str.toCharArray(); for(Character ch:chrs){ if(dupMap.containsKey(ch)){ dupMap.put(ch, dupMap.get(ch)+1); } else { dupMap.put(ch, 1); } } Set<Character> keys = dupMap.keySet(); for(Character ch:keys){ if(dupMap.get(ch) > 1){ System.out.println(ch+"--->"+dupMap.get(ch)); } } } public static void main(String a[]){ DuplicateCharsInString dcs = new DuplicateCharsInString(); dcs.findDuplicateChars("Java2Novice"); } }

count number of duplicate chars in a String.

Yes using the @RequestMapping we write the URI

rest services do you think we need to publish restful webservices? How?

new object for each request

scope bean prototype

Constructor injection and setter injections

types of injections

Java JDBC is a java API to connect and execute query with the database

what is JDBC?

TDD - Test-driven development is an evolutionary approach to development which combines test-first development where you write a test before you write just enough production code to fulfill that test and refactoring

what is TDD?

Continuous Integration (CI) is a development practice where developers integrate code into a shared repository frequently, preferably several times a day.

what is continuous Integration?

it is a framework. It is a ORM (object relational mapping) tool that persist data from the application model to the database. We don't need to deal anymore with data base, everything is throw objets.

what is hibernate?

Divide each part in a services, for example instead to do everything in just one app, I can divide it in different parts as user management, pay management.

what is microservices?


संबंधित स्टडी सेट्स

Types and Characteristics of Fixed Income (Debt) Securities and Methods Used to Determine Their Value

View Set

Section C: Activity-Based Costing

View Set

LUOA TEST Latin America & The Caribbean Written Questions ONLY

View Set

Science Chapter 9 Patterns in the Sky

View Set

History and Geography end of year

View Set

Chapter 10: Knowledge Management

View Set

Chapter 9,10,11 Anatomy Homework questions

View Set

Chapter 9 Extinction of Conditioned Behavior

View Set