Coding interview preparation
5.8K subscribers
375 photos
56 files
163 links
Download Telegram
This is a straight-to-the-point, distilled list of technical interview Do's and Don'ts, mainly for algorithmic interviews. Some of these may apply to only phone screens or whiteboard interviews, but most will apply to both.

During coding

Explain what you are coding/typing to the interviewer, what you are trying to achieve.
Practice good coding style. Clear variable names, consistent operator spacing, proper indentation, etc.
Type/write at a reasonable speed.
As much as possible, write actual compilable code, not pseudocode.
Write in a modular fashion. Extract out chunks of repeated code into functions.

Remain quiet the whole time.
Spend too much time writing comments.
Use extremely verbose or single-character (unless they're common like i, n) variable names.
Algorithms for coding interview
https://www.programcreek.com/2013/08/leetcode-problem-classification/

This post summarizes the common subjects in coding interviews, including:
1) String/Array/Matrix,
2) Linked List,
3) Tree,
4) Heap,
5) Graph,
6) Sorting,
7) Dynamic Programming,
8) Bit Manipulation,
9) Combinations and Permutations,
10) Math
MySQL Database Interview Questions for Beginners and Intermediates

1. Define SQL?

Answer: SQL stands for Structured Query Language. SQL is a programming Language designed specially for managing data in Relational Database Management System (RDBMS).

2. What is RDBMS? Explain its features?

Answer : A Relational Database Management System (RDBMS) is the most widely used database Management System based on the Relational Database model.

Features of RDBMS
Stores data in tables.
Tables have rows and column.
Creation and Retrieval of Table is allowed through SQL.

3. What is Data Mining?
Answer : Data Mining is a subcategory of Computer Science which aims at extraction of information from set of data and transform it into Human Readable structure, to be used later.

4. What is an ERD?
Answer : ERD stands for Entity Relationship Diagram. Entity Relationship Diagram is the graphical representation of tables, with the relationship between them.

5. What is the difference between Primary Key and Unique Key?
Answer : Both Primary and Unique Key is implemented for Uniqueness of the column. Primary Key creates a clustered index of column where as an Unique creates unclustered index of column. Moreover, Primary Key doesn’t allow NULL value, however Unique Key does allows one NULL value.
👍1
Typical HTML Interview Exercises

Markup validation

Consider the following markup.
Is it valid? If not, can you explain why?

#html
Answer

The markup uses the picture element, which is a pretty new addition to the specification. The code is all valid apart from the last image specified in the srcset attribute; 320y isn’t a valid value. If the y is replaced with a w, it becomes valid though.

#html
2. The main element

Can
you explain the definition of the main element? What is its goal? Are the two specifications (WHATWG and W3C) in agreement on its definition?

Answer

The main element has two different definitions depending on the specification used.

The W3C specification describes it as the main content of the page, that is, the content that describes the main topic of a page or is the central functionality of an application. The specification also states that a document must not include more than one main element.

#html
3. The small element

Describe when it’s appropriate to use the small element and provide an example.

Answer

In HTML 4.01 the small element was a presentational element to mark up smaller text. In HTML5 it should be used semantically to represent legal disclaimers, caveats, and so on. The text may well be “small”, but this isn’t required.

An example of its use is shown below:

<img src="image.jpg" alt="London by night">
<small>The copyright of this image is owned by Aurelio De Rosa</small>

#html
1
4. Images and accessibility

Is
the alt attribute mandatory on img elements? If not, can you describe a scenario where it can be set to an empty value? Does an empty value affect accessibility in any way?

Answer

The alt attribute is mandatory on img elements but its value can be empty (i.e. alt=""). An empty value is recommended when the image shown is used for decorative purposes only and therefore isn’t part of the content of the page. With regards to accessibility, if the alt attribute is empty, screen readers will ignore the image. This is highly recommended because using a value of something like “Content separator” will only disturb the user when this text is spoken.

#html
5. The time element

Is it possible to express a date range using a single time element?

Answer

No, it isn’t possible. The information can be expressed using two time elements though. For example to describe a time interval ranging from November 6, 2014 to November 9, 2014, a developer can write:

<time datetime="2014-11-06">6</time>-
<time datetime="2014-11-09">9 November 2014</time>

#html
Top JavaScript interview questions.
What's good to hear in answer and what raises red flag:

1. Can you name two programming paradigms important for JavaScript app developers?

JavaScript is a multi-paradigm language, supporting imperative/procedural programming along with OOP (Object-Oriented Programming) and functional programming. JavaScript supports OOP with prototypal inheritance.

Good to hear:

Prototypal inheritance (also: prototypes, OLOO).
Functional programming (also: closures, first class functions, lambdas).

Red flags:

No clue what a paradigm is, no mention of prototypal oo or functional programming.

#javascript #js
2. What is functional programming?

Functional programming produces programs by composing mathematical functions and avoids shared state & mutable data. Lisp (specified in 1958) was among the first languages to support functional programming, and was heavily inspired by lambda calculus. Lisp and many Lisp family languages are still in common use today.

Functional programming is an essential concept in JavaScript (one of the two pillars of JavaScript). Several common functional utilities were added to JavaScript in ES5.

Good to hear:

🔹 Pure functions / function purity.
🔹 Avoid side-effects.
🔹 Simple function composition.
🔹 Examples of functional languages: Lisp, ML, Haskell, Erlang, Clojure, Elm, F Sharp, OCaml, etc…
🔹 Mention of features that support FP: first-class functions, higher order functions, functions as arguments/values.

