Interview Questions and Answers for 'Avi' | 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 'Avi' - 15 question(s) found - Order By Rating

 Q1. What is TypeCasting ?Core Java
Ans. Assigning a value of one type to a variable of another type is known as Type Casting.

Example :

int x = 10;
byte y = (byte)x;

In Java, type casting is classified into two types, Widening Casting(Implicit) widening-type-conversion and Narrowing Casting (Explicitly done) narrowing-type-conversion.

Widening or Automatic type converion - Automatic Type casting take place when,the two types are compatible and the target type is larger than the source type

Example :

public class Test {
public static void main(String[] args) {
int i = 100;
long l = i; //no explicit type casting required
float f = l;//no explicit type casting required
System.out.println("Int value " i);
System.out.println("Long value " l);
System.out.println("Float value " f);
}
}

Narrowing or Explicit type conversion - When you are assigning a larger type value to a variable of smaller type, then you need to perform explicit type casting.

Example :

public class Test{
public static void main(String[] args) {
double d = 100.04;
long l = (long)d; //explicit type casting required
int i = (int)l;//explicit type casting required
System.out.println("Double value " d);
System.out.println("Long value " l);
System.out.println("Int value " i);
}
}

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

   Like         Discuss         Correct / Improve     typecasting  type casting     Asked in 23 Companies


 Q2. Why Java has final class ?Core Java
 This question was recently asked at 'Avis'.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     final class   final keyword     Asked in 1 Companies      basic


 Q3. How can we make objects if the constructor is private ? Core Java
 This question was recently asked at 'Nagravision'.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     constructor     Asked in 1 Companies


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


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


 Q6. Ho do you share / transfer variables between JSP pages ?Java EE
 This question was recently asked at 'UC Davis'.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     jsp     Asked in 1 Companies


 Q7. What is a class and object ?

or

How would you explain a fresher the concept of class and object in simple terms ?
Core Java
Ans. Class is a template using which objects are created in memory. It's kind of a mold using which objects with body / state are made.


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

   Like         Discuss         Correct / Improve     class  object  class vs object     Asked in 4 Companies      basic        frequent


Basic and Very Frequently asked.
  Q8. What is Polymorphism in Java ?Core Java
Ans. Polymorphism means the condition of occurring in several different forms.

Polymorphism in Java is achieved in two manners

1. Static polymorphism is the polymorphic resolution identified at compile time and is achieved through function overloading whereas

2. Dynamic polymorphism is the polymorphic resolution identified at runtime and is achieved through method overriding.

  Sample Code for overloading

  Sample Code for overriding

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

   Like         Discuss         Correct / Improve     polymorphism  object oriented programming (oops)  oops concepts  oops concepts     Asked in 108 Companies      Basic        frequent

Try 2 Question(s) Test


  Q9. What is a self Join and give an example of a self Join ?

or

What is self Join and What is it's purpose ?
Database
Ans. When a Table Join itself , it's a Self Join. For example - we like to know the pair of department names where first dept has lesser employees than the later.

Select D1.name , D2.name from Dept D1, Dept D2 where D1.employee_count < D2.employee_count

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

   Like         Discuss         Correct / Improve     sql  joins  self join  self-join  Pair of employee names with first having lesser salary than later  Pair of department names where first dept has lesser employees than the later     Asked in 26 Companies      basic        frequent


  Q10. Explain static blocks in Java ?Core Java
Ans. A static initialization block is a normal block of code enclosed in braces, { }, and preceded by the static keyword. Here is an example:

static {
// whatever code is needed for initialization goes here
}

A class can have any number of static initialization blocks, and they can appear anywhere in the class body. The runtime system guarantees that static initialization blocks are called in the order that they appear in the source code.

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

   Like         Discuss         Correct / Improve     java   oops   static   static block     Asked in 16 Companies      basic        frequent


 Q11. Difference between Factory and Strategy Design Pattern ?Design
Ans. Factory is a creational design pattern whereas Strategy is behavioral design pattern. Factory revolves around the creation of object at runtime whereas Strategy or Policy revolves around the decision at runtime.

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

   Like         Discuss         Correct / Improve     java   design pattern   factory   strategy   creational design pattern   behavioral design pattern     Asked in 1 Companies      expert


 Q12. Explain Inner Classes ?Core Java
Ans. The accessibility (public, protected, etc.) of the inner class is defined by the outer class.

Just like top-level classes, an inner class can extend a class or can implement interfaces.

Similarly, an inner class can be extended by other classes, and an inner interface can be implemented or extended by other classes or interfaces.

An inner class can be declared final or abstract.Inner classes can have inner classes, but you will have a hard time reading or understanding such complex nesting of classes.

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

   Like         Discuss         Correct / Improve     java   oops   classes   inner classes     Asked in 2 Companies      Basic        frequent

Try 2 Question(s) Test


 Q13. What are points to consider in terms of access modifier when we are overriding any method?Core Java
Ans. 1. Overriding method can not be more restrictive than the overridden method.

reason : in case of polymorphism , at object creation jvm look for actual runtime object. jvm does not look for reference type and while calling methods it look for overridden method.

If by means subclass were allowed to change the access modifier on the overriding method, then suddenly at runtime when the JVM invokes the true objects version of the method rather than the reference types version then it will be problematic

2. In case of subclass and superclass define in different package, we can override only those method which have public or protected access.

3. We can not override any private method because private methods can not be inherited and if method can not be inherited then method can not be overridden.

  Sample Code for Overriding

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

   Like         Discuss         Correct / Improve     java   overriding   access specifier   inheritence   oops   polymorphism  object oriented programming (oops)  oops concepts   runtime polymorphism  object oriented programming (oops)  oops concepts     Asked in 4 Companies

Try 2 Question(s) Test


Very frequently asked. Usually followed by questions related to private constructor and synchronized access. Frequently asked in JPMorgan and TCS (Based on 2 feedback)
  Q14. Explain Singleton Design Pattern ?Design
Ans. http://www.buggybread.com/2014/03/java-design-pattern-singleton-interview.html

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

   Like         Discuss         Correct / Improve     java   design pattern   singleton   at&t   ebay  fidelity india  united healthcare india     Asked in 46 Companies      intermediate        frequent


Frequently asked in face to face interviews.
  Q15. Write a program to print fibonacci series.Core Java
Ans. int count = 15;
int[] fibonacci = new int[count];
fibonacci[0] = 0;
fibonacci[1] = 1;
for(int x=2; x < count; x++){
fibonacci[x] = fibonacci[x-1] + fibonacci[x-2];
}

for(int x=0; x< count; x++){
System.out.print(fibonacci[x] + " ");
}

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

   Like         Discuss         Correct / Improve     ebay   fibonacci series     Asked in 66 Companies      basic        frequent



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: