1

Yatra.com Bangalore Java interview questions , selection process

====================================================================
Yatra.com Bangalore Java interview questions , selection process
====================================================================

1.  Collections
3. Servlet
4. Thread
5. Question based on pas by value
6. Question based on exception
 8.Spring
9.SQL

500 Java interview Questions


JAVA : 

1.Can Java thread object invoke start method twice?
2.Give the list of Java Object class methods ?
3.Can we call servlet destroy() from service()?
4.Can we override a static method?
5.Can you list Serialization interface methods?
6.What is the difference between super() arid this()
7.How to prevent a method from being overridden?
8.Can we create abstract classes without any abstract methods?
9.Explain private,protected,public?
1O.Can we have static methods in Interface?
11 What is transient variable?
12 Incase, there is a return at the end of try block, will execute finally block?
13,What is abstract class or abstract method?
14.What is default value of a boolean?
15,When to use LinkedList or ArrayList?
16.What is daemon thread?
17.Does each thread in Java uses separate stack?
18. What is the difference between Enumeration arid Iterator?
19.Does system.exit() in try block executes finally block?
20. What is fail-fast in Java? Explain?
21,What is final finally and finalize?
22.In Java, are true and false keywords?
23. What is the purpose of Garbage Collection?
24. What are the types of ResultSet?
25. What is difference between wait and sleep methods in Java?
26. What is servlet context?
27. What happens it one of the members in a class does not implement Serializable interface?
28.What is re condition?
29.how to get current time in mull seconds?
30. How can you convert Map to List?
31.What Is strictfp keyword?
32,What isSystem.out in Java?
33. What is difference between ServletOuptpuiStream and PrintWriter?
34.What is Java static import?
35. When to use String and String8uffer?
36. What Is difference between String buffer and String builder?
37.What is wrapper class in Java?
38 Is Iterator a Class?
39.What is Java class-path?
40.Can a class in Java be marked as private?
41 is null a keyword in Java?
42 What is the initial state of a thread when it is started?
43.What is the super class for Exception and Error?
44.What is Class.forNameO?
45.Can interface be final?
46 What is the difference between exceptlon and error?
47.What is default value  of a local variables?
48.What is local class in Java?
49 Can we initialize uninitialized final variable?
50.Can we declare abstract method as final
51.Can we have finally block without catch block?
52.What is pass by value and pass by reference?
53 Can we declare main method as private?
52.What is the difference between pre-emptive scheduling and time slicing?
53.Can non-static member classes (Local classes) have static members?
54.What are the environment variables do we fleet to set to run Java?
55 Can you serialize static fields of a class?
56 What is the difference between declaring a variable and defining a variable?
S7.Where can we use serialization?
58.What modifiers are allowed for methods in an Interface?
59.What is the purpose of Runtime and System class?
60.Which one is faster ? ArrayList o Vector ? Why?
61.What is the difference between Static Synchronized and Synchronized
methods?
62 What is the order of catch blocks when catching more than one exception?
63.What is the difference between the prefix and postfix forms of the
increment(++) operator?
64.What is has hCode?
6S.What is the difference between hash-table and HashMap?
66.What are the restrictions when overriding a method?
67 What is the use of assert keyword?
68 What is difference between break, continue and return statements?
69.What is the difference between while and do-while statements?
70.When does the compiler provides the default constructor?
71.How to create and start a thread in Java?
72.Can I extend a Final class in Java
73.Explain volatile keyword in Java?
74.Can we catch “RuntimeException ? What is Checked and Unchecked
Exception?
75.When to make a constructor private and why?
1. Be thorough about OOP definitions, such as polymorphism, inheritance, abstraction,etc.
2. Know the difference between an interface and an abstract class. When to use It?
3. Be clear about Java does not support multiple inheritance the way C does.
4. Know that you implement an interface (can implement more than one).
5. Know about the access modifiers: public/(default)/protected/private.
6. Know the two ways to start a thread - “extending Thread” or “implementing Runnable”.
7. Know that the method is “run” but to run a thread you use “start’.
8. Understand “Serialization” & “Deserialization” process in java How it works?
9. How HashMap Works ? importance of “equal” & “hashCode() methods?
10. Exceptions— Error Checked, Unchecked Exceptions,Finally block?
11. Thread concepts— synchronization at object level & class level.
12. Java collections basics ,generics basics.
13. Be clear about “Java Pass By Value”.
14. How Strings are stored in Heap? Immutable objects in Java?
Different types of Memory in Java le Heap,Stack,Method Area,etc?
15. How Garbage Collection works in Java ? What is the advantage?

