Sunday 27 July 2014

Best Way to Answer The Hr Question...

1.tell me About urself

Start with your Name
Give your place information
Education in short
Family details in Short
My name is Johir  I live in wb . I have
 done my btech
in Ece from Aiemd.I am fresher about my
family

During my free time, I enjoy listening to music and
 writing blogs. As a person, I am very hardworking,
 ambitious and passionate. And I am eagerly looking 
forward to work as a xyz at abc.
That's it about me. 

2 Why do you want to work at our company

tell them what you like about company
Relate it to your long-term carrer goals

Sir , it is a great privilege for anyone
 to work in a reputed company like yours.
when I read about your company i found that my skills
are matching your requirements. Wherer I can showcase
my technical skills to contribute to the company growth

3 What are your Strengths?

Adaptability
Hard Working
Honest
Flexibility
optimistic +attitude
Fast Decession Making
Persistence regular with work
Self motivated

I am a honest,  self motivated and hardworking
boy with positive attitude towards my carrer and my life.


4 What are your Weakness 

 Straightforward
impatient
Sensitive
Trust people Quickly
I can not say no when someone ask for help
Take decisions very quickly
Gets nervous when talk to strangers
To speak lie is difficult for me
I am a bit lazy about which I am not Interested


I can not say no when someone ask for help and I am a bit
 lazy about which I am not Interested
(don't added more than 3 0r 4 points)


5 Why should I hire you 

Share your knowledge
Work Experience
Skills related to job
Carrer Goal

Fresher
Sir As I am a fresher , I have theoretical knowledge but i can
do hard work for my organization.And I will put all my efforts
for the good progress of organization. Being punctual
and sincere, I can finish the work given to me on time and try
my best to fulfill all the needs of company from me. 

Exprence
 With reference to my work experience, i Satisfy all the 
requirement for this job. I am sincere with my work & would
never let you down in anyway .I promise you never regret for the
 decision to appoint me in your organization.

6 Tell me what you know about this company 
Study about the company
Do the background about new projects
know the names of their owners and partners
Research about the company current issues
Update your knowledge about their competitors

It is one of the best fastest growing company in India. The work
environment of the company is very good.People feel to part of the 
company as company provides full support to their employes in
professional front .It has many branches across the world so I have
good opportunity to show my talent

7 For Exp
  Why are you looking for a job change ?
Thanks to previous Organization
Explain what you learn from past job Experience
Share your reason for job change 
Relate to career goals

I am thankful to my previous organization because I have a lot of
things from there . According to me changes are necessary 
for everyone to enhance your skills, knowledge and for 
personal growth and financial growth. Your organization 
is the good platform where I can learn more.

8 What are your salary requirement ?
Never Share your salary requirements as a fresher
Experience candidate can share their expected salary
Always say as per the company norms for the job

For fresher

I am a fresher , Salary is not first priority for me.This is a big 
platform to start my career and I also want to improve my knowledge
and skill and gain experience.So I expect a considerable of salary
according to my ability and your company's norms which will fulfill
my economical needs.

For Exp

 I have 7 years of experience in HR field. My current CTC is 6 lpa
Salary has never been a big issues for me.Still I am expecting
 salary as company's norms as per my designation and my 
qualificaion and experience which can help me to maintain 
the standard of level of my personal and economical needs.

9 What are your career goals? 
Short term goal
Long term goal

My short term goal is to get a job in reputed company where I can
utilize my skills and improve my career path. My long term goal 
is to be in respectable position in that organization.

10. Finally  do you have any question to ask me?

Express thanks
salary structure 
Job Timings
Job Location
overtime allowance
Training Period
Transport Facility

Thank you for giving this opportunity . Sir I would like to
 know about the job timings and transport facility and what will
be the job location and salary scale for this job in your 
organization

Thread In java Interview Question

Q1) What is a Thread?

Ans) In Java, "thread" means two different things:

An instance of class java.lang.Thread.
A thread of execution.
An instance of Thread is just…an object. Like any other
object in Java, it has variables and methods, and lives and dies on the heap.
But a thread of execution is an individual process (a "lightweight"
process) that has its own call stack. In Java, there is one thread per call
stack—or, to think of it in reverse, one call stack per thread. Even if you
don't create any new threads in your program, threads are back there running.

The main() method, that starts the whole ball rolling, runs
in one thread, called (surprisingly) the main thread. If you looked at the main
call stack (and you can, any time you get a stack trace from something that
happens after main begins, but not within another thread), you'd see that
main() is the first method on the stack— the method at the bottom. But as soon
as you create a new thread, a new stack materializes and methods called from
that thread run in a call stack that's separate from the main() call stack.

Q2) What is difference between thread and process?

Ans) Differences between threads and processes are:-
1. Threads share the address space of the process that  created it; processes have their own address.

2. Threads have direct access to the data segment of its
process; processes have their own copy of the data segment of the parent
process.

3. Threads can directly communicate with other threads of
its process; processes must use interprocess communication to communicate with
sibling processes.

4. Threads have almost no overhead; processes have
considerable overhead.

5. New threads are easily created; new processes require
duplication of the parent process.

6. Threads can exercise considerable control over threads of
the same process; processes can only exercise control over child processes.

7. Changes to the main thread (cancellation, priority
change, etc.) may affect the behavior of the other threads of the process;
changes to the parent process do not affect child processes.

Q3) What are the advantages or usage of threads?

Ans)
 Threads support
concurrent operations. For example,
 • Multiple requests
by a client on a server can be handled as an individual client thread.
 • Long computations
or high-latency disk and network operations can be handled in the background
without disturbing foreground computations or screen updates.

Threads often result in simpler programs.
• In sequential programming, updating multiple displays
normally requires a big while-loop that performs small parts of each display
update. Unfortunately, this loop basically simulates an operating system
scheduler. In Java, each view can be assigned a thread to provide continuous
updates.
• Programs that need to respond to user-initiated events can
set up service routines to handle the events without having to insert code in
the main routine to look for these events.

Threads provide a high degree of control.
• Imagine launching a complex computation that occasionally
takes longer than is satisfactory. A "watchdog" thread can be
activated that will "kill" the computation if it becomes costly,
perhaps in favor of an alternate, approximate solution. Note that sequential
programs must muddy the computation with termination code, whereas, a Java
program can use thread control to non-intrusively supervise any operation.

Threaded applications exploit parallelism.
• A computer with multiple CPUs can literally execute
multiple threads on different functional units without having to simulating
multi-tasking ("time sharing").
• On some computers, one CPU handles the display while
another handles computations or database accesses, thus, providing extremely
fast user interface response times.

Q4)What are the two ways of creating thread?

Ans) There are two ways to create a new thread.

1)Extend the Thread class and override the run() method in
your class. Create an instance of the subclass and invoke the start() method on
it, which will create a new thread of execution. e.g.

public class NewThread extends Thread{

public void run(){
// the code that has to be executed in a separate new thread
goes here
}
public static void main(String [] args){
NewThread c = new NewThread();
c.start();
}

}
2)Implements the Runnable interface.The class will have to
implement the run() method in the Runnable interface. Create an instance of
this class. Pass the reference of this instance to the Thread constructor a new
thread of execution will be created. e.g. class

public class NewThread implements Runnable{

public void run(){
// the code that has to be executed in a separate new thread
goes here
}
public static void main(String [] args){
NewThread c = new NewThread();
Thread t = new Thread(c);
t.start();
}

}
Q5) What are the different states of a thread's lifecycle?

Ans) The different states of threads are as follows:

1) New – When a thread is instantiated it is in New state
until the start() method is called on the thread instance. In this state the thread
is not considered to be alive.
2) Runnable – The thread enters into this state after the
start method is called in the thread instance. The thread may enter into the
Runnable state from Running state. In this state the thread is considered to be
alive.
3) Running – When the thread scheduler picks up the thread
from the Runnable thread’s pool, the thread starts running and the thread is
said to be in Running state.
 4)
Waiting/Blocked/Sleeping – In these states the thread is said to be alive but
not runnable. The thread switches to this state because of reasons like wait
method called or sleep method has been called on the running thread or thread
might be waiting for some i/o resource so blocked. 5)      Dead – When the thread finishes its
execution i.e. the run() method execution completes, it is said to be in dead
state. A dead state can not be started again. If a start() method is invoked on
a dead thread a runtime exception will occur.

Q6) What is use of synchronized keyword?

