Google Interview Question for Software Engineer in Tests






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

a forkbomb might do it

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

How about writing a small code like main { main(); }

- Anonymous March 01, 2011 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

Good old forkbomb :) I accidentally crashed my school servers the night before a big assignment was due :)instant hero status :) and yes, it was pretty instant...

- Jon March 05, 2011 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

main { main(); } will not work since it's a tail recursion. The compiler will perform an optimization to pop the previous main() call out of the stack before pushing the new call. This will just cause an infinite loop.

- Vil February 24, 2013 | Flag
Comment hidden because of low score. Click to expand.
1
of 1 vote

Segmentation False will throw out but I don't think it did crash the system entirely. MS products will do.

- Saimok February 27, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
1
of 1 vote

Take it to the top of the building and drop it.

- Kishore February 28, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
1
of 1 vote

Randomly kill de system processes...whatever u do with a program like c wont crash de system cos a good os wont allow it

- Anonymous March 01, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

I think, killing system process is good answer

- siva.sai.2020 March 02, 2011 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

Not possible in Unix

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

well if its just about a program we can always make a pointer reference to 0.

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

I does not crash the system

- piwi January 24, 2013 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

set two register 1 and 0 divide 1/0

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

A HW fault occurs but system wont crash.

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

Install Windows ....

- Vivek Narang February 28, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Kidding ..... I also feel that a forkbomb should work ...

- Vivek Narang February 28, 2011 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

using malloc and calloc function without freeing the memory will fill all the RAM.... but to crash entire system create a txt file in OS DIR by using 'C'. now jump the file poiter and write garbage things at random location.... somewhere it will be corrupting sys files.... and thats all... sys crashed...!

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

ForkBomb it is :D

- Aman March 01, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

How about writing a small piece of code like -
main()
{
main();
}

- Anonymous March 01, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

AFAIK that will only cause an infinite loop - it will freeze the program but won't crash the system. a forkbomb can be implemented like this..it has a similar concept to what you did except instead of calling itself again and again, it will make a new process and both will call it, then 4 processes, etc...2^n processes will be made:

#include <unistd.h>
 int main(void)
{
  for(;;)
    fork(); /* each time this is called, # processes *=2 */
  return 0;
}

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

Forkbombs are *not* the answer - it is quite easy to limit the number of processes that a given user may have running at a given time. The only way to crash a system "immediately" is to remove the power source or to cause some serious trauma to the hardware (see: securing your windows box using nothing but a hammer)

- Oliver March 01, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

sorry, the only way to *reliably* crash a system immediately

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

Which OS system it is ?

The question is not clear every onethinks it is Windows OS. It could be other OSs too

- Subbu March 02, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

My god. The question is to ask you to break it immediately. So just open the computer and bread the motherboard by hand.

- bylike March 04, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

sudo delete system files.
Or can we just install an image to overwrite all system files...
Or can we do something in firmware?

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

The best ways to crash a system:
1. Memory overload. Create an RT process with a high consuming ever increasing memory. Crashes Linux, if the RT process is running as root
2. Over write the swap partition, and do a memory overload. Corruption occurs.
3. In Linux, write a kernel program, that can cause kernel panic when called. (Similar to ever popular blue screen of Windows)

Somehow all these things will work in Linux or Windows. I believe Solaris and AIX have internal defense for such issues, with stuff like pre-emptive kernels

- Anuj Tripathi March 07, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Anuj,

Your answers all seem to assume you have root access. If you do have root access, surely a forkbomb is the easiest way to go (you can even override the number of proccess per user limitation if there is one). I think the challenge of the question is to freeze a per user memory and proccess limited system under a normal user.

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

I think this should work if you are super user

sudo rm -r /*

- Sandeep March 16, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

if there's a way to crash the system without sudo - meaning cause kernel panic, then its a security issue. so there can't be a way to do it without sudo.
if i have sudo, i'll download the kernel source code, add a seg fault inside the kernel, compile it, and replace the kernel executable in the filesystem.
sudo reboot and you'll get kernel panic.

- M March 18, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

How about "del *.*" in windows?

- Kartik May 08, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Windows doesn't allow to delete the files which are in use.

- sathishp123 June 15, 2011 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

try this under bash :-)

.(){ .|.& };.

- iral May 27, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

This question did not state you had to write a program or do anything at the command prompt so a six year old kid could give a better answer than what has been given so far.

How about something as novel as disconnecting the power cord from the computer???
I bet that will crash any computer no matter which operating system you are using :-)

Actually, a six year old kid would probably not come up with that kind of an answer.
A kid answer would likely be smearing peanut butter on the mother board and then pour milk on the central CPU.

- Anonymous February 21, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

In this day and age, you think removing the power cord will crash the system? There are these devices called laptops which have batteries in them now so that plan may not work. Also UPS supplies....so other tricks like milk might work, but why waste milk when water can do the same or just use your body weight to crush the pieces.

- Seriously December 03, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

Just write a simple code

while(malloc(sizeof(char)));


It will keeps on allocating the memory until memory finishes and then system will crash as there no memory for any other process...

- Ajay September 14, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

That is not immediate, assuming that it even crashes the system.

- Anonymous September 15, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

just remove the power system will crash....

- Anonymous July 24, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

shut down your system

- Sharingan23_Ra@yahoo.co.id October 16, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

unplug the memory stick,hard drive or display card from the main board

- anonymous January 18, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Just kill the 'init' process of the system.
'init' is the root of all the process so if you kill this your system will crash.

- Abhishek Singh June 13, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

linux:
dd if=/dev/urandom of=/dev/mem
sysrq
unplug hardrive/ram etc

- asterlabaster September 01, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

install windows and wait for the blue screen error. MAC FTW

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

What a fucking moron...i can't believe guys like you manage to get jobs in good companies..

- Moron February 27, 2011 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

dude come on. look out the other answers and see how stupid they are too. get over with it.

- Anonymous February 28, 2011 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

I like his answer.... clearly he was just knocking windows, which is junk I have to use, compared to the reliability of mac, linux, or unix for that matter.... Until recent years windows would crash without regularly... at least it consistently sucked

- Jon March 05, 2011 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

linux? if I could count the times I've turned on my linux machine and something else broke and it wouldn't turn on...

- lol October 10, 2012 | Flag


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