Interview Questions and Answers for 'GIT' | Search Interview Question - javasearch.buggybread.com
Javasearch.buggybread.com

Search Interview Questions


 More than 3000 questions in repository.
 There are more than 900 unanswered questions.
Click here and help us by providing the answer.
 Have a video suggestion.
Click Correct / Improve and please let us know.
Label / Company      Label / Company / Text

   



Interview Questions and Answers for 'GIT' - 39 question(s) found - Order By Newest

next 30
Frequently asked to fresh graduates and less experienced developers. Among the first few questions in many interviews.
  Q1. What are the difference between composition and inheritance in Java?Core Java
Ans. Composition - has-a relationship between objects.
Inheritance - is-a relationship between classes.

Composition - Composing object holds a reference to composed objects and hence relationship is loosely bound.
Inheritance - Derived object carries the base class definition in itself and hence its tightly bound.

Composition - Used in Dependency Injection
Inheritance - Used in Runtime Polymorphism

Composition - Single class objects can be composed within multiple classes.
Inheritance - Single class can only inherit 1 Class.

Composition - Its the relationship between objects.
Inheritance - Its the relationship between classes.

  Sample Code for inheritance

  Sample Code for composition

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   java concepts   inheritance  object oriented programming (oops)  oops concepts   composition  object oriented programming (oops)  oops concepts   inheritance  object oriented programming (oops)  inheritance vs composition  object oriented programming (oops)  oops concepts     Asked in 29 Companies      basic        frequent

Try 5 Question(s) Test


  Q2. Explain OOPs

or

Explain OOPs Principles

or

Explain OOPs Concepts

or

Explain OOPs features

or

Tell me something about OOPs
Core Java
Ans. OOPs or Object Oriented Programming is a Programming model which is organized around Objects instead of processes. Instead of a process calling series of processes, this model stresses on communication between objects. Objects that all self sustained, provide security by encapsulating it's members and providing abstracted interfaces over the functions it performs. OOP's facilitate the following features

1. Inheritance for Code Reuse
2. Abstraction for modularity, maintenance and agility
3. Encapsulation for security and protection
4. Polymorphism for flexibility and interfacing

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     oops  oops features     Asked in 260 Companies      basic        frequent


Very frequently asked. Favorite question in Walk in Drive of many Indian service companies. Frequently asked in HCL Technologies, TCS and Accenture.
  Q3. What is the difference between final, finally and finalize() ?Core Java
Ans. final - constant variable, objects cannot be de-referenced, restricting method overriding, restricting class sub classing.

finally - handles exception. The finally block is optional and provides a mechanism to clean up regardless of what happens within the try block. Use the finally block to close files or to release other system resources like database connections, statements etc.

finalize() - method helps in garbage collection. A method that is invoked before an object is discarded by the garbage collector, allowing it to clean up its state.

  Sample Code for final

  Sample Code for finally

  Sample Code for finalize

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   oops   final   finally   finalize   final vs finally vs finalize     Asked in 61 Companies      basic        frequent

Try 4 Question(s) Test


Very frequently asked. Favorite question in Walk in Drive of many Indian service companies.
  Q4. What is the difference between ArrayList and LinkedList ?Core Java
Ans. Underlying data structure for ArrayList is Array whereas LinkedList is the linked list and hence have following differences -

1. ArrayList needs continuous memory locations and hence need to be moved to a bigger space if new elements are to be added to a filled array which is not required for LinkedList.

2. Removal and Insertion at specific place in ArrayList requires moving all elements and hence leads to O(n) insertions and removal whereas its constant O(1) for LinkedList.

3. Random access using index in ArrayList is faster than LinkedList which requires traversing the complete list through references.

4. Though Linear Search takes Similar Time for both, Binary Search using LinkedList requires creating new Model called Binary Search Tree which is slower but offers constant time insertion and deletion.

5. For a set of integers you want to sort using quicksort, it's probably faster to use an array; for a set of large structures you want to sort using selection sort, a linked list will be faster.

  Sample Code for ArrayList

  Sample Code for LinkedList

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     collections   java   data structures   arraylist   linkedlist   arraylist vs linkedlist     Asked in 61 Companies      Basic        frequent

Try 1 Question(s) Test


Recently asked in TCS , Tech Mahindra, HCL , Accenture and Fidelity.
  Q5. Explain Flow of Spring MVC ?Spring
Ans. The DispatcherServlet configured in web.xml file receives the request.

The DispatcherServlet finds the appropriate Controller with the help of HandlerMapping and then invokes associated Controller.

