ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
I tried the following code as it is on suse 10.3 with the default gcc compilor! While compilation it gave a warning but still compiled without errors and gave the expected output !
int main ()
{
printf ("\nThank God !\n");
return 0;
}
You can probably write it using assembly. But, what a stupid interview question. When would you ever need to do this ? Goodness, how much dumber can they get.
All of a sudden the servers all crash, but one is left in a state of limbo, nothing works except gcc and nasm, but the standard libraries have been disabled/deleted. Your only hope is to use gcc or nasm to write a small program to say "hello world", thus telling everyone that everything is ok and not to panic.
You can probably write it using assembly. But, what a stupid interview question. When would you ever need to do this ? Goodness, how much dumber can they get.
I suspect that the point of the question is to probe creativity and general knowledge. When I was interviewing, I'd ask questions like this. The point wasn't to write such a program - what I wanted to hear was HOW you'd write it. Do you know the difference between a system call and a library call? Do you know what /dev/tty is?
And no, "That's dumb" wouldn't have been a good answer :-)
I suspect that the point of the question is to probe creativity and general knowledge. When I was interviewing, I'd ask questions like this. The point wasn't to write such a program - what I wanted to hear was HOW you'd write it. Do you know the difference between a system call and a library call? Do you know what /dev/tty is?
And no, "That's dumb" wouldn't have been a good answer :-)
Oh, well, but they didn't ask how. They asked you to do it.
I'm sure they could have come up with not only something better, but something meaningful.
Oh, well, but they didn't ask how. They asked you to do it.
I'm sure they could have come up with not only something better, but something meaningful.
Not to be pedantic, but seeing a written program also answers "how" :-)
Interviewing is tough. A lot of people who really aren't worth hiring can answer the easy stuff. Stepping outside of comfort zones, even if unrealistic, can tell you a lot about a persons true abilities.
It's especially the case when you aren't necessarily looking for specific skills so much as general problem solver.
BTW, Google is famous for asking tough interview questions - sometimes very specific, but sometimes real flights of fancy.
You can probably write it using assembly. But, what a stupid interview question. When would you ever need to do this ? Goodness, how much dumber can they get.
All of a sudden the servers all crash, but one is left in a state of limbo, nothing works except gcc and nasm, but the standard libraries have been disabled/deleted. Your only hope is to use gcc or nasm to write a small program to say "hello world", thus telling everyone that everything is ok and not to panic.
No, the question is not dumb, and there are real needs for things like that.
When I was much younger, I managed to understand how "C" runtime in Borland's Turbo-C was linked to 'main' and how to avoid the linking.
After that I managed to use that Turbo-C to write in "C" for bare metal (with bare minimum inline assembly). That was my job at the time - to write for bare metal. And I was using VGA memory directly for output, so even BIOS was bypassed. And it was actually interesting and useful - I used to "allocate" different screen areas (i.e. various areas in VGA memory) for different diagnostic messages, so I could effectively have a number of checkpoints in my program.
Furthermore, VGA memory was big enough for some small programs/tests - for example, I could test a potentially faulty RAM module - the memory test resided in that VGA memory in the page not currently displayed on screen.
From time to time I (still ?) see job ads with part of job description being programming for bare metal.
Distribution: Damn Small Linux, KateOs, M$ Ickdows Vista, My own OS
Posts: 1,243
Thanked: 60
Quote:
Originally Posted by Sergei Steshenko
No, the question is not dumb, and there are real needs for things like that.
When I was much younger, I managed to understand how "C" runtime in Borland's Turbo-C was linked to 'main' and how to avoid the linking.
After that I managed to use that Turbo-C to write in "C" for bare metal (with bare minimum inline assembly). That was my job at the time - to write for bare metal. And I was using VGA memory directly for output, so even BIOS was bypassed. And it was actually interesting and useful - I used to "allocate" different screen areas (i.e. various areas in VGA memory) for different diagnostic messages, so I could effectively have a number of checkpoints in my program.
Furthermore, VGA memory was big enough for some small programs/tests - for example, I could test a potentially faulty RAM module - the memory test resided in that VGA memory in the page not currently displayed on screen.
From time to time I (still ?) see job ads with part of job description being programming for bare metal.
Thats different, linux is a high level protected mode environment that you cannot just call interrupt 0x10 to do the printing.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.