Adobe Interview Question for Software Engineer / Developers






Comment hidden because of low score. Click to expand.
0
of 0 vote

I believe that we want to run only one instance of a GIVEN exe. Say if is is abc.exe then if abc.exe is running, we can't run one more abc.exe in parallel, but we can run other exe like def.exe, dff.exe etc.
If this is the question then, we can use following check before executing the exe.

<< UNIX Script>>
if[ $(ps -ef | grep abc.exe | grep -v grep | wc -l) -eq 0 ]; then
execute abc.exe
fi

- Anurag Singh February 05, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Use a semaphore with count 1.
Check the semaphore in the initinstance() method.
For first instance it would come down to zero and no othere instance could be created.

- ManishSindhi February 05, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

I think this question may want to have a Singletron.
public class Singletron{

public static Singletron OnlyInstance;
private class Singletron(){}
public Singletron getInstance(){

if(OnlyInstance == null)
OnlyInstance = new Singletron();
return OnlyInstance;

}
/**** Other Class attributes and Methods ***/
}//end class

- Saimok February 06, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

The getInstance() method also should be static.

- Ashok March 24, 2011 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

Create a tmpfile and lock with flock

- Anonymous February 06, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

We want a only one instance of a process to be running at any given point. If we have the access to change the executable, we acquire a MUTEX with some name (say "onlyoneinstance") at the start of the process, and release this once we exit the process. If we are not able to acquire this MUTEX in the executable, we just exit.

This way only one instance of the executable will be running at any point of time.

- Gautam G February 12, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

I think it asks as to return only single object every time:


public class OnlyOneObject {
static OnlyOneObject obj;
static int count=0;

public static OnlyOneObject getIt(){
if(count==0)
{
obj=new OnlyOneObject();
count++;
return obj;
}
else
return obj;
}

public static void main(String[] args){

System.out.println(getIt().hashCode());

System.out.println(getIt().hashCode());
}
}

- y so serious May 10, 2012 | Flag Reply


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More