What is the difference between an Interface and an Abstract class ?
What Is the purpose of garbage collection in Java, and when Is It used?
Describe synchronization in respect to multithreading ?
What are pass by reference and passby value ?
What Is HashMap and Map?
Difference between HashMap and HashTable ?
Difference between Vector and ArrayList?
What is static keyword in java ?
What do you mean by platform independence ?
What is a JVM ?
What is the difference between a JDK and a JVM ?
What is Singleton class ?
What do you mean by Constructor ?
What is finalize() method ?
What is an Exception?
What do you mean by Checked Exceptions?
Explain Runtime Exceptions?
When throws keyword is used?
How finally used under Exception Handling ?
What is Polymorphism ?
How to override .quals and hashCode() methods?
Explain all access modiCars?
What is native keyword? Explain in detail?
What If the main method Is declared as private?
What if the static modifier is removed from the signature of the main method?
What if I write static public void Instead of public static void?
What are different types of inner classes?
How do I serialize an object to a file?
Which methods of serializable interface should I Implement?
When you serialize an object, what happens to the object references included in the object?
What happens to the static fields of a class during serialization ?
How are Observer and Observable used?
What is the difference between static and non-static variables?
How does a try statement determine which catch claus. should b. used to handle an exception?
What is difference between String. StrlngBuffer and StringBuilder? When to us. them ?
Why String class is final or immutable ?
Isiava Pass by Referenceor Pass by Value?
What is OutOfMemoryError in java ? How to deal with java.iang.OutOfMemeryError error?
What Is the use of the finally block ? is finally block In Java guaranteed to be called ? When finally block Is NOT
called?
What Is Marker interface ? How is it used in Java?
 What Is the difference between Thread.start() & Thread.run() method?
What Is ThreadLocal class ? How can It be used?
What Is the difference between sleepO, suspend() and waitO?
What happens when I make a static method as synchronized ?
Can a thread call a non-synchronized Instance method of an Object when a synchronized method Is being
executed?
Can two threads call two different synchronized Instance methods of an Object?
What Is a deadlock ?
How to find a deadlock has occurred in Java? How to detect a Deadlock In Java?
How will you take thread dump In Java ? How will you analyze Thread dump ?
What Is a thread leak ? What does It mean In Java?
What Is thread pool ? Why should we use thread pools ?
Can we synchronize the constructor of a Java Class ?
How many types of memory areas are allocated by JVM?
What Is Java classloader ? Explain ?
Can you make constructor final?
Is there any limitation of using inheritance?
Whets the difference between the methods sleep() and waltO?
What Is a transient variable?
What Is synchronization ?
Does garbage collection guarantee that a program will not run out of memory?
What is the difference between a break statement and a continue statement?
How can a dead thread be restarted?
What will happen if static modifier is removed from the signature of the main method?
What is the difference between •rror and an .xception?
Is it necessary that each try block must be followed by a catch block?
What are synchronized methods and synchronized statements ?
Where and how can you use a private constructor ?
Describe life cycle of thread?
Why Generics are us.d In Java?
If System.exit (0); Is written at the end of the try block, will the finally block still execute?
Why Strings are immutable ?
How to make a Java class Immutable?
Deep copy and shallow copy? b
What Is synchronization? Object lvl locking and class lev•l locking?
Can you assign null to this reference variable?