Then the Controller executes the logic business logic and then returns ModeAndView object to the DispatcherServlet.

The DispatcherServlet determines the view from the ModelAndView object.

Then the DispatcherServlet passes the model object to the View.

The View is rendered and the Dispatcher Servlet sends the output to the Servlet container.

Finally Servlet Container sends the result back to the user.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     j2ee   spring   mvc   frameworks   web applications   architecture     Asked in 11 Companies      Basic        frequent


Very frequently asked. Favorite question in Walk in Drive of many Indian service companies.
  Q6. What is a final method ?Core Java
Ans. Its a method which cannot be overridden. Compiler throws an error if we try to override a method which has been declared final in the parent class.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   oops   final   final method     Asked in 30 Companies      basic        frequent

Try 1 Question(s) Test


Very Frequently asked across all type of companies and across all levels.
  Q7. Difference between Public, Private, Default and Protected ?Core Java
Ans. Private - Not accessible outside object scope.

Public - Accessible from anywhere.

Default - Accessible from anywhere within same package.

Protected - Accessible from object and the sub class objects.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   oop   access specifier   public   private   default   protected   public vs private vs default vs protected     Asked in 12 Companies      basic        frequent

Try 1 Question(s) Test


Very frequently asked.Usually among first few questions.
  Q8. What is MVC ? Design
Ans. MVC is a Design Pattern that facilititates loose coupling by segregating responsibilities in a Web application

1. Controller receives the requests and handles overall control of the request
2. Model holds majority of the Business logic, and
3. View comprise of the view objects and GUI component

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     j2ee   mvc   mvc design pattern   design pattern   struts   spring   web application   web frameworks   ebay     Asked in 60 Companies      basic        frequent

Try 1 Question(s) Test


Frequently asked to fresh graduates and less experienced.
  Q9. Difference between Composition and Inheritance ?Core Java
Ans. Inheritance means a object inheriting reusable properties of the base class. Compositions means that an abject holds other objects.

In Inheritance there is only one object in memory ( derived object ) whereas in Composition , parent object holds references of all composed objects.

From Design perspective - Inheritance is "is a" relationship among objects whereas Composition is "has a" relationship among objects.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   oops   oops concepts   inheritance  object oriented programming (oops)  oops concepts   composition  object oriented programming (oops)  oops concepts   difference between   basic interview question     Asked in 12 Companies      basic        frequent

Try 2 Question(s) Test


Frequently asked to fresh graduates and less experienced.
 Q10. Which of the following is tightly bound ? Inheritance or Composition ?Core Java
Ans. Inheritance.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     inheritance  object oriented programming (oops)  oops concepts   java   oops   composition  object oriented programming (oops)  oops concepts     Asked in 1 Companies      basic        frequent


 Q11. What is race condition ?Operating System
Ans. A source of possible errors in parallel programming, where one thread can cause an error in another thread by changing some aspect of the state of the program that the second thread is depending on (such as the value of variable).

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java.threads   multithreading   race condition   parallel programming   synchronization   ebay   concurrency     Asked in 10 Companies


Very frequently asked in HCL Tech ( Based of 4 inputs )
  Q12. Write a program to reverse a string iteratively and recursively ?Core Java
Ans. Using String method -

new StringBuffer(str).reverse().toString();

Iterative -

public static String getReverseString(String str){
StringBuffer strBuffer = new StringBuffer(str.length);
for(int counter=str.length -1 ; counter>=0;counter--){
strBuffer.append(str.charAt(counter));
}
return strBuffer;
}

Recursive -