Red flags:

🔻 No mention of pure functions / avoiding side-effects.
🔻 Unable to provide examples of functional programming languages.
🔻 Unable to identify the features of JavaScript that enable FP.

#javascript #js
3. What is the difference between classical inheritance and prototypal inheritance?
Class Inheritance: instances inherit from classes (like a blueprint — a description of the class), and create sub-class relationships: hierarchical class taxonomies. Instances are typically instantiated via constructor functions with the new keyword. Class inheritance may or may not use the class keyword from ES6.
Prototypal Inheritance: instances inherit directly from other objects. Instances are typically instantiated via factory functions or Object.create(). Instances may be composed from many different objects, allowing for easy selective inheritance.

In JavaScript, prototypal inheritance is simpler &
more flexible than class inheritance.


Good to hear:
🔹 Classes: create tight coupling or hierarchies/taxonomies.
🔹 Prototypes: mentions of concatenative inheritance, prototype delegation, functional inheritance, object composition.

Red Flags:
🔻 No preference for prototypal inheritance & composition over class inheritance.

#javascript #js
4. When is classical inheritance an appropriate choice?

The answer is never, or almost never. Certainly never more than one level. Multi-level class hierarchies are an anti-pattern. I’ve been issuing this challenge for years, and the only answers I’ve ever heard fall into one of several common misconceptions. More frequently, the challenge is met with silence.

“If a feature is sometimes useful
and sometimes dangerous
and if there is a better option
then always use the better option.”

~ Douglas Crockford

Good to hear:

🔹 Rarely, almost never, or never.
🔹 A single level is sometimes OK, from a framework base-class such as React.Component.
🔹 Favor object composition over class inheritance.

#javascript #js
5. When is prototypal inheritance an appropriate choice?

There is more than one type of prototypal inheritance:

- Delegation (i.e., the prototype chain).
- Concatenative (i.e. mixins, Object.assign()).
- Functional (Not to be confused with functional programming. A function used to create a closure for private state/encapsulation).

Each type of prototypal inheritance has its own set of use-cases, but all of them are equally useful in their ability to enable composition, which creates has-a or uses-a or can-do relationships as opposed to the is-a relationship created with class inheritance.

Good to hear:

🔹 In situations where modules or functional programming don’t provide an obvious solution.
🔹 When you need to compose objects from multiple sources.
🔹 Any time you need inheritance.

Red flags:

🔻 No knowledge of when to use prototypes.
🔻 No awareness of mixins or Object.assign().

#javascript #js
Simple HTML questions for beginners:

1) What is HTML
?

HTML stands for Hyper Text Markup Language. It is a language of World Wide Web. It is a standard text formatting language which is used to create and display pages on the Web. It makes the text more interactive and dynamic. It can turn text into images, tables, links.


2) What are Ta
gs?

HTML tags are composed of three things: an opening tag, content and ending tag. Some tags are unclosed tags.

HTML documents contain two things: content and tags

When a web browser reads an HTML document, the browser reads it from top to bottom and left to right. HTML tags are used to create HTML documents and render their properties. Each HTML tags have different properties.

<tag> content </tag>


3) Do all HTML tags have an end
tag?

No. There are some HTML tags that don't need a closing tag. For example: <image> tag, <br> tag.


4) What is formatting i
n HTML?

The HTML formatting is a process of format the text for a better look and feel. It uses different tags to make text bold, italicized, underlined.
More details.



5) How many types of heading does an HTM
L contain?

The HTML contains six types of headings which are defined with the <h1> to <h6> tags. Each type of heading tag displays different text size from another. So, <h1> is the largest heading tag and <h6> is the smallest one. For example:
<h1>Heading no. 1</h1>
<h2>Heading no. 2</h2>
<h3>Heading no. 3</h3>
<h4>Heading no. 4</h4>
<h5>Heading no. 5</h5>
<h6>Heading no. 6</h6>
More details.
6) How to create a hyperlink in HTML?

The HTML provides an anchor tag to create a hyperlink that links one page to another page. These tags can appear in any of the following ways:

* Unvisited link - It is displayed, underlined and blue.
* Visited link - It is displayed, underlined and purple.
* Active link - It is displayed, underlined and red.


7) Which HTML tag is used to display the data in the tabular form?

The HTML table tag is used to display data in tabular form (row * column). It also manages the layout of the page, e.g., header section, navigation bar, body content, footer section.


8) What are some common lists that are used when designing a pag
e?

There are many common lists which are used to design a page. You can choose any or a combination of the following list types:

* Ordered list - The ordered list displays elements in numbered format. It is represented b
y <o
l> tag.
* Unordered list - The unordered list displays elements in bulleted format. It is represented b
y <u
l> tag.
* Definition list - The definition list displays elements in definition form like in dictionary. Th
e <d
l>
, <dt
> a
nd <d
d> tags are used to define description list.


9) What is the difference between HTML elements and tag
s?

HTML elements communicate to the browser to render text. When the elements are enclosed by brackets <>, they form HTML tags. Most of the time, tags come in a pair and surround content.


10) What is semantic H
TML?

Semantic HTML is a coding style. It is the use of HTML markup to reinforce the semantics or meaning of the content. For example: In semantic H
TML <b> <
/b> tag is not used for bold statement as well as <i> </i> tag is used for italic. Instead of these we
use <strong></stro
ng>
and <em><
/em> tags.