Why should we hire you?

I sincerely believe that I’m the best person for the job. Like other candidates I have the ability to do this job. But beyond that ability I offer an additional quality that makes me the very best person for the job — my drive for excellence. Not just giving lip service to excellence but putting every part of myself into achieving it. Throughout my career I have consistently strived to become the very best I can become. The success I’ve attained in my management positions is the result of possessing the qualities you’re looking for in an employee.

Source here.

What demonstrates good code quality?

Efficient, reliable, high availability (services), secure, maintainable, reusable, extensible.

Good code is easy to understand, use, and maintain. Variables, functions, classes, etc, should be named in an appropriate manner, enabling the next person after you to effectively reuse or modify them.

It should be well tested. The code should have high test coverage – this will help you write code that works thoroughly, and help avoid any regressions in code functionality once more work is done on it in the future.

The code should demonstrate low coupling and high cohesion. From stackoverflow:

Cohesion refers to what the class (or module) will do. Low cohesion would mean that the class does a great variety of actions and is not focused on what it should do. High cohesion would then mean that the class is focused on what it should be doing, i.e. only methods relating to the intention of the class.

Example of Low Cohesion:

-------------------
| Staff           |
-------------------
| checkEmail()    |
| sendEmail()     |
| emailValidate() |
| PrintLetter()   |
-------------------

Example of High Cohesion:

----------------------------
| Staff                   |
----------------------------
| -salary                 |
| -emailAddr              |
----------------------------
| setSalary(newSalary)    |
| getSalary()             |
| setEmailAddr(newEmail)  |
| getEmailAddr()          |
----------------------------

As for coupling, it refers to how related are two classes / modules and how dependent they are on each other. Being low coupling would mean that changing something major in one class should not affect the other. High coupling would make your code difficult to make changes as well as to maintain it, as classes are coupled closely together, making a change could mean an entire system revamp.

All good software design will go for high cohesion and low coupling.

 

Source here.

Tower of Hanoi in PHP

<?php


function moveTower($height, $fromTower, $toTower, $viaTower)
{
	echo $height  . "<br>";
	if ($height >= 1)
	{	
		moveTower($height-1, $fromTower, $viaTower, $toTower);
		moveDisk($fromTower, $toTower);
		moveTower($height-1, $viaTower, $toTower,  $fromTower);
	}
	else
	{
		//moveDisk($fromTower, $toTower);
	}
	
}

function moveDisk($a, $b)
{
	echo "Moving disk from" . $a . " to " . $b . "<br>";
}


moveTower(3, 'A','B','C');
exit; 

Yelp phone screening interview

During my interview with Yelp today I was asked the following questions:

  1. Why would you like to work for Yelp?
  2. How many bits can be represented by a single octal digit? Answer: 3 Source
  3. What should be the sizeof(int) on a 64 bit machine?
  4. How many bits can be represented by a single octal digit?
  5. On which data structure it would be faster to perform binary search linked list or sorted array?
  6. What is the worst case time of inserting element in the beginning linked list?
  7. What is the number for the kill signal in unix?
  8. How does a domain name map to a server on the internet?
  9. What does ssl stand for?
  10. Something about finding all references of a word or function under linux. I said use grep command and it seemed to be right.
  11. Something about mutable in Python. I don’t know Python so I didn’t answer it.