public static String getReverseString(String str){
if(str.length <= 1){
return str;
}
return (getReverseString(str.subString(1)) + str.charAt(0);
}

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   string   reverse   stringbuffer   string class   code     Asked in 6 Companies        frequent


 Q13. What is abstraction ?Design
Ans. Abstraction is a process of hiding the implementation details and describing only the functionality to the user.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     bstraction  oops concepts  oops principle     Asked in 22 Companies


 Q14. What is Apache Kafka ?BigData
Ans. Kafka is a distributed, partitioned, replicated commit log service. It provides the functionality of a messaging system through messages being written to logs.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     kafka   bigdata   message queue     Asked in 4 Companies


 Q15. Explain TDD or Test Driven Design ?Design
Ans. TDD is a development process that involves short iterations: first an automated test case is written. Then, the code is written to pass that test, and finally one refactors the new code to acceptable standards.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     elsevier   test driven design ( TDD )   software development methodologies     Asked in 3 Companies        frequent


 Q16. Explain Agile Software Development Methodology ?Process
Ans. https://en.wikipedia.org/wiki/Agile_software_development

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     software development process  agile     Asked in 5 Companies        frequent


  Q17. What is an exception and exception handling in Java ?Core Java
Ans. An Exception in java is the occurrence during computation that is anomalous and is not expected.

Exception handling is the mechanism which is used to handle such situations.


 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     exception handling     Asked in 18 Companies      basic        frequent


 Q18. 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


 Q19. 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


 Q20. What is a pull request ?GIT
Ans. It's a facility to shout out your code changes to other collaborators before merging them to the main repository. For example - one may like to have code changes reviewed between his branch and master before merging it to master. So he can open a pull request with the difference between branch and master, get it reviewed and then merge it to master.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     


  Q21. Explain OOps concepts.Core Java
Ans. There are four main OOP concepts in Java. These are:

Abstraction. Abstraction means using simple things to represent complexity. We all know how to turn the TV on, but we don?t need to know how it works in order to enjoy it. In Java, abstraction means simple things like objects, classes, and variables represent more complex underlying code and data. This is important because it lets avoid repeating the same work multiple times.

Encapsulation. This is the practice of keeping fields within a class private, then providing access to them via public methods. It?s a protective barrier that keeps the data and code safe within the class itself. This way, we can re-use objects like code components or variables without allowing open access to the data system-wide.

Inheritance. This is a special feature of Object Oriented Programming in Java. It lets programmers create new classes that share some of the attributes of existing classes. This lets us build on previous work without reinventing the wheel.

Polymorphism. This Java OOP concept lets programmers use the same word to mean different things in different contexts. One form of polymorphism in Java is method overloading. That?s when different meanings are implied by the code itself. The other form is method overriding. That?s when the different meanings are implied by the values of the supplied variables. See more on this below.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     oops  oops concepts     Asked in 16 Companies      basic        frequent


 Q22. How do you branch your code within SCM ?SCM
Ans. We keep a Working Branch , Release Branch and Master.

Working Branch is what we work on. We release from the release branch.

So the flow for merge is

Work Branch -> Release Branch -> Master

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     source code management  scm  svn  git  scm branching


 Q23. Do you think it's a good practice to perform releases from a branch and then merge code to the master ?SCM
Ans. We have followed this practice in one of the project. The only downside we felt was the need to merge the new snapshot version to master after the release.

The Benefit is that it's easy to just ignore the branch if complete rollback happens and hence master remains in sync with production.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     source code management  scm  svn  git  release process


 Q24. Difference between git init and git clone ?Git
Ans. "git init" creates an empty repository or can make an existing directory a git repository while "git clone" first internally calls "git init" to create an empty git repository and then copy the data from the specified remote repository.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     git init   git clone   git init vs git clone      basic


 Q25. difference between git add , git commit and git push ?
 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     git


 Q26. What is the purpose of rebasing the branchGit
 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     rebasing branch in git  git  rebasing  rebase a branch


 Q27. Difference between git fetch and git pull ?Git
Ans. git pull does a git fetch followed by a git merge. git fetch only change the remote tracking but never attempts to make changes to the local.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     git fetch vs git pull  git fetch  git pull     Asked in 1 Companies


 Q28. Explain Hibernate caching mechanismHibernate
Ans. Every fresh session having its own cache memory, Caching is a mechanism for storing the loaded objects into cache memory. The advantage of cache mechanism is, whenever again we want to load the same object from the database then instead of hitting the database once again, it loads from the local cache memory only, so that the no. of round trips between an application and a database server got decreased. It means caching mechanism increases the performance of the application.

In hibernate we have two levels of caching

First Level Cache [ or ] Session Cache
Second Level Cache [ or ] Session Factory Cache [ or ] JVM Level Cache

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve          Asked in 23 Companies


 Q29. Git Commit with commentsGit
Ans. git commit -m '<Comment>'

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     


 Q30. Difference between XSS and CSRF ?Security
Ans. SRF attack requires an authenticated session, whereas an XSS attack doesn’t.
XSS doesn’t require any user interaction.CSRF is restricted to the actions the victim can perform.
XSS requires a vulnerability to happen, whereas CSRF relies on tricking the user to click a link or access a page.
CSRF can only send an HTTP request but cannot view the response. XSS can send and receive HTTP requests and responses to extract the required data.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     xss attack  csrf attack  security vulnerabilities  security attack  web security     Asked in 3 Companies


next 30

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: