Friday 14 April 2017

php interview Question with answer





An    Interview , in   PHP . best he answered

Raj  is having  well hands-on experince in php , He  is getting into php technical interview round


 Interviewer started  by asking .

 "  What are different  areas , where  PHP  can be used ?"

Raj replied :

 
     There are three main areas where PHP scripts are used.

              1. Server-side scripting :  Php  run on  the web server, with a connected PHP installation. You can access the PHP program output with a web browser .

      2. Command Line Scripting : PHP Script will  also  run without any server or browser with help of  PHP parser .
       
            3 . Writing desktop applications : PHP can also  be used  to create a desktop application with a  graphical user interface .We can  use PHP-GTK  to write such programs.


Interviewer : 

 "Explain file handling in php  and all  their diffrent operation   like(reading , writing updating etc..)in detail"

Raj replies : 

PHP has several functions for     Creating,    Reading,    Open and Closing    and Editing Files.

PHP readfile() Function  , The readfile() function reads a file and  writes  it to the output buffer. Example is given below





 
  PHP Open File - fopen() . A better method to open files is with the fopen() function. This function gives you more options than the readfile() function.Example is given below.
 
  PHP Read File - fread().  The fread() function reads from an open file.  The first parameter of fread() contains the name of  the file to read from and the second parameter specifies the maximum number of bytes to read. Example is given below


 
     PHP Close File - fclose(). The fclose() function is used to close an open file. Example  is given below.
 

   PHP Read Single Line - fgets() . The fgets() function is used to read a single line from a file. Example is given below

PHP Check End-Of-File - feof(). The feof() function checks if the "end-of-file" (EOF) has been reached.Example is given below


PHP Read Single Character - fgetc() .The fgetc() function is used to read a single character from a file. Example is given below.



PHP Write to File - fwrite() .The fwrite() function is used to write to a file.Example is given below


Interviewer next question :


"Whats the difference between mysql_connect  and  mysql_pconnect  ?"

Raj Replied : 

mysql_connect - Open a connection to a MySQL Server. Connection will be closed as soon as the execution  of the script ends, unless it's closed earlier by  explicitly calling mysql_close().Example  is given below.



While mysql_pconnect   Establishes a persistent connection to a MySQL server. When a persistent connection is requested,  PHP checks if there's already an identical persistent  connection (that remained open from earlier) - and if it exists, it uses it.
Example is given below.



Interviwer next question :


Explain PHP MySql functions :  mysql_fetch_array , mysql_fetch_assoc ,  mysql_fetch_row , mysql_fetch_object and their  differences.

Raj replied :


mysql_fetch_array    Fetch a result row as an associative array, a numeric array, or both

     mysql_fetch_array ( resource $result [, int $result_type = MYSQL_BOTH ] ) 
     
result_type is a constant and can take the following values: 
 
MYSQL_ASSOC, MYSQL_NUM, and MYSQL_BOTH.

Example is given below.




mysql_fetch_assoc    Fetch a result row as an associative array 

mysql_fetch_assoc ( resource $result )

Example  is given below

mysql_fetch_row    Fetches one row of data from the  result associated with the specified result identifier. The row is returned as an array.  

mysql_fetch_row ( resource $result )

Example is given below


 mysql_fetch_object    Fetch a result row as an object 
mysql_fetch_object( resource $result )

Example is given below 



Interviewer next question :


 What is difference between COOKIES  and SESSION. Explain both.

Raj replied :


   A COOKIE is a small piece of text stored on a user's  computer by their browser. Each time the users' web browser interacts with a web server  it will pass the cookie information to the web server.



This means that cookies that relate to www.example.com will not be sent  to www.exampledomain.com.
   
   Common uses for COOKIES are authentication, storing of site preferences, shopping cart items,and server session identification.

 A SESSION can be defined as a server-side storage of  information that is desired to persist throughout the  user's interaction with the web site or web application. 


Instead of storing large and constantly changing  information via COOKIES in the user's browser, only a unique identifier is stored on the client side  (called a "session id(SSID)"). 

This session id is passed to the web server every time  the browser makes an HTTP request (ie a page link or AJAX request). 

The web application pairs this session id with it's internal database and retrieves  stored variables for use by the requested page.
  

Interviewer  next question :


 What is Sql injection and how  it can be prevented? 