Ans) synchronized keyword can be applied to
static/non-static methods or a block of code. Only one thread at a time can
access synchronized methods and if there are multiple threads trying to access
the same method then other threads have to wait for the execution of method by
one thread. Synchronized keyword provides a lock on the object and thus
prevents race condition. E.g.

public void synchronized method(){} 
public void synchronized staticmethod(){}
public void myMethod(){

           
synchronized (this){            
// synchronized keyword on block of 
code
            }

}

Q7) What is the difference when the synchronized keyword is
applied to a static method or to a non static method?

Ans) When a synch non static method is called a lock is
obtained on the object. When a synch static method is called a lock is obtained
on the class and not on the object. The lock on the object and the lock on the
class donĂ¢€™t interfere with each other. It means, a thread accessing a synch
non static method, then the other thread can access the synch static method at
the same time but canĂ¢€™t access the synch non static method.

Q8) What is a volatile keyword?

Ans) In general each thread has its own copy of variable,
such that one thread is not concerned with the value of same variable in the
other thread. But sometime this may not be the case. Consider a scenario in
which the count variable is holding the number of times a method is called for
a given class irrespective of any thread calling, in this case irrespective of
thread access the count has to be increased so the count variable is declared
as volatile. The copy of volatile variable is stored in the main memory, so
every time a thread access the variable even for reading purpose the local copy
is updated each time from the main memory.          The
volatile variable also have performance issues.

Q9) What is the difference between yield() and sleep()?

Ans)  yield() allows
the current the thread to release its lock from the object and scheduler gives
the lock of the object to the other thread with same priority.
         sleep()
allows the thread to go to sleep state for x milliseconds. When a thread goes
into sleep state it doesn’t release the lock.

Q10) What is the difference between wait() and sleep()?

Ans)

1) wait() is a method of Object class. sleep() is a method
of Object class.

2) sleep() allows the thread to go to sleep state for x
milliseconds. When a thread goes into sleep state it doesn’t release the lock.
wait() allows thread to release the lock and goes to suspended state. The
thread is only active when a notify() or notifAll() method is called for the
same object.

Q11) What is difference between notify() and notfiyAll()?

Ans) notify( ) wakes up the first thread that called wait( )
on the same object.
notifyAll( ) wakes up all the threads that called wait( ) on
the same object. The
highest priority thread will run first.

Q12) What happens if a start method is not invoked and the
run method is directly invoked?

Ans) If a thread has been instantiated but not started its
is said to be in new state. Unless until a start() method is invoked on the
instance of the thread, it will not said to be alive. If you do not call a
start() method on the newly created thread instance thread is not considered to
be alive. If the start() method is not invoked and the run() method is directly
called on the Thread instance, the code inside the run() method will not run in
a separate new thread but it will start running in the existing thread.

Q13) What happens when start() is called?

Ans) A new thread of execution with a new call stack starts.
The state of thread changes from new to runnable. When the thread gets chance
to execute its target run() method starts to run.

Q14) If code running is a thread creates a new thread what
will be the initial priority of the newly created thread?

Ans) When a code running in a thread creates a new thread
object , the priority of the new thread is set equal to the priority of the
thread which has created it.

Q15) When jvm starts up, which thread will be started up
first?

Ans) When jvm starts up the thread executing main method is
started.

Q16) What are the daemon threads?

Ans) Daemon thread are service provider threads run in the
background,these not used to run the application code generally.When all user
threads(non-daemon threads) complete their execution the jvm exit the
application whatever may be the state of the daemon threads. Jvm does not wait
for the daemon threads to complete their execution if all user threads have
completed their execution.

To create Daemon thread set the daemon value of Thread using
setDaemon(boolean value) method. By default all the threads created by user are
user thread. To check whether a thread is a Daemon thread or a user thread use
isDaemon() method.

Example of the Daemon thread is the Garbage Collector run by
jvm to reclaim the unused memory by the application. The Garbage collector code
runs in a Daemon thread which terminates as all the user threads are done with
their execution.

Q17) What all constructors are present in the Thread class?

Ans) Thread()
 Thread(Runnable
target)
Thread(Runnable target, String name)
Thread(String name)

Q18) Can the variables or classes be Synchronized?

Ans) No. Only methods can be synchronized.

Q19) How many locks does an object have?

Ans) Each object has only one lock.

Q20) Can a class have both Synchronized and non-synchronized
methods?

Ans) Yes a class can have both synchronized and
non-synchronized methods.