Developer Interview Questions

269,104 developer interview questions shared by candidates

Given a list of people's names, organize a beer exchange such that each person is randomly assigned someone else to give a beer to, and someone to receive a beer from. Caveat: The person cannot receive a beer from the same person to whom they are gifting one.
avatar

Developer

Interviewed at Affinio

3.5
May 13, 2017

Given a list of people's names, organize a beer exchange such that each person is randomly assigned someone else to give a beer to, and someone to receive a beer from. Caveat: The person cannot receive a beer from the same person to whom they are gifting one.

What is the output of below program. var a = [1,2,3,4] for (var i=0; i<a.length; i++){ setTimeout(function(){ console.log(i) },1000) } ( My Ans : it will print 4 5 times as it will store the latest reference) Next They asked me : How can i print 1,2,3,4 by changing some code in above example
avatar

Senior UI Developer

Interviewed at ValueLabs

4
Feb 16, 2018

What is the output of below program. var a = [1,2,3,4] for (var i=0; i<a.length; i++){ setTimeout(function(){ console.log(i) },1000) } ( My Ans : it will print 4 5 times as it will store the latest reference) Next They asked me : How can i print 1,2,3,4 by changing some code in above example

You’re writing a monitoring app that periodically checks if a website is up. Of those listed below, what is the BEST way to schedule these periodic checks? A. Register a WakeLock with PowerManager. B. Call setInexactRepeating on AlarmManager. C. Post to a Handler with postDelayed. D. Call setPeriodicTimer on TimerService.
avatar

Android Developer

Interviewed at Meta

3.5
May 1, 2015

You’re writing a monitoring app that periodically checks if a website is up. Of those listed below, what is the BEST way to schedule these periodic checks? A. Register a WakeLock with PowerManager. B. Call setInexactRepeating on AlarmManager. C. Post to a Handler with postDelayed. D. Call setPeriodicTimer on TimerService.

Viewing 491 - 500 interview questions

Glassdoor has 269,104 interview questions and reports from Developer interviews. Prepare for your interview. Get hired. Love your job.