Beruflich Dokumente
Kultur Dokumente
Q7 : What is npm?
Q8 : What is webpack?
Q9 : What is blockchain?
Q11 : What is DOM (Document Object Model) and how is it linked to CSS?
Q15 : What are different HTTP Methods supported in Restful Web Services?
Q26 : Could you explain the difference between ES5 and ES6
Q29 : Given two strings, return true if they are anagrams of one another
Q32 : How would you choose between SOAP and REST web services?
Q37 : What are the advantages and disadvantages of using "use strict"?
Q41 : How does the “this” keyword work? Provide some code examples.
Q45 : What should be the purpose of OPTIONS method of RESTful web services?
Q48 : Explain difference between: function Person(){}, var person = Person(), and var person = new
Person()?
Topic: JavaScript
In JavaScript conversion between different two build-in types called coercion. Coercion comes in two forms
in JavaScript: explicit and implicit.
var a = "42";
var b = Number( a );
a; // "42"
b; // 42 -- the number!
var a = "42";
a; // "42"
b; // 42 -- the number!
Topic: JavaScript
Strict comparison (e.g., ===) checks for value equality without allowing coercion
Abstract comparison (e.g. ==) checks for value equality with coercion allowed
var a = "42";
var b = 42;
a == b; // true
a === b; // false
If either value (aka side) in a comparison could be the true or false value, avoid == and use ===.
If either value in a comparison could be of these specific values (0, "", or [] -- empty array), avoid ==
and use ===.
In all other cases, you're safe to use ==. Not only is it safe, but in many cases it simplifies your code
in a way that improves readability.
Topic: JavaScript
In JavaScript, each function gets its own scope. Scope is basically a collection of variables as well as the
rules for how those variables are accessed by name. Only code inside that function can access that
function's scoped variables.
A variable name has to be unique within the same scope. A scope can be nested inside another scope. If
one scope is nested inside another, code inside the innermost scope can access variables from either scope.
Q4: What is Design Patterns and why anyone should use them? ★
Design patterns are a well-described solution to the most commonly encountered problems which occur
during software development.
Design pattern represents the best practices evolved over a period of time by experienced software
developers. They promote reusability which leads to a more robust and maintainable code.
Topic: HTML5
The alt attribute provides alternative information for an image if a user cannot view it. The alt attribute should
be used to describe any images except those which only serve a decorative purposes, in which case it
should be left empty.
Topic: DevOps
Continuous Integration (CI) is a development practice that requires developers to integrate code into a
shared repository several times a day. Each check-in is then verified by an automated build, allowing teams
to detect problems early.
Topic: Node.js
npm stands for Node Package Manager. npm provides following two main functionalities:
Topic: Webpack
Webpack is a build tool that puts all of your assets, including Javascript, images, fonts, and CSS, in a
dependency graph. Webpack lets you use require() in your source code to point to local files, like images,
and decide how they're processed in your final Javascript bundle, like replacing the path with a URL pointing
to a CDN.
Blockchain is a secure distributed ledger (data structure or database) that maintains a continuously growing
list of ordered records, called “blocks”, that are linked using cryptography. Each block contains a
cryptographic hash of the previous block, a timestamp, and transaction data.
By design, a blockchain is resistant to modification of the data. It is "an open, distributed ledger that can
record transactions between two parties efficiently and in a verifiable and permanent way".
Once recorded, the data in any given block cannot be altered retroactively without alteration of all
subsequent blocks, which requires consensus of the network majority.
Topic: JavaScript
JavaScript (and by extension TypeScript) has two bottom types: null and undefined. They are intended to
mean different things:
Q11: What is DOM (Document Object Model) and how is it linked to CSS? ★★
Topic: CSS
The Document Object Model (DOM) is a cross-platform and language-independent application programming
interface that treats an HTML, XHTML, or XML document as a tree structure wherein each node is an object
representing a part of the document.
With the Document Object Model, programmers can create and build documents, navigate their structure,
and add, modify, or delete elements and content. The DOM specifies interfaces which may be used to
manage XML or HTML documents.
When a browser displays a document, it must combine the document's content with its style information. The
browser converts HTML and CSS into the DOM (Document Object Model). The DOM represents the
document in the computer's memory. It combines the document's content with its style.
The work to be performed in the Sprint is planned at the Sprint Planning. This plan is created by the
collaborative work of the entire Scrum Team.
What can be delivered in the Increment resulting from the upcoming Sprint?
How will the work needed to deliver the Increment be achieved?
The Sprint Goal is an objective set for the Sprint that can be met through the implementation of Product
Backlog.
Topic: JavaScript
Enqueue means to add an element, dequeue to remove an element.
// For enqueue, just push the item into the first stack
function enqueue(stackInput, item) {
return stackInput.push(item);
}
return stackOutput.pop();
}
Topic: HTML5
For bonus points, you could point out that it’s illegal to place a block element inside an inline element, and
that while div can have a p tag, and a p tag can have a span, it is not possible for span to have a div or p tag
inside.
Q15: What are different HTTP Methods supported in Restful Web Services? ★★
GET,
POST,
PUT,
DELETE and
HEAD.
Topic: DevOps
A request for a resource (like an image or a font) outside of the origin is known as a cross-origin request.
CORS (cross-origin resource sharing) manages cross-origin requests. CORS allows servers to specify who
(i.e., which origins) can access the assets on the server, among many other things.
Access-Control-Allow-Origin is an HTTP header that defines which foreign origins are allowed to access the
content of pages on your domain via scripts using methods such as XMLHttpRequest.
For example, if your server provides both a website and an API intended for XMLHttpRequest access on a
remote websites, only the API resources should return the Access-Control-Allow-Origin header. Failure to do
so will allow foreign origins to read the contents of any page on your origin.
# Allow any site to read the contents of this JavaScript library, so that subresource integrity works
Access-Control-Allow-Origin: *
By using Cross Site Scripting (XSS) technique, users executed malicious scripts (also called payloads)
unintentionally by clicking on untrusted links and hence, these scripts pass cookies information to attackers.
XSS can be prevented by sanitizing user input to the application. Always allowed those elements as input
which is absolutely essential for that field.
Test driven development (TDD) is also known as test-driven design. In this method, developer first writes an
automated test case which describes new function or improvement and then creates small codes to pass
that test, and later re-factors the new code to meet the acceptable standards.
Topic: JavaScript
The use strict literal is entered at the top of a JavaScript program or at the top of a function and it helps you
write safer JavaScript code by throwing an error if a global variable is created by mistake. For example, the
following program will throw an error:
function doSomething(val) {
"use strict";
x = val + 10;
}`
It will throw an error because x was not defined and it is being set to some value in the global scope, which
isn't allowed with use strict The small change below fixes the error being thrown:
function doSomething(val) {
"use strict";
var x = val + 10;
}
Topic: OOP
Procedural programming is based upon the modular approach in which the larger programs are broken into
procedures. Each procedure is a set of instructions that are executed one after another. On the other hand,
OOP is based upon objects. An object consists of various elements, such as methods and variables.
Access modifiers are not used in procedural programming, which implies that the entire data can be
accessed freely anywhere in the program. In OOP, you can specify the scope of a particular data by using
access modifiers - public, private, internal, protected, and protected internal.
Reactive programming is programming with asynchronous data streams. Event buses or your typical click
events are really an asynchronous event stream, on which you can observe and do some side effects.
Reactive is that idea on steroids. You are able to create data streams of anything, not just from click and
hover events. Streams are cheap and ubiquitous, anything can be a stream: variables, user inputs,
properties, caches, data structures, etc. For example, imagine your Twitter feed would be a data stream in
the same fashion that click events are. You can listen to that stream and react accordingly.
Topic: JavaScript
Two non-primitive values, like objects (including function and array) held by reference, so both == and ===
comparisons will simply check whether the references match, not anything about the underlying values.
For example, arrays are by default coerced to strings by simply joining all the values with commas (,) in
between. So two arrays with the same contents would not be == equal:
var a = [1,2,3];
var b = [1,2,3];
var c = "1,2,3";
a == c; // true
b == c; // true
a == b; // false
For deep object comparison use external libs like deep-equal or implement your own recursive equality
algorithm.
Topic: JavaScript
It’s an Immediately-Invoked Function Expression, or IIFE for short. It executes immediately after it’s created:
(function IIFE(){
console.log( "Hello!" );
})();
// "Hello!"
This pattern is often used when trying to avoid polluting the global namespace, because all the variables
used inside the IIFE (like in any other normal function) are not visible outside its scope.
Q26: Could you explain the difference between ES5 and ES6 ★★★
Topic: JavaScript
ECMAScript 5 (ES5): The 5th edition of ECMAScript, standardized in 2009. This standard has been
implemented fairly completely in all modern browsers
ECMAScript 6 (ES6)/ ECMAScript 2015 (ES2015): The 6th edition of ECMAScript, standardized in
2015. This standard has been partially implemented in most modern browsers.
Consider:
and even:
Const.
Const works like a constant in other languages in many ways but there are some caveats. Const
stands for ‘constant reference’ to a value. So with const, you can actually mutate the properties of
an object being referenced by the variable. You just can’t change the reference itself.
Block-scoped variables.
The new ES6 keyword let allows developers to scope variables at the block level.
Let doesn’t hoist in the same way var does.
Default parameter values
Default parameters allow us to initialize functions with default values. A default is used when an
argument is either omitted or undefined — meaning null is a valid value.
// Basic syntax
function multiply (a, b = 2) {
return a * b;
}
multiply(5); // 10
ES6 introduces language support for classes (class keyword), constructors (constructor keyword),
and the extend keyword for inheritance.
for-of operator
Spread Operator
For objects merging
const obj1 = { a: 1, b: 2 }
const obj2 = { a: 2, c: 3, d: 4}
const obj3 = {...obj1, ...obj2}
Promises
Promises provide a mechanism to handle the results and errors from asynchronous operations. You
can accomplish the same thing with callbacks, but promises provide improved readability via
method chaining and succinct error handling.
and importing:
Topic: CSS
A CSS selector is the part of a CSS rule set that actually selects the content you want to style.
Universal selector: *
Element type selector: ul, td
ID Selector: #id
Class selector: .box
Descendant combinator: #id .box. The .box element doesn’t have to be an immediate child of #id.
Child combinator: #id > .box. Unlike the descendant combinator, there can’t be another element
wrapping .box
General Sibling Combinator: ~
Adjacent Sibling Combinator: +. The difference from general sibling combinaltor is that the targeted
element must be an immediate sibling, not just a general sibling.
Attribute Selector: input[type="text"]
Pseudo-class: a:hover. A pseudo-class uses a colon character to identify a pseudo-state that an
element might be in.
Pseudo-element: .container::before. This selector inserts an imaginary element into the page, inside
the targeted element, before its contents.
Topic: CSS
Both responsive and adaptive design attempt to optimize the user experience across different devices,
adjusting for different viewport sizes, resolutions, usage contexts, control mechanisms, and so on.
Responsive design works on the principle of flexibility — a single fluid website that can look good on any
device. Responsive websites use media queries, flexible grids, and responsive images to create a user
experience that flexes and changes based on a multitude of factors. Like a single ball growing or shrinking to
fit through several different hoops.
Adaptive design is more like the modern definition of progressive enhancement. Instead of one flexible
design, adaptive design detects the device and other features, and then provides the appropriate feature and
layout based on a predefined set of viewport sizes and other characteristics. The site detects the type of
device used, and delivers the pre-set layout for that device. Instead of a single ball going through several
different-sized hoops, you’d have several different balls to use depending on the hoop size.
Q29: Given two strings, return true if they are anagrams of one another ★★★
Topic: JavaScript
Details:
For example: Mary is an anagram of Army
Answer:
// Sort the strings, and join the resulting array to a string. Compare the results
a = a.split("").sort().join("");
b = b.split("").sort().join("");
return a === b;
}
Q30: Explain almost standard, full standard and quirks mode ★★★
Topic: HTML5
There are now three modes used by the layout engines in web browsers: quirks mode, almost standards
mode, and full standards mode.
In quirks mode, layout emulates nonstandard behavior in Navigator 4 and Internet Explorer 5. This
is essential in order to support websites that were built before the widespread adoption of web
standards.
In full standards mode, the behavior is (hopefully) the behavior described by the HTML and CSS
specifications.
In almost standards mode, there are only a very small number of quirks implemented.
For HTML documents, browsers use a DOCTYPE in the beginning of the document to decide whether to
handle it in quirks mode or standards mode.
Q31: What is HTML5 Web Storage? Explain localStorage and sessionStorage. ★★★
Topic: HTML5
With HTML5, web pages can store data locally within the user’s browser.
The data is stored in name/value pairs, and a web page can only access data stored by itself.
Data stored through localStorage is permanent: it does not expire and remains stored on the user’s
computer until a web app deletes it or the user asks the browser to delete it.
sessionStorage has the same lifetime as the top-level window or browser tab in which the data got
stored. When the tab is permanently closed, any data stored through sessionStorage is deleted.
sessionStorage is also scoped on a per-window basis. Two browser tabs with documents from the
same origin have separate sessionStorage data.
Unlike in localStorage, the same scripts from the same origin can't access each other's
sessionStorage when opened in different tabs.
Q32: How would you choose between SOAP and REST web services? ★★★
Web Services work on client-server model and when it comes to choose between SOAP and REST, it all
depends on project requirements. Let’s look at some of the conditions affecting our choice:
Do you know your web service clients beforehand? If Yes, then you can define a contract before
implementation and SOAP seems better choice. But if you don’t then REST seems better choice
because you can provide sample request/response and test cases easily for client applications to
use later on.
How much time you have? For quick implementation REST is the best choice. You can create web
service easily, test it through browser/curl and get ready for your clients.
What kind of data format are supported? If only XML then you can go with SOAP but if you think
about supporting JSON also in future then go with REST.
Always keep static contents like images, css, JavaScript cacheable, with expiration date of 2 to 3 days.
Never keep expiry date too high.
Adapter pattern works as a bridge between two incompatible interfaces. This pattern involves a single class
which is responsible to join functionalities of independent or incompatible interfaces (adaptees).
A real life example could be a case of card reader which acts as an adapter between memory card and a
laptop. You plugin the memory card into card reader and card reader into the laptop so that memory card
can be read via laptop.
Topic: OOP
An interface is a template that contains only the signature of methods. The signature of a method consists of
the numbers of parameters, the type of parameter (value, reference, or output), and the order of parameters.
An interface has no implementation on its own because it contains only the definition of methods without any
method body. An interface is defined using the interface keyword. Moreover, you cannot instantiate an
interface. The various features of an interface are as follows:
An interface is used to implement multiple inheritance in code. This feature of an interface is quite
different from that of abstract classes because a class cannot derive the features of more than one
class but can easily implement multiple interfaces.
It defines a specific set of methods and their arguments.
Variables in interface must be declared as public, static, and final while methods must be public and
abstract.
A class implementing an interface must implement all of its methods.
An interface can derive from more than one interface.
In software engineering, Don't Repeat Yourself (DRY) or Duplication is Evil (DIE) is a principle of software
development.
Q37: What are the advantages and disadvantages of using "use strict"? ★★★
Topic: JavaScript
'use strict' is a statement used to enable strict mode to entire scripts or individual functions. Strict mode is a
way to opt into a restricted variant of JavaScript.
Advantages:
Disadvantages:
Overall, I think the benefits outweigh the disadvantages, and I never had to rely on the features that strict
mode blocks. I would recommend using strict mode.
Topic: JavaScript
const applies to bindings ("variables"). It creates an immutable binding, i.e. you cannot assign a
new value to the binding.
const person = {
name: "Leonardo"
};
let animal = {
species: "snake"
};
person = animal; // ERROR "person" is read-only
Object.freeze works on values, and more specifically, object values. It makes an object immutable,
i.e. you cannot change its properties.
let person = {
name: "Leonardo"
};
let animal = {
species: "snake"
};
Object.freeze(person);
person.name = "Lima"; //TypeError: Cannot assign to read only property 'name' of object
console.log(person);
Q39: What are the features of Microservices? ★★★
Topic: Microservices
Decoupling – Services within a system are largely decoupled. So the application as a whole can be
easily built, altered, and scaled
Componentization – Microservices are treated as independent components that can be easily
replaced and upgraded
Business Capabilities – Microservices are very simple and focus on a single capability
Autonomy – Developers and teams can work independently of each other, thus increasing speed
Continous Delivery – Allows frequent releases of software, through systematic automation of
software creation, testing, and approval
Responsibility – Microservices do not focus on applications as projects. Instead, they treat
applications as products for which they are responsible
Decentralized Governance – The focus is on using the right tool for the right job. That means there
is no standardized pattern or any technology pattern. Developers have the freedom to choose the
best useful tools to solve their problems
Agility – Microservices support agile development. Any new feature can be quickly developed and
discarded again
Topic: JavaScript
Q41: How does the “this” keyword work? Provide some code examples. ★★★★
Topic: JavaScript
Topic: JavaScript
Topic: JavaScript
Topic: HTML5
Q45: What should be the purpose of OPTIONS method of RESTful web services?
★★★★
Topic: OOP
Q47: What is GOD class and why should we avoid it? ★★★★
Q48: Explain difference between: function Person(){}, var person = Person(), and var
person = new Person()? ★★★★
Topic: JavaScript
Topic: Webpack
Topic: OOP