If you’re interviewing for a role as a web developer (or looking to hire one), you’ve got to cover a lot of ground. Have a look at these 20 questions to help you cover the basics of web development. With these, you should be able to tackle an interview with flying colors.

Server

1. Nginx VS Apache, which one is faster, and why?

Nginx is definitely faster. The main reason is that it’s made to handle just HTML and static content, as well as the fact that it’s event-based.

So less threads => less memory => higher efficiency.

Noticeably, Apache 2.4+ versions also have event-based request handling. Since then the speed seems to match up with Nginx. Hence, the differences are not very noticeable.

2. Should we put code on a server and DB located on a different continent?

Definitely not. The latency between the code base and the DB itself already costs too much load time. This will result in a very slow load-speed. Hence the abandon-rate will also skyrocket.

It’s best to put them on the same Data Center.

3. Should we implement memory cache on a server that has 512MB RAM?

No, we should not. 512MB is not enough to cache anything efficiently. The cache would end up eating all the RAM and leave no room for the actual web server and its modules to run.

Or it would actually never get enough RAM to handle caching.

In that case, we should just implement disk-caching.

4. How can we point a real domain to localhost for development?

This is a developer-trick. Most CMS’s have fixed domains per code-base. Hence they would get redirected if another domain is pointed there. However, we can use the hosts file to overcome this and point the active domain to localhost for development.

5. Do you ever use version control? Which? Why? How often?

Yes, Git or SVN or Mercurial

Why: Because when developing, code changes rapidly. Amateurs may use Undo & Redo to recover lost work of short time, but that process is dangerous. A working version of the code may be lost.

That’s why you should always use version control to keep track of changes. Anything that requires over 15 minutes of coding would require a commit.

That way, we can roll back, reuse old code, and fix bugs with ease.

6. Which do you think is the more efficient web host between Windows and Linux?

Linux is more efficient.

Scenario: Handling 1,000 CCU

With Linux, we can use 512MB RAM and run a Nginx server and disk cache. The Linux kernel only takes up about 100MB, leaving 400MB for the web serving.

Meanwhile, Windows will need at least 2GB. In that case, most of the RAM is used to run Windows itself, leaving only little for the web server.

That means we need to pay four times the money for Windows to do the same thing that Linux does.

Languages

1. What is the most popular language on the web? Why?

PHP is most popular because:

  1. It’s free.
  2. It’s used by the most popular CMS (WordPress).
  3. It’s run directly from a PHP file, which means much faster development and a shorter development cycle.

2. What do you think about PHP 7 as compared to PHP 5 regarding speed and stability?

Speed: PHP 7 is much faster than PHP 5.

Stability: PHP 7 is less stable, because many coders are using the old PHP 5 syntax, which can be deprecated or removed from V7. Fortunately, major CMS’s today have already adapted to V7. Hence it’s still safe using it.

3. Would you rather use

a) jQuery or

b) pure JS or

c) pure CSS for animation effects?

Performance-wise, it’s best to use CSS3’s animation effects. Such as fade, easing, roll, and so on.

In case of custom animations, such as parallax, we can use the jQuery library.

It’s strongly advised that you not use pure JS because of the amount of code required, and the high risk for bugs.

4. How do you identify hover effect on a mockup?

Normally, on a mockup we can see the mouse pointer which is either a hand or an arrow. This indicates that the element has a hover effect.

In case there is no pointer, there might be a side annotation on the mockup defining what background or font color changes on mouse-over. If not, we should ask the designer for clarification.

5. Are you able to make responsive web without a mobile mockup?

Certainly. For a professional developer, a mockup often is not required for mobile versions, unless in very tricky situations.

For example:

  • Menus often get hidden and open via the “burger bar”
  • Most images will span 100%, but for product/post grid it may be wise to use two columns to avoid lengthy scrolling.
  • Most text will go full screen width.
  • Overall, a responsive layout must be easy to use for the mobile user.

6. Do you use PM tools for small projects?

Many programmers get lazy and avoid using PM tools to handle small projects of less than a week. This is an unfortunate habit which can result in lengthy or abandoned projects. The reason is that things may look small at first, but grow bigger as it proceeds.

So, a good developer will put every tasks into the PM so that it has room for communication, meeting deadlines, and flexible in scoping.

Data

1. What are common causes of slow load time?

Often, slow load time is due to “slow SQL query”. Sometimes it’s due to inefficient memory usage, looping or disk accessing. It can also be caused by outdated an HDD, a slow CPU or insufficient RAM.

2. No-SQL vs SQL, which one is faster? And which one is more popular?

No-SQL is faster. A No-SQL query of a collection of one million records can be processed in a few seconds. Meanwhile, a similar query of SQL would take minutes.

Unfortunately, No-SQL is a quite recent development. Hence the adaptation rate is still low. Most major CMS’s and frameworks still use MySQL as its database.

3. Slow queries are a nightmare, right? What is a common cause and solution?

Yes they are. Slow queries can cause few seconds of delay. Bad ones can cause minutes of wait time.

Slow queries are often caused by incorrectly nested queries. These queries often end up as hundreds of thousands of results, causing MySQL’s process time to increase exponentially.  

Most common is the SELECT query with a JOIN statement of incorrectly defined conditions.

4. What does this code do? How often do you use this REPLACE statement? When?

UPDATE `table_1` SET `name` = REPLACE(`name`, ‘Johns’, ‘John’);

It’s too simple: Replace all strings “Johns” with “John” (removes an “s”) from the name field of all records in table name “table_1”.

This is rarely used, mostly in case you want to change a value inside the whole database. Often it’s the domain name when migrating site from dev to stage to production. Sometimes converting a post type or fixing a spelling mistake.

Web Services (Senior level)

1. SOAP vs REST, which one do you prefer? Why?

PHP and JavaScript developers often prefer REST because it can be called, and parsed easily with flexible input and output structure.

Meanwhile .NET and Java developers may prefer SOAP because it is more secure and strictly structured. SOAP often causes fatal errors if incorrect arguments are passed.

2. XML vs. JSON, which one do you prefer? Why?

PHP and JS developers may prefer JSON because it’s more flexible. Easily parsed using one function call.

Meanwhile, .NET and Java developers may prefer XML because they would fit into the predefined OO data type.

3. What does this code do?

$.getJSON( “test.js”, function( json ) {

 console.log( “JSON Data: “ + json);

});

An experienced developer would clearly identify that:

This is a JS code that sends out a REST call to the “test.js” file and receives an object named “json”. Upon successfully receiving this object, the JS displays this json data into the console log.

4. What does API stand for? How important is it?

API stands for Application Program Interface. It is VERY important nowadays because most applications are multi-tiered.

Example:

A web page may attach to a DB on a centralized server. While an iOS or Android app would hook to the same DB as well. Now, these three apps may be written using different languages and they can’t talk directly to each other. That’s why they need to communicate using API.