Raj replied:


 SQL Injection is the placement of malicious code in SQL statements, via web page input.

             SQL Injection is one of the most common web hacking techniques.


  For Example The original purpose of the below code was to create  an SQL statement to select a user, with a given user id.



 If there is nothing to prevent a user from entering "wrong" input, the user can enter some "smart" input  like this: , UserId: 105 OR 1=1


Then, the SQL statement will look like this: , SELECT * FROM Users WHERE UserId = 105 OR 1=1; 

 The SQL above is valid and will return ALL rows from the "Users" table, since OR 1=1 is always TRUE.

 A hacker might get access to all the user detail,  that will be very dangerous.

-----------------------------------------------

 SQL Injection  can prevented by  using
       (1). mysqli_real_escape_string

     The mysqli_real_escape_string() function escapes  special characters in a string for use in an SQL statement.     


 Another way preventing SQL Injection  is by  using
  using prepared statment

     Example is given below 


Interviewer  next question :


What is   CrossSite  Scripting ?

Raj replied:


Cross-Site Scripting (XSS) attacks are a type of  injection, in which malicious scripts are injected into   trusted web sites. 
   
        Example is given below 



The end user’s browser has no way to know that the script should  not be trusted, and will execute the script , because it thinks the script came from a trusted source, the malicious script can access any cookies, session tokens, or other sensitive information retained by the browser and passes  to attcker  . 
          These scripts can even rewrite the content of the HTML page. 
 
 Example is given below


Interviewer   Next Question :


Explain  Rest Services .

Raj replied :

REST defines a set of architectural principles by which you can design Web services that focus on a system's resources, including how resource states  are addressed and transferred over HTTP by a wide range of clients written in different languages.

REST Web service follows four basic design principles:
    * Use HTTP methods explicitly.
    * Be stateless.
    * Expose directory structure-like URIs.
    * Transfer XML, JavaScript Object Notation (JSON), 
           or both.



Interviewer next question :


Explain  SOAP.

Raj replied :


 SOAP  stands for Simple Object Access Protocol.

SOAP provides the envelope for sending  Web Services messages over the Internet/Internet.  It is part of the set of standards specified by      the W3C


The SOAP envelope contains two parts:

*  An optional header providing information on authentication,   encoding of data, or how a recipient of a     SOAP message should process the    message.

*  The body that contains the message. These messages can be defined using the WSDL specification.

Interviewer  next question


 What is difference  between include  and require ?

Raj replied:


With the include or require statement. We used to insert the content of one PHP/html file into  another PHP file (before the server executes it)

    In  include - (if source file missing it'll give warning    and continue execution),    while in require - (if source file missing it'll give         error  and halt execution),)

      With the include or require statement. We used to insert the content of one PHP/html file into  another PHP file (before the server executes it)

      In  include - (if source file missing it'll give warning    and continue execution),    while in require - (if source file missing it'll give  error  and halt execution),)


Interviewer Next Question :


Explain session_set_save_handler   ?

Raj replied :


To maintain the session data, we can use session_set_save_handler function.
  


This function provide 6 callback functions which call automatically.

   openFunction will be called automatically when session start.
   closeFunction will be called automatically when session end.
    readFunction will be called automatically when you read the session.
  writeFunction will be called automatically when you write in the session.
  destroyFunction will be called automatically when you destroy in the session.
   gcFunction will be called automatically when session inactive for long time.


Interviewer Next Question :

 How to convert string to array   and array to string in php?

Raj replied:


 Explode convert string to array ,   example given below


Implode convert array to string   ,    example given below

  

Interviewer  Next Question :


  How to scrape the data from website using CURL?

Raj replied :


 To scrap the data from website, Website must be  public and open for scrapable. In the blow code, Just update the CURLOPT_URL  to which websites data you want to scrap.


Interviewer Next Question :


How to explode a string using multiple delimiters("," and "|" )?

Raj replied:

  To explode a string with multiple delimeters , we use preg_split

 $string='php, interview | questions , and | answers ';
$output = preg_split( "/(\,|\|)/", $string );
print_r($output );
 
-----------------------------------------------------------------------------------

  Raj replied to  all question    very well



  
   





























Thursday 6 April 2017

Strengths and weaknesses asked in interview






Strengths and Weakness  Asked in Interview

