Tech Interview-Concept Questions

Ace your homework & exams now with Quizwiz!

What types of joins exist in SQL? How do they differ?*

(INNER) JOIN: Returns records that have matching values in both tables LEFT (OUTER) JOIN: Return all records from the left table, and the matched records from the right table RIGHT (OUTER) JOIN: Return all records from the right table, and the matched records from the left table FULL (OUTER) JOIN: Return all records when there is a match in either left or right table

What is the difference between == and === forms of equality?*

=== is strictly equal where both the type and value has to be the same. == is loosely equal js will try to convert comparison in to a common type before comparing the values. ( ex. 77 == '77' will be true but 77 === '77' will be false

Define relational v non-relational.*

A NoSQL (originally referring to "non SQL" or "non relational") database provides a mechanism for storage and retrieval of data that is modeled in means other than the tabular relations used in relational databases.

Define closure. Provide what you believe to be a quintessential example.*

A closure is the combination of a function and the lexical environment within which that function was declared.

What is Git?

A distributed version control system

Describe SQL primary keys.*

A superkey is a set of attributes of a relation schema upon which all attributes of the schema are functionally dependent. No two rows can have the same value of super key attributes. A Candidate key is minimal superkey, i.e., no proper subset of Candidate key attributes can be a superkey. A Primary Key is one of the candidate keys. One of the candidate keys is selected as most important and becomes the primary key. There cannot be more that one primary keys in a table. Foreign key is a field (or collection of fields) in one table that uniquely identifies a row of another table.

Define sequelize virtuals and provide a code example.*

A virtual value that is not stored in the DB. This could for example be useful if you want to provide a default value in your model that is returned to the user but not stored in the DB. You could also use it to validate a value before permuting and storing it. Checking password length before hashing it for example

Define API. What differentiates it from a library, a framework, or a protocol?*

API is the interface between two applications. It is a messenger interface in which you request for some data and in response you get the data if it's available. Important point here is that APIs only send the data ,nothing else.

What are node modules? How do you export and import data in a node file? What is the difference between module.exports and exports?*

set of publicly available, reusable components, available through easy installation via an online repository, with version and dependency management.

Define SOLID (we haven't told you about this). How does it help guide or improve your code or coding process?*

An acronym for five design principles that makes your code more understandable, flexible & maintainable. S - Single Responsibility. A class should have only a single responsibility. O - Open/Closed Principle. Code should be open for extension, but closed for modification. L - Liskov Substitution Principle. "objects in a program should be replaceable with instances of their subtypes without altering the correctness of that program." I - Interface Segregation. "many client-specific interfaces are better than one general-purpose interface." D - Dependency Inversion Principle. One should "depend upon abstractions, [not] concretions."

Define assertions.*

An assertion is a statement in SQL that ensures a certain condition will always exist in the database. Assertions are like column and table constraints, except that they are specified separately from table definitions. ... However, assertions are checked only when UPDATE or INSERT actions are performed against the table.

What's the difference between authentication and authorization?*

Authentification is verifying that the user is who they claim to be. Authorization is the level of access that the user has (Administrator vs regular user).

What are the five primitive JavaScript types? What is the sixth 'universal' type?*

Boolean. Null. Undefined. Number. String. Symbol (new in ECMAScript 6)

Compare sequelize class methods and instance methods.*

Class is the object you get when you call sequelize.define . It stands for the whole table. All the method who don't modify or check any type of instance should be class method and the rest instance method

What are the four 'areas' in the box model?*

Content - The content of the box, where text and images appear Padding - Clears an area around the content. Border - A border that goes around the padding and content Margin - Clears an area outside the border.

What cellular automaton is a famous 'game'? How have cellular automata factored into the history and development of computer science?*

Conway's Game of Life: A set of rules governing the destruction, persistence, or propagation of neighboring cells in a grid — a pseudo-simulation of life. The intent and power of the game is not in realistically simulating life, but rather in serving as a simple system that produces complex behavior. In fact, the Game of Life is a universal Turing machine, capable of modeling any algorithmic calculation. Good, simple explanation of what a Turing machine is: https://www.reddit.com/r/explainlikeimfive/comments/ys738/eli5_what_does_a_turing_machine_do/c5yg93g

Define CRUD. How does it help guide or improve your code or coding process?*

Create, Read, Update, Delete are four basic functions of persistent storage and each acronym corresponds to a function that's implementein relational databases.

What is a schema?*

Database schema. ... The term "schema" refers to the organization of data as a blueprint of how the database is constructed (divided into database tables in the case of relational databases). In the case of using Sequelize, it relates to making associations. There are 4 types: One-To-One, One-To-One,Belongs-To-Many, Many-to-Many associations. How are they different? Refer to this doc: http://docs.sequelizejs.com/manual/tutorial/associations.html. As practice: Twitter, Gmail, Facebook, Instagram, Wordpress, Wikipedia, AirBnB, GitHub, Youtube, Spotify, Slack, CodeSchool, Google (search)

Define DRY. How does it help guide or improve your code or coding process?*

Don't Repeat Yourself (DRY) is a software development principle, the main aim of which is to reduce repetition of code. It improves code process because applying a change to one element doesn't require you to apply the change in another location where the code appears.

Compare and contrast unit, service, and end-to-end testing.*

End-to-End Testing is a methodology used to test whether the flow of an application is performing as designed from start to finish. The purpose of carrying out end-to-end tests is to identify system dependencies and to ensure that the right information is passed between various system components and systems.

Where does express belong in the 'stack' of web technologies? What problem does it solve and how?*

Express is a web application framework for Node.js It's on the server side of the stack It provides route definition methods, and offers a programmatic way of speaking with the server. PROBLEMS?

Define framework. What differentiates it from a libary, an API, or a protocol?*

Framework is also the set of methods written by someone else.But think it as a code which you have to import as a whole and it has some methods which has to be set necessarily. You have to abide to that and set the things which are compulsory.

Define functional programming. Provide what you believe to be a quintessential example.*

Functional programming is where functions are first class. They can go wherever a value can go. Functions can be an input and returned as an output. 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.

Define higher-order functions. Provide what you believe to be a quintessential example.*

Functions that operate on other functions, either by taking them as arguments or by returning them, are called higher-order functions. Higher-order functions allow us to abstract over actions, not just values.

Define sequelize hooks and provide a code example.*

Hooks (also known as lifecycle events), are functions which are called before and after calls in sequelize are executed. For example, if you want to always set a value on a model before saving it, you can add a beforeUpdate hook.

Define HTML. Where/how is it used?*

HyperTestMarkupLanguage. It is a document served to the browser to define the initial page structure of a website.

Where does https belong in the 'stack' of web technologies? What problem does it solve and how?*

Hypertext Transfer Protocol - allows for communication between systems. Most commonly, it's used for transferring data from a web server to a browser. Data is not encrypted by default - meaning it can be intercepted. With an SSL certificate (secure sockets layer), a secure, encrypted connection is created between the web server and web browser.

Define REST. How does it help guide or improve your code or coding process?*

In a RESTful (Representational State Transfer) web service, requests made to a resource's URI will elicit a response with a payload formatted in HTML, XML, JSON, or some other format. The response can confirm that some alteration has been made to the stored resource, and the response can provide hypertext links to other related resources or collections of resources. It improves the coding process by allowing us to interact with a complex system efficiently

Where does fs belong in the 'stack' of web technologies? What problem does it solve and how?*

In computing, a file system or filesystem controls how data is stored and retrieved. Without a file system, information placed in a storage medium would be one large body of data with no way to tell where one piece of information stops and the next begins. By separating the data into pieces and giving each piece a name, the information is easily isolated and identified.

Where does sequelize belong in the 'stack' of web technologies? What problem does it solve and how?*

Promise-based ORM for Node.js. object relational mapping - a library which lets you query/manipulate data in a database using an object-oriented approach. It behaves as an abstraction in the language of your choice between you and your data (and this data's relations etc), so that you don't have to write SQL.

Where does react belong in the 'stack' of web technologies? What problem does it solve?

React is a JavaScript library for building UI. React is offers you the opportunity to write up DECLARATIVE views: it can intelligently re-render the page based on changes in data (or state). React makes use of lifecycle methods, which dictate when these re-renders take place. It's COMPONENT-BASED: modular, can manage their own state, and logic is written in JS, and this logic can be passed down.

Where does react-redux belong in the 'stack' of web technologies? What problem does it solve and how?*

React-redux is a library that furnishes the Provider and connect function. Wrapping your root component in the Provider allows direct access to the store from any component in the application by use of the connect function, which takes in any other component and 'connects' it to the store. This means you don't have to pass state down as props, you can just access the redux store from any connected component!

Define recursion. Provide what you believe to be a quintessential example.*

Recursion is when a function calls itself. A quintessential example is multiDimSum - where you sum up the elements of an array which can contain nested arrays. Because you don't know how many levels you'll need to get into a nested array, it's best to use recursion.

Where does redux belong in the 'stack' of web technologies? What problem does it solve and how?*

Redux advertised itself as a "predictable state container for JavaScript apps. It offers a centralized, app-wide state (or store) which is managed by reducers, thereby maintaining immutability. it solves the problem inherent in passing props down a component chain, through components that don't need them. instead, we're able to "connect" react components to the redux store, where they are able to draw from or write to the app-wide state.

Define CSS. Where/how is it used?*

Stands for: Cascading Style Sheets It's used to describe the layout and view (the presentation) of html. The rules which govern the styling hierarchy is called specificity, hence "cascading."

Define SQL. Where/how is it used?*

Stands for: Structured Query Language A programming language designed for managing data held in a relational database management system (RDBMS). It's especially handy in querying *structured data* in which relations exist between the entries/entities. It's major benefits are: (1) You can query for a bunch of data in just one line, and (2) You don't need to explain HOW to access the data (i.e. via index).

What is the CAP thereom? What are its implications?*

In theoretical computer science, the CAP theorem, also named Brewer's theorem after computer scientist Eric Brewer, states that it is impossible for a distributed data store to simultaneously provide more than two out of the following three guarantees:[1][2][3] Consistency: Every read receives the most recent write or an error Availability: Every request receives a (non-error) response - without the guarantee that it contains the most recent write Partition tolerance: The system continues to operate despite an arbitrary number of messages being dropped (or delayed) by the network between nodes In particular, the CAP theorem implies that in the presence of a network partition, one has to choose between consistency and availability. Note that consistency as defined in the CAP theorem is quite different from the consistency guaranteed in ACID database transactions.

What is database indexing and why is it useful?*

Indexing is a way to optimize performance of a database by minimizing the number of disk accesses required when a query is processed. An index or database index is a data structure which is used to quickly locate and access the data in a database table.

What distinguishes JavaScript from other languages that fill a similar role (like Ruby, Python, Java, etc)?*

Javascript is dynamically typed, as opposed to statically typed. This means that object types are determined at run-time (as opposed to at compile-time). Statically-typed languages include Java, C, C#.

Define library. What differentiates it from a framework, an API, or a protocol?*

Library is a set of methods written by someone else and released as open source which anyone can import in their application and use those methods.

Where does mocha belong in the 'stack' of web technologies? What problem does it solve and how?*

Mocha is a javascript testing framework that makes asynchronous testing easy. Mocha can run on either node.js or in the browser. When compared to other javascript testing frameworks Mocha's handling of asynchronous testing makes it stand out.

What is MVC architecture?

Model View Controller Model-view-controller separates the components of software into three parts: (1) Model: The part of the software that handles application logic, such as what data is saved, and how that data should react to certain commands, etc. (2) View: The part of the software that handles what is displayed to the user. This part of the program takes info from the Model part (and sometimes the Controller part) to display the information. (3) Controller: The part of the software that handles user input. This part of the program waits for user input, then informs the other two parts to make appropriate changes. This technique was developed because, for simpler command-line programs, the three sections were often combined in the same place. When these programs had to be updated for graphical interfaces, or just needed to be changed, it was very difficult, as the underlying code assumed the output and input would not change.

Define and describe PostgreSQL.*

PostgresSQL is a DBMS ( database management system). The Database Management System is the brain of our persistent storage solution. It is responsible for translating declarative incoming queries into actual file system operations. In the case of PostgreSQL, the DBMS is the postgres process running behind the scenes. In fact, postgres is a TCP/IP server listening on a port! ...Not an HTTP-protocol server, but rather a Postgres-protocol server. The postgres DBMS/server sits in the background ready to receive queries. So how do we actually transmit a query to postgres? A client must connect to it and send some SQL according to the protocol that postgres expects. If we studied the protocol for connecting to postgres and transmitting queries, we might be able to implement that complex logic within our Node app, and the app would be a database client. That would be a lot of work, though, and very error-prone. Imagine every developer having to write their own TCP/IP code; it probably wouldn't go very well! Instead, we can rely on a database driver. A driver is a client written to bridge the gap between applications and the DBMS. Like psql or any other client, it correctly implements the protocols to speak with postgres. But where psql exposes a keyboard input method, drivers expose an API — Application Programming Interface. Apps written in their native language can then use that API to send queries. The client we'll use in our Node server is node-postgres, available on npm as pg. This driver allows us to use JavaScript to send queries to our database. The final path for a SQL query is as follows: SENDING THE DATABASE REQUEST 1. Node app: our code calls a function provided by pg, passing a string SQL query 2. pg driver: connects to postgres as a client and sends the SQL query using correct protocol 3. postgres server: translates query into executing a series of file system operations RECEIVING THE DATABASE RESPONSE 1. postgres server: sends result of file system ops back to connected pg driver 2. pg driver: parses the raw response and builds a JS array of row data 3. Node app: receives a Promise that will eventually contain the array.

Define ORM.*

Object-Relational Mapping (ORM) is a technique that lets you query and manipulate data from a database using an object-oriented paradigm. The Object part is the one you use with your programming language ( python in this case ) The Relational part is a Relational Database Manager System ( A database that is ) there are other types of databases but the most popular is relational ( you know tables, columns, pk fk etc eg Oracle MySQL, MS-SQL ) And finally the Mapping part is where you do a bridge between your objects and your tables. Using ORM saves a lot of time because: DRY: You write your data model in only one place, and it's easier to update, maintain, and reuse the code. A lot of stuff is done automatically, from database handling to I18N. It forces you to write MVC code, which, in the end, makes your code a little cleaner. You don't have to write poorly-formed SQL (most Web programmers really suck at it, because SQL is treated like a "sub" language, when in reality it's a very powerful and complex one). Sanitizing; using prepared statements or transactions are as easy as calling a method. Using an ORM library is more flexible because: It fits in your natural way of coding (it's your language!). It abstracts the DB system, so you can change it whenever you want. The model is weakly bound to the rest of the application, so you can change it or use it anywhere else. It lets you use OOP goodness like data inheritance without a headache. But ORM can be a pain: You have to learn it, and ORM libraries are not lightweight tools; You have to set it up. Same problem. Performance is OK for usual queries, but a SQL master will always do better with his own SQL for big projects. It abstracts the DB. While it's OK if you know what's happening behind the scene, it's a trap for new programmers that can write very greedy statements, like a heavy hit in a for loop.

Define object-oriented programming. Provide what you believe to be a quintessential example.*

Object-oriented programming is a programming paradigm that privileges objects rather than actions and data rather than functions or logic. Adherents to OOP conceive of a program as a society of objects that receive messages that they then use to perform their own discrete operations, often referred to as methods. Ex: You can define a class of Articles, then add methods like createTitle, and then from that class create subclasses of other articles.

Where does passport belong in the 'stack' of web technologies? What problem does it solve and how?*

Passport is authentication middleware that abstracts away some of the more complicated steps involved in OAuth. Can be configured to support authentication using a username and password, Facebook, Twitter, and more.

Define Regex. Where/how is it used?

Patterns! it can be used in many scenarios (and languages). in js it is mostly used for match,replace,search and split. In js when we implement a match method with js we need to start with / and end with / this lets js know that everything inside will be regex. ex const phoneNumbers = x.match(/^(\+\d{1,2}\s)?\(?\d{3}\)?[\s.-]?\d{3}[\s.-]?\d{4}$/) this will match a basic phone number pattern (123-345-7890) etc

What are express routers? How and why would you implement one?*

Routing refers to how an application's endpoints (URIs) respond to client requests. You define routing using methods of the Express app object that correspond to HTTP methods; for example, app.get() to handle GET requests and app.post to handle POST requests. These routing methods specify a callback function (sometimes called "handler functions") called when the application receives a request to the specified route (endpoint) and HTTP method. In other words, the application "listens" for requests that match the specified route(s) and method(s), and when it detects a match, it calls the specified callback function.In fact, the routing methods can have more than one callback function as arguments. With multiple callback functions, it is important to provide next as an argument to the callback function and then call next() within the body of the function to hand off control to the next callback.

Define and describe SQL.*

SQL stands for Structured Query Language. It is a language used to interact with the database, i.e to create a database, to create a table in the database, to retrieve data or update a table in the database etc. SQL is an ANSI(American National Standards Institute) standard. Using SQL, we can do many things, for example - we can execute queries, we can insert records in a table, we can update records, we can create a database, we can create a table, we can delete a table etc. A Database is defined as a structured form of data which is stored in a computer or data in an organised manner and can be accessed in various ways. It is also the collection of schemas, tables, queries, views etc. Database helps us in easily storing, accessing and manipulation of data held in a computer. The Database Management System allows a user to interact with the database. It is true that SQL is a language but it does not support programming as it is not a programming language, it is a command language. We do not have conditional statements in SQL like for loops or if..else, we only have commands which we can use to query, update , delete etc. data in the database. SQL allows us to manipulate data in a database.

Where does react-router belong in the 'stack' of web technologies? What problem does it solve and how?*

Single page applications don't make any adjustments to the url bar by default, thereby making it difficult to share pages or point to specific components with url bar manipulation. React-Router provides DYNAMIC ROUTING. The opposite, static routing, declares routes before render (Rails, Express, Ember, Angular, etc). The dynamic routing offered by RR makes if so that your routing takes place as your app is rendering, not in a config file. This allows routing to be dynamic (i.e. which components render when user is on a mobile screen vs desktop), and ties the UI into routing. Static routing doesn't allow for this luxury!

Where does socket.io belong in the 'stack' of web technologies? What problem does it solve and how?*

Socket.IO is a JavaScript library for realtime web applications. It enables realtime, bi-directional communication between web clients and servers. It has two parts: a client-side library that runs in the browser, and a server-side library for Node.js. Both components have a nearly identical API. It provides a reliable connection and a simple API for sockets to connect and disconnect.

What are the four principles of OOP? And what are the concepts of these four principles?

The four principles of object-oriented programming are encapsulation, abstraction, inheritance, and polymorphism. Encapsulation is achieved when each object keeps its state private, inside a class. Other objects don't have direct access to this state. Instead, they can only call a list of public functions — called methods. Applying abstraction means that each object should only expose a high-level mechanism for using it. For example, you can use Array.sort(), and you will know exactly what it does each time, but you don't need to know what's going under the hood. Inheritance means that you create a (child) class by deriving from another (parent) class. This way, we form a hierarchy. Simply put, polymorphism gives a way to use a class exactly like its parent so there's no confusion with mixing types. But each child class keeps its own methods as they are.

Explain the role of the event loop in the V8 ecosystem.*

To understand the event loop you'll also need to understand the Event Table and Event Queue. Every time you call a setTimeout function or do some async operation in Javascript— it is added to the Event Table. The Event Table is a data structure which knows that a certain function should be triggered after a certain event. Once that event occurs (timeout, click, mouse move) it sends a notice. Its sole purpose is to keep track of events (doesn't execute) and sends them to the Event Queue. Event Queues are data structures similar to a stack. It receives the function calls from the Event Table, and sends it to the call stack for execution. Finally, the Event Loop is a constantly running process that checks if the call stack is empty. If it is empty it looks into the Event Queue for the next function and if there is something it gets sent to the call stack.

Describe test driven development and detail its benefits.*

What is Test-Driven Development? Write a Test. Since development is driven by tests, the obvious first step is to create a new test. ... Confirm the Test Fails. Once the test is created, the next step is to confirm that the test fails. ... Write Code to Pass Test. ... Confirm the Test Passes. ... Refactor. ... Repeat All Steps. Unit testing is not equal to TDD - TDD is a methodology for writing unit tests. ... All that is to say, to me it's not a question of whether TDD is worth it. It's whether unit testing is worth it. And if it is, then TDD is a non-negotiable. TOP 8 BENEFITS OF UNIT TESTING MAKE THE PROCESS AGILE. One of the main benefits of unit testing is that it makes the coding process more agile. ... QUALITY OF CODE. ... FIND SOFTWARE BUGS EARLY. ... FACILITATES CHANGES & SIMPLIFIES INTEGRATION. ... PROVIDES DOCUMENTATION. ... DEBUGGING PROCESS. ... DESIGN. ... REDUCE THE COSTS.

What does ACID stand for? What does each mean?*

What is a transaction? What are ACID properties? Ans: A Database Transaction is a set of database operations that must be treated as whole, means either all operations are executed or none of them. An example can be bank transaction from one account to another account. Either both debit and credit operations must be executed or none of them. ACID (Atomicity, Consistency, Isolation, Durability) is a set of properties that guarantee that database transactions are processed reliably.

Define eager loading in sequelize and provide a code example.*

When you are retrieving data from the database there is a fair chance that you also want to get associations with the same query - this is called eager loading

How is HTTPS different from HTTP? What are SSL certificates?*

You click to check out at an online merchant. Suddenly your browser address bar says HTTPS instead of HTTP. What's going on? Is your credit card information safe? Good news. Your information is safe. The website you are working with has made sure that no one can steal your information. Instead of HyperText Transfer Protocol (HTTP), this website uses HyperText Transfer Protocol Secure (HTTPS). Using HTTPS, the computers agree on a "code" between them, and then they scramble the messages using that "code" so that no one in between can read them. This keeps your information safe from hackers. They use the "code" on a Secure Sockets Layer (SSL), sometimes called Transport Layer Security (TLS) to send the information back and forth. In the beginning, network administrators had to figure out how to share the information they put out on the Internet. They agreed on a procedure for exchanging information and called it HyperText Transfer Protocol (HTTP). Once everyone knew how to exchange information, intercepting on the Internet was not difficult. So knowledgeable administrators agreed upon a procedure to protect the information they exchanged. The protection relies on SSL Certificate to encrypt the online data. Encryption means that the sender and recipient agree upon a "code" and translate their documents into random-looking character strings. The procedure for encrypting information and then exchanging it is called HyperText Transfer Protocol Secure (HTTPS). With HTTPS if anyone in between the sender and the recipient could open the message, they still could not understand it. Only the sender and the recipient, who know the "code," can decipher the message. Humans could encode their own documents, but computers do it faster and more efficiently. To do this, the computer at each end uses a document called an "SSL Certificate" containing character strings that are the keys to their secret "codes." SSL certificates contain the computer owner's "public key." The owner shares the public key with anyone who needs it. Other users need the public key to encrypt messages to the owner. The owner sends those users the SSL certificate, which contains the public key. The owner does not share the private key with anyone. The security during the transfer is called the Secure Sockets Layer (SSL) and Transport Layer Security (TLS). The procedure for exchanging public keys using SSL Certificate to enable HTTPS, SSL and TLS is called Public Key Infrastructure (PKI).

Describe SQL tables.*

a table is a set of data elements (values) using a model of vertical columns (identifiable by name) and horizontal rows, the cell being the unit where a row and column intersect. A table has a specified number of columns, but can have any number of rows.


Related study sets

Chapter 11 Genetics 1 Assignment

View Set

MGT 268 Midterm for Parag Uma Kosalge

View Set

Health Care: Pop and Context Chapter 21

View Set

Chemistry nucleur chemistry test

View Set