So how does interviews go…
Q: java/Unix ?
Q: How many terminals.
A: 7 of them inclusive of one GUI.
FOUND OUT LATER (FOL) : There can be more than 1 GUI..gota tweak on that.
Q: Have you used semaphores
Q: So how do you implement semaphores.
A: Glup!….eh…oh yeah…using POSIX library
I KNEW IT…BUT…(IKIB) : The kernel semaphores can also be used.
id = semget(KEY, 1, 0666 | IPC_CREAT);
semctl(id, 0, SETVAL, argument)
struct sembuf operations;
* Set up the sembuf structure. */
/* Which semaphore in the semaphore array : */
operations.sem_num = 0;
/* Which operation? Add 1 to semaphore value : */
operations.sem_op = 1;
/* Set the flag so we will wait : */
operations.sem_flg = 0;
/* So do the operation! */
retval = semop(id, operations, 1);
Q: What chmod?..have you used it.
A: Yes. It is used to change the read write execute permissions.
Q: okay. So what is the particular string you will use to change provide full permission.
A: …You will have to set 111 in all the fields…(gosh my head count it quick…4+2+1..what is it 666 or 777 …666 is devil…gosh you got no time they are giving up on you…blurt it out..)…777
Q: Yeah. That is right. So what is tar used for.
A: Well it is used for making a compressed package. The command would be tar -xvzf….the softwares come as a tar ball. of type tar.bz
FOL : tar just packages. by mentioning x while packaging you are asking the tar to pull up the zipping program once it is done with the packaging.
Q: Have you accessed ports from unix?
A: Yes. The parallel and serial ports. (But then they probably were asking about the sockets!! Good that they didn’t dig up on this point.)
Q: What is the editer that you are familiar with?
A: The VIM ( we use it every day to clean the dishes!!)
Q: So what is the difference between VI and VIM.
A: VIM is colorful. ( now that is a BIG point…do you have any idea how hard it is to write a program when everything you type appears in the same color!! the lack of color will account to 10 extra compilation errors..and errors aren’t a scanty thing as far as i am concerned…so VIM is COLORFUL and thatz it.)
Q: Well ..do you know what the expansion of VIM is ? it is VI Multiple… that is you can open multiple files for edit.
A: Oh yes…using the ! mark to trigger another command (…or better stated as ‘See I know it.You didn’t ask the question right.’)
FOL : all the answers were blunders. ‘!’ is used to run a terminal command and that is not proper way of opening up multiple windows for edit. ESC + : + e does that magic
Edit /etc/vim/vimrc and uncomment line 20 to ‘syntax on’ – that would make a color less vim colorful. But VI is COLORLESS.
Some things worth a try …what would all these be ??:
:hi LineNr ctermfg=6
more info on the DIFFERENCES at : http://www.dc.turkuamk.fi/docs/soft/vim/vim_diff.html
Q: What is the difference between Find and Grep?
A: Find is for file seach. Grep can search inside the contents of the file too.
Q: So how will you do a search inside directories?
A: grep -r. I will do a ‘man grep’ and find out
Q: How would you give a batch of jobs for execution in unix?
A: I will write a shell script. (Was that the answer?)
Q : Well …how will you perform tasks in background?
A: I don’t have an idea.
FOL : bg and fg. puts process in background and foreground.
Q: how do you find out the status of a process?
A: ps -ax.
Q: How will find out the return value of a process?
A: echo the return value.
Q: yes. But how do you do it.
A: (NO. You are not supposed to ask that question) echo command-name maybe.
Q: That will just print the command name you have given.
A: I don’t know sir. In java when you trigger a program using exec. And then do a process.waitfor() the return value of the process can be found and checked upon for further execution sequence.
FOL : Answer is simply echo $?
Q: okay Anjali. That would be it. We will intimate further details through the HR.
A: Thank you.