This is another most common question asked by Interviewer.This question is asked to know whether :

* Candidate does have those qualities which are required by the company and for particular job.

Similarly weakness to know in which area you are lacking.
*Aren’t your weakness harm the job.

Let’s see how to answer this question.

Lalit is one interviewee who has gone for interview 


. Interviewer asked him
    "what are your strengths and weaknesses?"

Lalit:  

"My strengths are:
·       I am having very good communication skills.
·       I have excellent presentation skills.
·       I can work with diverse group of people.
·       I am a very good team player.   "


----------------------------------------------------------------------------
Hmm…is this the right way to answer this question  ?

No


Lalit has clearly mentioned about his strengths, that’s good.

That’s good but how recruiter would come to know, lalit actually practiced these strengths.


Then what should he do?

He should substantiate at least 2 strengths briefly to interviewer, not all as it will stretch the interview or explain that one which interviewer wants to know. 


Let’s see again how Lalit answer the question for strengths.

Interviewer:  "what are your strengths and weakness?"


Lalit :  My strengths are: 

" I am having very good communication skills (as I headed student’s editing team of my college magazine plus hosted various college programme), with excellent presentation skills, I can also work with diverse group of people, (during my internship in Master’s which I did in retail; I worked closely from Area sales manager to store security Guard. I need to train whole staff of retail store which also includes helpers and security Guards. I maintain very healthy relationship with all). I am a very good team player plus hard worker.  "


Now we have seen how Lalit described only two strengths to interviewer with mixing other strengths.


Try to highlight those strengths which are directly related to your job or suit the requirement of job. Example:

Sales profile job’s require:
·       good communication
·       Person who likes to meet new people
·       Like to travel etc.




But it doesn’t mean you start lying plus also sounds like a scripted robot. Be natural answer as a conversation, because an interview is also a conversation



Now we see how Lalit told his weakness.

Interviewer: " good, What about weaknesses?"

Lalit: " Mam! Rather calling these are my weaknesses, I would say these are my areas of improvements. Like I am slightly impatience regarding my work, as I want my all work perfect so I am working on it to be clam, I also want to learn to say no, by saying yes to everyone I burden myself with work which leads to stress at last I am not able delegate the work which again piled up work on me which hampers my work style. So these are the areas of improvement, I require."


Interviewer: 
"Well! Lalit these are not seems as weaknesses while showing you as a workaholic, it’s good for companies but you should balance it. It’s nice talking to you.  Wait for some time for result. "


What do you think? 

 Lalit has answered very well about weaknesses.  

Firstly he stated weaknesses as a area of improvement which every interview should say while answering this question. 

Secondly he stated all his work positive weaknesses which actually are requirement of any company. That’s why interviewer said you are workaholic.

 What did this mean?

 Telling weaknesses are not being completely open yourself in front of interviewer while smartly module your answer in a positive way, so that it shows you positive in front of interviewer. 










Sunday 26 March 2017

Interview Tips for trainer , Complete Interview and key points of interview



          Interviews
*       Position: Trainer
*       Work experience: Fresher

*       Education Qualification: Graduation/Post- Graduation.

This is an interview of a person who got selected as a trainer in skill development sector in one of the big brand of education industry.

(Fresher’s interviews totally depend on their curriculum vita and their qualification because a fresher doesn’t have any work experiences, so his /her qualification is the only experience he/she is carrying. It’s better to mention true and documented proof which he/she is having with them. Plus don’t mention any information, which one don’t have any knowledge or idea, it may lead to rejection.)


      Candidate ,  Good Morning Sir .
      Interviewer: Good Morning. How are you?

      Interviewee: I’ am fine Ma’am and you?

      Interviewer: All good, let’s start with the process. So tell me about yourself?

      Interviewee: My name is Ram. I completed my MBA from ABC Institute and did my graduation from DEF university. My schooling was from QRS School Delhi. I live in South Delhi and I am fresher. 

      Interviewer:  what you did in graduation?

      Interviewee: I did B.A

      Interviewer:  Was your college regular?
      Interviewee:  Yes, I my college was regular.

      Interviewer:  you have mentioned in your C.V that you did internship in the retail sector. Can you tell me about this internship?

      Interviewee:  Yes, I did my internship in the retail sector in marketing field.  Where I need to do marketing, research and merchandising of XYZ Company’s product.

