Tech IndustryDec 7, 2018
Capital Oneda2de2se

Trick question @ phone screen

How would you answer this? “There is an application running in a machine with 1 KB memory and this application eventually terminates. How long can such an application run?” PS - apparently “until it runs out of memory” is not the answer.

Add a comment
Starbucks bakedbread Dec 7, 2018

What clarifying questions did you ask? What assumptions did you make? You know, like what the fuck does the application do, how does the app and machine handle memory, what kind of machine... for starters.

Capital One da2de2se OP Dec 7, 2018

I did mainly ask what the application does, to which I was told “it updates its state and eventually terminates”. That’s all I could get out of the interviewer.

Starbucks bakedbread Dec 7, 2018

Bro for something like this you have to then make assumptions about memory management on both the app and machine and give several scenarios of how the app will eat up memory and term. Memory leaks?

Microsoft Dhatt Dec 7, 2018

This question is very vague and open ended. You could talk a lot about operating systems, app runtimes, memory management, system architecture etc. Since it's a phone screen, they would probably like to know how broad and deep you know about computers.

Starbucks bakedbread Dec 7, 2018

Also, not a trick question.

New
NeedPrayer Dec 7, 2018

What company interview was this?

Capital One da2de2se OP Dec 7, 2018

One of the FAANG

New
NeedPrayer Dec 7, 2018

Your answer is vaguer than this interview question. Wtf is wrong with you. Just say the company name!

Microsoft cloudfirst Dec 7, 2018

142 years? while (datetime.now.year < 2161);

New
CgYukio Dec 7, 2018

WTF BS

Jane Street Capital wCYe52 Dec 7, 2018

If it eventually terminates, that means it doesn't go into an infinite loop. Which means it can't hit the same state twice. How many different states can 1KB of memory represent? That's the max number of cycles it can go through.

Amazon L6SDE Dec 7, 2018

Don’t forget about register states.

Cisco Infensus Dec 7, 2018

Computers aren't real

Medallia hFEH36 Dec 7, 2018

it can run for a long time if well designed and written or can terminate immediately.

Salesforce 5"6Indian Dec 7, 2018

I don't remember enough about base memory consumption by processes. But it seems to me there will be some overhead due to OS stuff. So your program itself will have 1024 - X = memoryLeft And then with that memory left you can generate 2^8 states for each byte. So you have 2^8 * memoryLeft states you can transition through. But we don't have to transition linearly. The pattern of traversal can be super convoluted. Even a linear transversal could take longer than the universe. And we can get a whole lot more than that. Not to mention all the delays between transitions, like sleep timers, etc. So it's hard to say, but I'd head down this path of logic and see what his reaction was ------- Edit: Actually, can we only visit each state once? I guess I was thinking of state transitions wrongly maybe.

Amazon STNF77 Dec 7, 2018

It's not a trick question. The upper bound on program execution time is the number of distinct states that the computer could be in multiplied by instruction execution time.

Capital One da2de2se OP Dec 7, 2018

What area of topic does this fall under?

Amazon STNF77 Dec 7, 2018

Automata theory