EXCEPTIONS

1.What is an Exception?
Exception is abnormal condition that can be handled .an Other Word An unwanted, unexpected
event that disturbs normal flow of the program is Exception.

2. What is an Error?
That Abnormal condition that cant be handled that is called error Svstem fallure

3. What is the purpose of Exception handling?
The main purpose of Exception of handling is for graceful termination of the program.
4. What is meaning of Exception handling?
Exception Handling dosen’t mean repairing the exception we have to define alternative way to
continue the rest of code normally.
S. What is the purpose of the try block
We should maintain the risky code Inside try block.
6. What is the purpose of the catch block?
We have maintain all the Exception handling code in side the catch block.
7. What is try?
Some time interviewer ask this type of question and try to confuse you but don’t confuse answer
is so simple try is a key word in Java. t
8. What is catch?
Same case as a try catch is also key word in Java.
9. Is try block with multiple catch Block possible?
Yes its possible You can Write a try block with multiple catch block for separate catch block for
every exception.
Ex. try(
risky code:
)Catch(lOException e){
}Catch(Arithmatic Exception e){
)etc.

10. It try multiple catch block Present Is order of catch block Is Important in which order we have
to take?

11. what are the various method en Exception class?

printstackTrace

toString() This method print information in the following format. Name of the Exception
Description

getMessage() This method print only description of the exception

12.1, an exception raised in catch block what will happen?





Jquery :