(This answer must be depending on projects or trainings mentioned by candidate on the resume. Candidate must have full knowledge of mentioned projects or training with full documented proof.)


      Interviewer:  You said, you were taking care of marketing of product of XYZ Company. Then why do you want a job in training field? Not in marketing field?

      Interviewee:  The reason behind this, I want to do job in training field because I like training, it is a very interesting field and you need to learn a lot every day, it’s very vibrant field and I love training.


      Interviewer: It seems you like training job. This very good for us. Now let me ask some basic questions related to training? What is the difference between training and teaching?

      Interviewee: There is one difference between training and teaching, which is a methodology. Teaching mainly follows pedagogy while training follows andragogy.  So it’s depending where teaching is required and where training is required.


      Interviewer: Good answer. If you got selected in our company then you need to train students who are mainly from low income group or below the poverty line or school dropouts. Most students are not interested in studies? How will you encourage learning in them or create interest?

      Interviewee:  I need to find out why it happened or why they are not interested in studies. I need to find ways in which they find the studies interesting. They need to be aware or counsel, why studies are important. 

(Every interview has technical round on which candidate’s selection is judge, so one should brush the learning or knowledge required for job. It is must.)


      Interviewer: If any student gets dropped out or stop coming to your classes. What will you do? How you’ll bring her/him back?

      Interviewee:  If this kind of case will happen, I will go to the student and ask why he/she has stopped coming to my class? What are the reasons? And then I will counsel him/her according to that and try my best to get her/him back to my class.


      Interviewer: Good answer ram. Tell me your strengths and weaknesses?

      Interviewee: My strengths are I am hard working. I used to work late night or early morning on my projects in my masters, that’s why I got excellence certificates in my projects and I am an empathetic person, that’s why I help people going beyond my strength, due to this I am also a good team player. Now my weaknesses are: I am an impatient person, I can’t take rest till my work is not completed plus I am a very aggressive person, I want my things in the right way till it’s not harming anyone.  

(This answer is also matter of subjective but its best to mention his/her strengths and weaknesses by keeping job or position in mind)


      Interviewer: Well, good we need an empathetic person who understands the problem with solutions and a good team player. How soon you can join us?

      Interviewee:. Ma’am, I can join as per your requirement. I am comfortable in that

      Interviewer:  what are your salary expectations?

      Interviewee:  (Answer should be according to salary bar provided by the company or its matter of subjective expectation.)
At the End here the tips to improve your Training skills for getting selection during Demo sessions because in training profile Demo session is main session on which 80% of selection and remuneration depends.

Here are few tips by which one can give effective training:
           
·       As you know the area of expertise of yours in which you give training so, it’s best you should prepare some topics really well.
·       Try to judge the audiences to whom you impart training by asking some simple questions, like you can ask them what they have studied in their last session.
·       Always state motive or outcome of session before starting the training.
·       Make training session interesting by keeping balance of activities and content, too much of any part can dilute the purpose of training. Example: try to make session interactive.
·       Highlight the main points or sub topics of the training repeatedly during session so those trainees remember the main points of training.
·       Don’t make your training session too long or too short so that it can’t lose its jest.

·         Keep small test at the End of session to know how much trainees have learnt and how effectively you able to impart training plus it’s also make trainee serious throughout training.

·       Always remember two very important things to do at last, first always summaries the learning of training and secondly take feedback to know your positive and improvement points.

Keep these points in practice and in mind for effective training.
                                                Thank you!

Saturday 18 March 2017

sql query asked in interview







An interview in Sql Questioning and database programming


Interviewer   "Hi sahil"


Sahil Replied  "hello mam !"


Interviewer "what query you write to find distinct salary from this employee  table "


Sahil Replied  " The query is , select distinct salary from employee "


Interviewer " Retrieve all employees whose address is in Houston Texas "
Sahil Replied  "  SELECT fname , lname from employee where address like '%Houston T%' "


Interviewer " find all employees who were born during 1950's "
Sahil Replied  "  SELECT fname , lname from employee where bdate  like '1950 6 times _' "


Interviewer " Retrieve all employees in department 5 whose salary is between 30000 and 40000 "
Sahil Replied  "  select * from employee  where salary between  30000 and 40000 and dno = 5 "



