Buddha

Buddha
Seek

Thursday, February 24, 2011

Interview Questions - 3

Google Interview Questions.

Interview Type: Telephonic
Interview Duration: 30 mins

1. What is the default signal generated by kill command ?

2. What is a sticky bit ?

3. Given a path, which system call returns the information about the inode ?

4. Given 10000 16 bit integers, and unlimited memory, what is the quickest way to count the total number of bits set in the array.

5. Given four operations
a. Read from CPU reg
b. Disk Seek
c. Context switch
d. Read from main memory

Rank them in order of speed.

6. Average case and worst case running time for quick sort.

7. What is the opposite of malloc in C.

8. Value of "a"[3 >> 1]

Wednesday, February 23, 2011

Interview Questions - 2

Some more questions:

Type: Data Structures
Company Type: Web, Software, e-Commerce

1. Given is a linked list, in which the Node data is the address of another node (e.g. Data of node 3 is storing address of node 5, data of node 5 is storing address of node 2, etc). How can you copy this linked list ?

Catch is when you copy memory changes, hence the data should change accordingly.

2. Given a Directed Graph, design an algorithm which can detect if there is a loop or not.

3. Given a Binary tree, where each node stores a certain value, find the average at the node.

4. Given an unsorted array, a number 'k', find how many pairs in the array sum up to the value 'k' in the most efficient way. Time complexity should be O(n).

5. Given 2 sorted arrays, and 1 array big enough to accomodate the other array [enough empty space], write a program to get the final array in O(m+n).

Tuesday, February 22, 2011

Interview Questions - 1

Interview Month: February
Interview Position: Software Engineer
Interview Duration: About 30 minutes
Interview Company Type: Networking

1. Whats the library used for threading in C on Unix based systems ?

2. What is the pthread library call used to create a new thread and the parameters to the call?

3. How do you think the pthread_lock() is implemented ?

4. Will this work for multi processor/core systems also ? {This question asked in many interviews}
Dont know a proper answer to this question yet. Any links would be helpful.

5. What is malloc? System call or Library Call? Why?

6. At what times does malloc invoke a system call? Does it always invoke?
Answer is something regarding maintaining buckets. Check out malloc implementation details

7. What is a hash-map data structure? How does it store data?

8. Advantages and disadvantages of using a hashmap. Give examples of systems where you would not use 1.

Friday, February 18, 2011

And I am back....

The desire to key my thoughts couldn't keep me away from here.

Hey everyone, look I am back.

Thursday, July 22, 2010

Bloody Hell

I have been trying to give it a thought, but I am tired now. I need some1 to design a proper looking frontpage for my website which has a lot of space and holds absolutely nothing. Bah !!

Rain ideas, good Lord.

Oh yeah, I plan to post my Bahamas pics there. :D

SVN problems over the web

The other day I was configuring my SVN over Apache for my Lab server. I had almost set it up and it was almost looking perfect when it failed to commit. So everytime i tried to commit it would give me this strange looking error.

svn: Commit failed (details follow):
svn: Server sent unexpected return value (500 Internal Server Error) in response to MKACTIVITY request for '/repos/testrep/!svn/act/b5cf039a-95ed-11df-a9f1-a38cb1af4ec0'


I am running SLES 11 and my web server runs on a virtual host and this was my subversion.conf file [relevant section] located at /etc/apache2/conf.d/subversion.conf :



DAV svn
SVNParentPath /srv/svn/repos/
SVNListParentPath On

AuthType Basic
AuthName "Commiting to repository requires a password"
AuthUserFile /srv/svn/user_access/svn_passwdfile
Require valid-user



So after a lot of trial and error and in an attempt not to make a fool of myself before the professor, I tried changing the line in my subversion.conf to this:



The old error was gone, but a new error showed up

So my final modified line ended up looking like this.



And then it worked like cream.

How I came up with the idea? It was after I read stuff from here

Friday, January 16, 2009

Man !!

It was a bright sunny day. I was drowsing, on my chair, with my head swaying from left to right like a pendulum with a frequency much slower than of a grandpa clock pendulum.

Suddenly I dreamt of coding. Wham !! I woke up, got my coffee and sat to work.

Damn. I was supposed to write some network shit. I realized I had swallowed the taste of network system calls. So I issued a man command:

Wabbit@ubuntu:~$ man accept
No manual entry for accept

What the fuck man ?

If you face such a problem, download and put the manpages-dev package

root@ubuntu:~# aptitude install manpages-dev

And it was done !!

Ahem!! So I coded.