1. What is jQuery?
2. Why do we use jQuery?
3. How JavaScript and jQuery are different?
4. ls jQuery replacement of Java Script?
5. Is jQuery a library for client scripting or server scripting?
6. ls jQuery a W3C standard?
7. What is the basic need to start with jQuery?
8. Which is the starting point of code execution in jQuery?
9. What does dollar sign ($) means in jQuery?
10. Can we have multiple document.ready() function on the same page?
11. Can we use our own specific character in the place of $ sign in jQuery?
12. Is it possible to use other client side libraries like MooTools, Prototype along with jQuery?
13. What is jQuery.noConflict?
14. Is there any difference between body onload() and document.ready() function?
15. What is the difference between .jsand .min.js?
16. Why there are two different version of jQuery library?
17. What is a CDN?
18. Which are the popular jQuery CDN? and what is the advantage of using CDN?
19. How to load jQuery from CDN?
20. How to load jQuery locally when CDN fails?
21. What are selectors in jQuery and how many types of selectors are there?
22. How do you select element by ID in jQuery?
23. What does $(“div”) will select?
24. How to select element having a particular class (“.selected”)?
25. What does $(“div.parent”) will select?
26. What are the fastest selectors in jQuery?
27. What are the slow selectors in jQuery?
28. How jQuery selectors are executed?
29. Which is fast document.getElementBylD(’txtName’) or $U$*txtName’).?
30. Difference between $(this) and ‘this’ in jQuery?
31. How do you check if an element is empty?
32. How do you check if an element exists or not in jQuery?
33. What is the use of jquery .each() function?
34. What is the difference between jquery.size() and jquery. length?
35. What is the difference between $(div’) and $(‘<div/>’) in jQuery?
36. What is the difference between parent() and parents() methods in jQuery?
37. What Is the difference between eq() and get() methods In jQuery?
38. How do you implement animation functionality?
39. How to disable jQuery animation?
40. How do you stop the currently-running animation?
41. What is the difference between .empty(), .remove() and .detach() methods in jQuery?
42. Explain .bind() vs .live() vs .delegate() vs .on()
43. What is wrong with this code line $(‘#myid.3’).text(’blah blahill’);”
44. How to create clone of any object using jQuery?
45. Does events are also copied when you clone any element in jQuery?
46. What is difference between prop and attr?
47. What is eve nt.PreventDefault?
48. What is the difference between event.PreventDefault and event.stopPropagation?
49. What is the difference between event.PreventDefault and “return false”?
50. What is the difference between event.stopPropagation and event,stoplmmediatePropagatio
51. How to check If number is numeric while using jQuery 1.7+?
52. How to check data type of any variable in jQuery?
53. How do you attach a event to element which should be executed only once?
54. Can you include multiple version of jQuery? If yes,then how they are executed?
55. In what situation you would use multiple version of jQuery and how would you include then
56. Is it possible to hold or delay document.ready execution for sometime?
57. What Is chaining In jQuery?
58. How does caching helps and how to use caching in jQuery?
59. You get “jquery is not defined” or “$ is not defined” error. What could be the reason?
60. How to write browser specific code using JQuery?


spring :
l.What is Dependency Injection in Spring Framework ?
2.What are the different types of modules Spring Framework has ?
3.What is a Bean Factory in Spring Framework ?
4.What is Spring Application Context ?
5.What is the difference between Bean Factory and Spring Application Context ?
6.What are the different types Application Context implementation in Spring Framework ?
7.ConfigContextListener Explain ?
8.Different types of Scope in Spring ?(Singleton,Prototype.RequestSession.Global-Session]
9.What is the use of ExcludeFilter ?
10.explain the Life cycle of a bean ?
11.Different types of Spring Application Context ?
12.What is the difference between @Autowired and @Resource ?
13.How to inject object references with constructors in Spring Framework ?
14.What are the different types of Transaction Manager” in Spring Framework ?
15.Difference between Programmatic Transactions and Declarative Transactions in Spring ?
16.What Is IOC (or Dependency Injection)?
17.What are the different types of IOC (dependency injection) ?
18.What are the benefits of IOC (Dependency Injection) ?
19.What are the advantages of Spring framework ?
20.What is Spring?
21.What are the features of Spring ?
22.What are the types of Dependency Injection Spring supports ?
23.What is Bean Factory?
  1. What are opps concept in Java ?
  2. what is the difference between Abstraction and Encapsulation ?
  3. what are association , aggregation, composition and difference between aggregation and composition? 
  4. Two type of polymorphism , explain difference and write a program showing run time polymorphism ?
What are oops

 Collection exception multi threading , jsp , servets

Design patterns and benefits              

Single ton patter , abstract pattern, proxy pattern, command pattern, builder pattern

Basic  of hibernate : you want you object to crud on to data base  , hibernate does it for you

Concurrent programming in java

1.       How can you write a loop indefinitely in java

2.       What is the difference between yield and sleep

3.       What is the difference between pre-emptive and time slicing

q: What is Jvm
a: Jvm is an abstract which provide and runtime environment for java to run on different  os
.java is comipled to .class(byte code) which is interpreted to in jvm to run on the given os

What is JDK : Developing an application

What is JRE : Running a developed an application

What are the different type of memeory used by JVM
Class , method ,  heap, stack ,register , native method stack , string constant pool
Heap  is where  object is created and stack is where for each thread , if stack is exhausted  gives stack overflow error, where as if heap is exhausted you get out of memory error
What is class loader
Class loader is a part of JVM which is used to load classes and interfaces in to jvm

What are the diffent types of classLoader
So when you say java classfilename  classloader loads that class into jvm, if its not able to find and load  the class it will say  classnotfoundException

q:What  if you change the order of public static void main(String args[])   [static public void order]
a: no

what if you put final before public static void main (String args[])  will it complie ?
a : yes

q : does the constructor return any thing
a: yes it returns instance of the object

q; can we mark constructor as final
a: no we cant, since constructor are not inherited so we get compile  error if we mark it final

q; why main method is static
a; object needs to be created to call object methods so to avoid object creation  during application start up we mark then as static

q; what is a static block
a; at the time of class loading static block will be executed, it is executed bore the main method to handle the static variables

q; can we execute a program with out a main method
a; static block is executed at the time of class loading

q what is cloning 
a , cloning is the process of creating xact copy of the object by calling clone method on object

q: can we overload main method
a; yes we can over load the main  method

q: what is static binding
a associating a function call and its definationation during compile time

q: what is dynamic binding
a; associating a function and def during runtime

1.       Can we declare  interface method as static
Ans no we get compilation error only public and abstract are permitted : interface deal at object level

2.       Can an interface be final
Ans  no , interface has tobe  implemented

3.       Can we define private,protected modifiers  for variables in interface
Ans no , they implicitly public and static

4.       What is static import
Ans we can acess the static memembers  without prefixing classname

5.       Base class for error and exception
Ans throwable

6.       What is the difference between string builder and string buffer
Ans string buffer is synch and builder is not

Q; what is the diffenrnce between linkedlist and arraylist
List  define ordered collection of elements . list interface is implemented by arraylist and linkedlist
Arraylist : adding and reviming is slower , quick access to individual elements  so faster access , linkdlist for faster addiding and deletion

Q; java is pass by value or by reference
A ; java is pass by value for primitive types and for objects it reference is copy is passed

Q; examples of marker interfaces
A; cloneable and serializable are marker ; serializable only givies complier and jvm that this object is serializable

Q runnable is marker or not interface
A; has run method       

Q; how to sort an arralist
A; java.utill.collections provide sort given list sorts it

Q 8 primitive types in java
Int short byte long char float double Boolean

1.       WHAT IS JAVA CLASS FILE
ANS ; compiled .java is .class its an instruction to be interpreted by jvm

2.       Why  java is called platform independent language
Ans  compiled  files .class which then can be interpreted on multiple platform .class + os specific jvm

3.       What is native keyword in java
To say method is implemented not in java
4.    
   Super  used for ?
Supper used to access members of parent class
5.       
     This is used for ?
Ans  this used to represent instance of current class

Explain Key points on GC
a.       Automated memory management in java is through gc : objects created in heap  so some are no longer used / no live references so clean them to reclaim memory
b.      Only jvm decides when to us gc , you can only suggest using system.gc
c.       Before object is gc , eligibility is checked
d.      Gc works for memory management  if  memory in heap exhausted out of memeory error  comes if java app runs out of memeory
e.      Finalize method run only once object is gc but no gurantee

What is static initialization and instance initialization
Static block is run only once when the class is  loaeded whereas instance is initialized whenever a new instance is created

What is unreachable object
Object which has no live refrecne  and goes out of scope it become gc eligible

What are the different types of modifier used in inner class
Ans strictfp , public , private ,protected , final,abstract

What is the difference between set and list
Set : unordered /no duplicated / no nulls 

Explain servlet chaing
Two or more servlet co operated to serve a single request

What is dif hash map / table
Hash table has no null and synchromised methods

What is iterator
Interface allows to walks throw collection of  objects   

Explain auto boxing in java
Automatic conversion  b/w primitive to their correcponding wrapper class

What is enum type in java           
An enum type is a special data type that enable a varable to be a set of predefined  constancts

What is wrapper class
Wrapper class is any class that wrapps functionality of another class

What is primitive wrapper class
Wrapper class that wraps  or encapsulates primitive data types

What design pattern wrapper class implement
Adapter design pattern

What is the difference between process and thread
Process is a program in execution  whereas  thread a separate path of execution in a program

Explain different thread states in java
Runnable , running ,wait, block sleep and dead

What is deadlock
When tw thread waiting for each other and cant proess in execution  ,

How to avoid deadloack
To order accessing shared varaiable

What is the diference between serialisartion and deserialisation
Process of Writing state of objects to byte stream call serailisation and process of restoring these objects from byte stream

What is the difference b/w java 1.4 and 5
Genereic , autoboxing , enum, static imports

What is variable shadowing
Local variable shadow  the instance variable  

Can class  extends interface
Not class can impliments

Dos java support  multiple inheritance
No we cant extend multiple class as casue <> problem but can implement multiple interfaces

What do you mean by void return type
Vid means return ing nothing

Is java compiled or interpreted language
Both

What is the diference b/w yield and sleep
Thread.yield goes to runnable state and sleep goes to waiting state

What is object lock
A object lock is a mechnishm used by threads  to obtain syn access to object

What is bean life cycle
Spring is based on ioc  so call its container as ioc container , spring beans reside inside the ioc container , spring beans aare nothing but pojo
Their life cycle in container
If bean implimnent beanaware ,  the factory call setbeanname else if beanfactoryaware cals set beanfactory passing an instance of itself
If any beanpostprocessor associated with bean then  processbefore initialization is called  before bean properties are set
If init method is specified for bean then it will be called
If bean impliments disposablebean interface  then destroy mehd is called
If destroy-method attribute is spefiied that will also be called

What is rmi
Rmi stands for remote method invocation, that allows to invoke method of objects on other server, its object oriented rpc mechanism using internet interORB protocol

What is does is it provides a proxy(rmi stub)  method to client as like calling local method  and then rmi take on  pack and find server  ie marshalling/serialisation  and on other server  rmi takes this call , unpack /desrialises so we need ip and port numbr

Which is more tightly couple ; ihertence or composition
Inheritance as extends  so has more info where as compostion only has ref and does nt know composed methds of objects

What is the default value of string
Null

What  is the difference between preemtive  schdeulling and time slicing       
Under  ps  highest proirity  task executes until it goes to wait or dead state  or antorht high protiy task comes into existence
A task executes for predefined time and then goes to ready sate and scheduler desides which is next task

What is thread in java
An independent path of execution

ways a thread can enter into waiting state
By sleep method , or waiting for io or by invoking  wait on object on syn block

Can a lock be acquired on class
Yes lock can be

What new to stop , suspend and resume methods in 1.2
These has been deprecated

What is the differenece b/w java compiler and jvm
Javac is java comiler and jvm to run it

 questions soruce : interviewDot

MakeMyTrip bangalore selection process [mettl.com]

For interviews to be conducted on 1-4 march 2014 MakeMyTrip conducting online screening test

Test by mettl.com for makemytrip.com

Coding Section (1 Question) :

For the given number N (0 < N <= 2000). little Johnny wants to find out a minimum positive Integer X divisible  by N. where the sum of digits of X is equal to N and X is not equal to N
For example:
N          :Result
1          :1
10        190

ans:
public static int findNum(int n) {
            int  tnum = n ;
                            while (tnum <= 1000){
                               int tempnum = tnum;
                              int  sum = 0;
                                while (tempnum > 0){
                                    sum = sum + (tempnum % 10);
                                    tempnum = (int) (tempnum / 10);
                                if (sum == n)
                                    return tnum;
                                }
                                tnum = tnum + n;
                            }
                            return  tnum;

      }


MCQ (15 Question)

1. . which is the correct output option
public class Test {
     
static int[] i ;
      static {i[0]=11;}

      public static void main(String[] args) {
       
               String str1= "Manish";
String str2="ManishKumar";

System.out.println(str1.compareTo(str2));    

}
1.       ExceptionInInitializerError
2.       Some option
3.       Some option
4.       Some option

2. which is the correct output option
public class Test {
     
      public static void main(String[] args) {
       
               String str1= Manish;
String str2=ManishKumar;

System.out.println(str1.compareTo(str2));
}
1.       -5
2.       1
3.       Compile error
4.       Some option

3. what is the best difference between Runtime.exit() and Runtime.halt()

  1. 1.       System.exit() will be internally converted into RunTime.getRuntime().exit()
  2. 2.       Runtime.exit() causes uninvoked finalizers to be executed before the JVM process shuts down but Runtime.halt() doesn't
  3. 3.       Some option saying jvm to shutdown
  4. 4.       Some option

4.  which is the correct output option
public class Test {
     
      public static void main(String[] args) {
       
                  int x=10;
                  int y=++(++x);
                  System.out.println(y);
    

}
5. which is the correct output option
public class Test {
     
      public static void main(String[] args) {
     
Set s = new HashSet();
            s.add("akash");
            s.add("anshu");
            s.add("akash");
            Iterator it =     s.iterator();
            while (it.hasNext()) {
                   System.out.println( it.next());
                 
            }    
    

}

6. which is the correct output option
public class Test {
     
      public static void main(String[] args) {
                         
Set s = new HashSet();
            s.add(null);
            s.add(5);
            Iterator it =     s.iterator();
            while (it.hasNext()) {
                   System.out.println( it.next());
                 
            }
}

7.  which is the correct output option
class Dog {
      public Dog(int i) {
            // TODO Auto-generated constructor stub
      }
}
public class Test {
     
      public static void main(String[] args) {
                       
            TreeSet<Dog> d= new TreeSet<Dog>();
            d.add(new Dog(1));
            d.add(new Dog(2));
            d.add(new Dog(3));
           
            System.out.println(d.size());
}

8. which is the correct output  option
try {
                  System.out.println("Division");
                  int x=10/0;
                  System.out.println(x);
            } catch (Exception e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
            }
1.       Division  by Zero ArithMaticException
2.       by Zero ArithMaticException
3.       ArithMaticException
4.       Some option

9. what is the correct output option
List l = new ArrayList();
             l.add("abc");
             l.add("8");
             l.add("5");
             Collections.sort(l);
             
             for (int i = 0; i < l.size(); i++) {
                  System.out.println(l.get(i));            
            }

10.  which of the following is the correct option
public class Test{
     
     
      void check() throws Exception {
            System.out.println("check");
      }   
      public static void main(String[]args) {
           
            Test dt = new Test();
            dt.check();
      }
}
  1. 1.  compile
  2. 2.  RuntimeException
  3. 3.  Someoption
  4. 4.  No of the above


11. which is not correct option
a.       public static void main(String ...args)
b.      public static void main(String[] args) throws Exception
c.       public static void main(String  args)
d.      public static void main(String[]  args)

12.   which of the following is the correct option <same as q10>
public class Test{
     
     
      void check() throws RuntimeException {
            System.out.println("check");
      }   
      public static void main(String[]args) {
           
            Test dt = new Test();
            dt.check();
      }
}
  • 1.  compile
  • .  RuntimeException
  • .  Someoption
  •   No of the above



13. Find the override and over load  relationship         
Public class Child {
      void display (){}//Line 1
}          
  class Child extends Parent {
 display (){} // Line a
             void display(int i){ //Line b
}  
 }                                                          
a.       Line 1 and Line a are overridden ; Line a and Line b are overloaded
b.       Similar  other Option
c.       Similar   other  Option
d.      Similar  other  Option

14.                How to start a thread having a class test impliments Runnable and overrides Run method
                                a .     Test dt = new Test();
                  Thread th = new Thread(dt);
                  th.start();
                                b.     Thread th = new Thread(Test);
c.
d.   

                   
15.          Object o = new Object();
            //Line 2
            s.add("o");
            s.add(o);
            which one will not compile at Line 2 ?
a.  Set s = new HashSet();
b.  Set s = new LinkedHashSet();
c.   Set s = new TreeSet();
d.  No Compile issue



Interview Questions :


  1. Given 25 horses , find 3 fastest horses on condition  max 5 horses/race can run ? no stopwatch provided 
  2. Given two linked-list find common element , please note don't find common value but address ie  nodes in two list  pointing to same address
  3. if you have an array{a,b,c}   replace each value in array with the product of other elements ie{bc,ac,ab} . code  should work for given n array elements 

All the best !