Interviewer "  find the sum of salaries of all  employees , the maximum salary ,  the minimum salary , and the average salary "
Sahil Replied  "  select sum(salary) , max(salary) , min(salary) , avg(salary) from employee "


Interviewer " find  the sum of the salaries of all employees of the 'Research' department , as well as the maximum salary , the minimum salary , and the average salary in this department "


Sahil Replied  " select sum(salary) , max(salary) , min(salary) , avg(salary)  from (employee join department on dno = dnumber) where dname = 'Research' "

Interviewer " For each project , retrieve the project number , the project name , and the number of employees  who work on that project in these tables "


Sahil Replied  " select pnumber , pname ,count(*) from project , works_on  where pnumber = pno group by pnumber , pname "


Interviewer " For each project on which more than two employees work  , retrieve the project number , the project name , and the number of employees who work on the project "

Sahil Replied  " select pnumber , pname , count(*) , from project , works_on  where pnumber = pno group by pnumber , pname having count(*) >2 "

Interviewer " Retrieve all name of employee whose department are there in dependent table "


Sahil Replied  " select e dot name , e dot lname from , employee as e  , where exists (select * from dependent where e dot ssn = essn and e dot sex = sex and e dot f name = dependent_name) "

Interviewer " Retrieve the name of employees who have no dependents "


Sahil Replied  " select f name , l name  from employee where not exists (select * from dependent where ssn =essn ) "


Interviewer " Write query to change location to 'Bellaire' of project no 10 of department 5 "


Sahil Replied  " update project,  set plocation  ='Bellaire' ,  where p number = 10 and  d num =5 "

Interviewer " Write query to give all employees in the 'research' department a 10 percent raise in salary "


Sahil Replied  " update employee set salary =  salaries*1.1   where dno in ( select dnumber from department where dname = 'Research') "


Interviewer " Make a list of all project numbers for projects that involve an employee whose last name is 'smith' , either as a worker or as a manager of the department that controls the project"


Sahil Replied  " (SELECT DISTINCT PNUMBER FROM PROJECT, DEPARTMENT, EMPLOYEE  WHERE DNUM=DNUMBER AND MGRSSN=SSN AND LNAME='Smith')
UNION
(SELECT DISTINCT PNUMBER FROM PROJECT, WORKS_ON, EMPLOYEE WHERE PNUMBER=PNO AND ESSN=SSN AND LNAME='Smith'); "



Interviewer " How to   specify the constraint that "the salary of an employee must not be greater than the salary of the manager of the department that the employee works for"


Sahil Replied  " CREATE ASSERTION  SALARY_CONSTRAINT CHECK ( NOT EXISTS (SELECT * FROM EMPLOYEE E, EMPLOYEE M, DEPARTMENT D  WHERE  E.SALARY>M.SALARY AND E.DNO=D.DNUMBER AND D.MGRSSN= M.SSN) )"


Interviewer " Explain views in sql with example "


Sahil Replied  "  A views is a virtual table , in contrast to  base tables , whose tuples are actually stored in the database
Example of above view is created from this query ,   create view works_on1 as select fname , lname , pname , hours from employee , project , works_on  where ssn =  essn  and pno = pnumber "


Interviewer " Explain except , union , intercept operator in sql  "


Sahil Replied  " Except operator is used to combine two select statements and return rows from the first select statement that are not returned by  the second select statement "


Sahil Replied  "  UNION  operator is used to combine the results of two or more SELECT statements without returning any duplicate rows."


Sahil Replied  " INTERSECT operator used to combine two SELECT statements, but returns rows only from the first SELECT statement that are identical to a row in the second SELECT statement."


Interviewer " Explain the difference between union and union all operator in sql "

Sahil Replied  "  UNION operator is used to combine the results of two or more SELECT statements without returning any duplicate rows.
   UNION ALL operator is used to combine the results of two or more SELECT statements with returning  duplicate rows. "
 
 
 Interviewer "  what are different types of join and explain them."


Sahil Replied  " Different types of join are :
   INNER JOIN: returns rows when there is a match in both tables.
    LEFT JOIN: returns all rows from the left table, even if there are no matches in the right table

RIGHT JOIN: returns all rows from the right table, even if there are no matches in the left table.
FULL JOIN: returns rows when there is a match in one of the tables.
 SELF JOIN: is used to join a table to itself as if the table were two tables, temporarily renaming at least one table in the SQL statement.
CARTESIAN JOIN: returns the Cartesian product of the sets of records from the two or more joined tables."

  Sahil replied to all question very clearly


Monday 20 February 2017

interview in android , Android InterView Question And Answer





  An interview in android ,   best Answered .


 Raj  is having , 0 - 2  years , experience as a programmer , in  android

He is having a technical round , lets see how clearly he replies to questions.


 Interviewer Started by  asking : "   Explain the Aplatform  architecture of android. "

 
 

   Raj replied "
   

 Android is an open source, Linux-based  ,software stack   .
 Android is an  open  source, Linux-based software stack. It comprises of Linux Kernal ,  Hardware Abstraction Layer. Native Libraries, Android RunTime, Java APIs , System Apps.
Below Of Stack  is : The Linux Kernel : , Linux kernel  provides drivers for connecting to hardware.
  The hardware  abstraction layer (HAL) ,  provides a standard interfaces , that interact  with Kernal drivers , to access hardware  features.
 Android Run Time , is written , to  run multiple virtual  machines  , on  low-memory devices  , by executing DEX files .     
For devices running Android version  5.0 (API level 21) or higher, each app runs in its own process and with its own instance of the Android Runtime (ART).
Prior to Android version 5.0 (API level 21),  Dalvik was the Android runtime

 Native C/C++  Libraries 
Android components  such as ART and HAL, are built from native code that  require native libraries written in C and C++.  Android provides Java APIs  to use functionality of native  libraries to apps ..  Java API Framework  Java APIs form the building blocks you need to create Android apps by providing components and  services. System Apps
Android comes with , a set of core apps , for  email , SMS messaging ,  calendars,  internet browsing , contacts , and more. "


InterViewer : "good! very well explained. Can u explain activity  lifecycle ? "



Raj Replied "

 Yes Sure..
An activity has essentially four states:
 If an activity is in the foreground of the screen  , it is active or running.
 If an activity , has lost focus  , but is still visible , (like in case of dialog comes top), then it is paused.
 If an activity is completely  obscured by another activity, it is stopped. It still retains all state and member information.
 If an activity is paused or stopped, the system  can drop the activity  from memory by either asking it to finish, or simply killing its process.


So , when the activity  is first created its onCreate()  method   gets called .

   onStart()  get called after onCreate() when the activity is becoming visible  to the user.


After it onResume() is being called when the activity will start interacting with the user.

 onPause() is called when the system is about to start resuming another activity  or when its looses  focus like when some dialog comes top of it.


 onStop()  called when  the activity is no longer visible to the user,  because another  activity  has been resumed and is covering this one.

 onRestart() is called  if this activity is coming  back to interact .


 If the activity is  finished , the final  call activity will  recieve  is onDestroy().
That  completes whole activity cycle."


Interview : "Thats excellent !"


Interview : "

Lets say ,there are three  activities A , B , C each having button to  start activity  without finishing  in order
A start’s B,
B start’s C,
C start’s A.
Can  you show me what all  set of lyfecycle method gets  called  while navigation  from
 A to B,

 B to C,

 C to A
 "


 Raj Replied :

 "
 Ok.
When Activity A  started , its onCreate() , onStart(), onResume() , gets called in order
  When Activity  B  started , A : onPause() gets called , then  B:  onCreate() , onStart(), onResume() gets called in order
  When Activity  C  started , B : onPause() gets called then  C:  onCreate() , onStart(), onResume() gets called in order , then B: onStop()
   When again  Activity A started from C ,   As A was not  destroyed      So  first C: onPause()    gets called then     A:  onRestart() , onStart(), onResume() ,  gets called in order then   C: onStop() . "


   

   InterViewer : "  Thats  excellent ! "


InterViewer : "   What  is Service in android  and what are their types? "


Raj Replied : 


"A Service is an application component that can perform long-running operations   in the background, and it does not provide a user interface.
These are the three different types of services: Scheduled , Started , Bound

 A service is  scheduled when  an API such as the JobScheduler   , launches   the service.


 A service is started  when an application component (such as an activity) calls  startService().  


After service  started, it can  run in the background  indefinitely,  even if the component that started it is destroyed.
It is stopped by stopService() method. The service can stop itself by calling the  stopSelf() method.


  A service is bound when an   application component binds to it by calling bindService().
A bound service offers a  client-server interface that allows  components to interact with  the service, send requests,  receive result.
The client can unbind the service by calling the unbindService()  method.
The service cannot be stopped until all clients unbind the service. "



Inteviewer : " Good  Nicely explained. "



Inteviewer : " Can  you  explain   by any  real time  example   when to use  bindservice  or  start service . "


Raj Replied  :

" Yes Sure ! ,
Suppose, I want to play  music in the background , so call startService() method.
But I want to get information of the current song being played,
I will bind the service that provides information about  the current song.  "


InterViewer : " Ohh! Very ,  Good  Example "


InterViewer : "Ok Tell Me , What is the difference between , Service  and Intent Service. "


Raj Replied  :

" Service  is the base class for all services.
Once the service is started, the onStartCommand  , method in the service is called.
It passes in the Intent object from the  startService(intent) call.
If startService(intent) is called while the service is  running, each time  its  onStartCommand() is also called.
Therefore  it's important to create a new thread each time in onStartCommand  in which the service can complete all of its work for that particular intent recieved.



While   IntentService  is a subclass of Service , Creates a work queue ,  that passes , one intent at a time ,  to your onHandleIntent() implementation, so you never have to worry ,  about  multi-threading. "


InterViewer : "  Very Nice. Now tell me , What is an  Intent  in android ? "


Raj Replied  

:" An Intent is a messaging object  ,used to request an ACTION  to performed by  application component such as Activy , Service , Broadcast Reciever  etc. "


InterViewer : "  Very Nice.  And whats the difference between Implicit Intent and  Explicit Intent  ? "


Raj Replied  :

" Explicit intents specify  the component to start by its name (that is , fully-qualified class  name)
 for example :  you can start a  any new activity   by its name or start a service  by its name  to download a file in  the background.

 Implicit Intents do not directly  specify the  Android components which should be called , it only specifies action to be  performed , which also  allows a component from another app to handle it . "
 

InterViewer : "  Very Nice. what  is   Broadcast Reciever in Android ? "


Raj Replied  :

"    Broadcast receivers  are components in the application that listen  for  broadcasts and take some action.
              for example, building a broadcast receiver to listen  for the battery getting low  broadcast event in order to inform the user  that unsaved data  should be saved quickly
.
"



InterViewer : "  Good! , and how many ways app can send Broadcast ? "


Raj Replied  :

"    Android provides three ways ,      for apps to send broadcast:
    first is  sendOrderedBroadcast ,

  second is thorugh  sendBroadcast   method , 

 third is through  LocalBroadcastManager     method sendBroadcast .
     The sendOrderedBroadcast   method sends  broadcasts to one   receiver at a time.
As each receiver executes  in turn, it can propagate a result to the next receiver, or it  can completely abort the broadcast  so that it won't be passed to other receivers.


 The sendBroadcast method  sends broadcasts to all receivers  in an undefined order.


  The LocalBroadcastManager method sendBroadcast , sends broadcasts to receivers that are in the same app as the sender. If you don't need to send broadcasts  across apps, use local broadcasts.
  "


InterViewer :
"   Good!  , You  Have Very Well Answerd to  All Your Question. "

Thursday 26 January 2017

why did you leave your last job ? experience interview reply



Interviewer Asked : 

"Why did you leave your last job ?  "  


Remember 

 Interviewer  Asked this question :   because  interviewer is likely looking for:
     

Did he leave for a good reason?  the interviewer will wonder if they can trust you to be responsible, loyal, and reasonable.  

  Did he leave  because of performance or integrity issues.  

Did he leave for positive reasons or because he felt slighted or unappreciated?



Candidate Reply :

"I have been at my company for three years now and have learned a lot from working with excellent developers and creative peoples .  In that period , i have been promoted many times and has been appreciated for my efforts and excellent problem solving skills. I have been thinking for a while that I’d like to work for a bigger company with more opportunities for growth. This position really appeals to me , because of my successful background in development and research  and to work with team to bring out more innovative products."


Things to Understand is :

First, this candidate reminds the interviewer that he has had a respectable tenure at his firm and has been promoted .

Next, he shares a positive reason for wanting to leave — he wants to take on new challenges, he wants to stretch himself. 


So interviewer finds positive reason for leaving last job


Search Any topic , section , query