Final Exam Flashcards

(67 cards)

1
Q

Explain What is DevOps?

A

DevOps is a newly emerging term in the IT field, which is nothing but a practice that emphasizes the collaboration and communication of both software developers and other information technology (IT) professionals. It focuses on delivering software products faster and lowering the failure rate of releases.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Which software-development methodology would be best if an organization needed to develop a software tool for a small group of users in the marketing department? Why?

A

Rapid application development (RAD) is a software-development (or systems-development) methodology that focuses on quickly building a working model of the software. This methodology is much better suited for smaller projects than SDLC and has the added advantage of giving users the ability to provide feedback throughout the process.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Software Development: What is the difference between a library and a framework

A

A library provides a set of helper functions/objects/modules which your application code calls for specific functionality. Libraries typically focus on a narrow scope. A Framework has defined open or unimplemented functions or objects which the developer uses to create a custom application. Framework provides structure and it has a wider scope than a library.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is CORS?

A

CORS, abbreviation for Cross-Origin Resource Sharing, is a process used to gain the authority of different web resources on different domains. With the help of CORS, the integration of web scripts can be implemented more freely with the external content of the original domain.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is a REST API?

A

Application programming interfaces (APIs) provide the platform and medium for applications to talk to and understand each other. APIs specify the way information passed across platforms is structured so that applications can exchange data and information.
REST is an API architecture style. It stands for representational state transfer. REST specifies how data is presented to a client in a format that is convenient for the client. Data exchanges happen either in JSON or XML format. However, many APIs today return JSON data.
The key elements of the REST API paradigm are
* a client or software that runs on a user’s computer or smartphone and initiates communication;
* a server that offers an API as a means of access to its data or features; and
* a resource, which is any piece of content that the server can provide to the client (for example, a video or a text file).
To get access to a resource, the client sends an HTTP request. In return, the server generates an HTTP response with encoded data on the resource. Both types of REST messages are self-descriptive, meaning they contain information on how to interpret and process them.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is the REST request structure?

A

Any REST request includes four essential parts: an HTTP method, an endpoint, headers, and a body.
An HTTP method describes what is to be done with a resource. There are four basic methods also named CRUD operations:
POST to Create a resource, GET to Retrieve a resource, PUT to Update a resource, and DELETE to Delete a resource. An endpoint contains a Uniform Resource Identifier (URI) indicating where and how to find the resource on the Internet. The most common type of URI is a Unique Resource Location (URL), serving as a complete web address.
Headers store information relevant to both the client and server. Mainly, headers provide authentication data — such as an API key, the name or IP address of the computer where the server is installed, and the information about the response format.
A body is used to convey additional information to the server. For instance, it may be a piece of data you want to add or replace.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Key differences between GET and POST?

A

GET request is simple and used to fetch a resource on the server (read). POST method is used so that resources are created on the server. POST request has a body.
Question. What are the latest trends in Full Stack Web Development?
Ans – The rise of Vue JS Functional, real-time web apps, progressive apps, and mobile web development. Programming benefits from JavaScript improvements The emergence of more compatible extensions.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What are the latest trends in Full Stack Web Development?

A

The rise of Vue JS Functional, real-time web apps, progressive apps, and mobile web development. Programming benefits from JavaScript improvements The emergence of more compatible extensions.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Describe front-end and backend in general terms

A

Frontend refers to the client-side of an application. Backend refers to the server-side of an application. Frontend is the part of a web application that users can see/view and interact with. Backend constitutes everything that happens behind the scenes. Frontend typically includes everything that attributes to the UI/visual aspects of a web application. Backend generally includes a (web) server that communicates with a DB to serve requests. HTML, CSS, JavaScript, are some of the essentials of frontend development. Java, PHP and, JavaScript are some of the backend development technologies.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What Is Node.js?

A

Node.js is an open-source, cross-platform, JavaScript runtime environment that executes JavaScript code outside of a web browser. Is is sometimes also referred to as a web framework.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Explain what is the NodeJS Event Loop.

A

NodeJS is single threaded. Event loop is an endless loop, which waits for tasks, executes them and then sleeps until it receives more tasks. The event loop executes tasks from a queue of events. Because of the event loop we can use callbacks and promises.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

How can you share code between files in NodeJS?

A

This depends on the JavaScript environment.
On the server (Node.js) each file is treated as a module and it can export variables and functions by attaching them to the module.exports object. This follows CommonJS.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is the most loved language of a full stack developer and why?

A

Full Stack Developers work with a multitude of languages. Ideally, a full-stack developer must have a few languages that he loves, preferably, some with which he can design the front end and others with which he can take care of the back end. A fullstack developer should be able to demonstrate that well and remember to include the basic most used ones like HTML, CSS, Python, JavaScript etc.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What’s the difference between Git and GitHub?

A

While Git is a tool that’s used to manage multiple versions of source code edits that are then transferred to files in a Git repository, GitHub serves as a location for uploading copies of a Git repository.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is a Git repository?

A

Git repository refers to a place where all the Git files are stored. These files can either be stored on the local repository or on the remote repository. It tracks and saves the history of all changes made to the files in a Git project. It saves this data in a directory called .git, also known as the repository folder.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Name a few Git commands with their function

A

Git config - Configure the username and email address
Git add - Add one or more files to the staging area
Git diff - View the changes made to the file
Git init - Initialize an empty Git repository
Git commit - Commit changes to head but not to the remote repository

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

What does the git push command do?

A

The Git push command is used to push the content in a local repository to a remote repository. After a local repository has been modified, a push is executed to share the modifications with remote team members.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

What are some of the advantages of MongoDB?

A

MongoDB supports field, range-based, string pattern matching type queries for searching the data in the database
MongoDB support primary and secondary index on any fields
MongoDB basically uses JavaScript objects in place of procedures
MongoDB uses a dynamic database schema
MongoDB is very easy to scale up or down
MongoDB has inbuilt support for data partitioning (Sharding)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

What is a Document in MongoDB?

A

A Document in MongoDB is an ordered set of keys with associated values. It is represented by a map, hash, or dictionary. In JavaScript, documents are represented as objects: {“greeting” : “Hello world!”}
Complex documents will contain multiple key/value pairs: {“greeting” : “Hello world!”, “views” : 3}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

What is a Collection in MongoDB?

A

A collection in MongoDB is a group of documents. If a document is the MongoDB analog of a row in a relational database, then a collection can be thought of as the analog to a table. Documents within a single collection can have any number of different “shapes.”, i.e. collections have dynamic schemas. For example, both of the following documents could be stored in a single collection:
{“greeting” : “Hello world!”, “views”: 3} {“signoff”: “Good bye”}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

What are Databases in MongoDB?

A

MongoDB groups collections into databases. MongoDB can host several databases, each grouping together collections. Some reserved database names are as follows:
admin
local
config

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

What is the MongoDB Shell?

A

The MongoDB Shell, mongosh, is a fully functional JavaScript and Node.js 14.x REPL environment for interacting with MongoDB deployments. You can use the MongoDB Shell to test queries and operations directly with your database.
You can use the mongo shell to query and update data as well as perform administrative operations.
To start the shell, run the mongosh executable:
$ mongosh
The MongoDB shell is a full-featured JavaScript interpreter, capable of running arbitrary JavaScript programs. Even basic math works on this:
> x = 100;
200
> x / 5;
20

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

How to add data in MongoDB?

A

The basic method for adding data to MongoDB is “inserts”. To insert a single document, use the collection’s insertOne method:
> db.books.insertOne({“title” : “Start With Why”})
For inserting multiple documents into a collection, we use insertMany. This method enables passing an array of documents to the database.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

How to perform queries in MongoDB?

A

The find method is used to perform queries in MongoDB. Querying returns a subset of documents in a collection, from no documents at all to the entire collection. Which documents get returned is determined by the first argument to find, which is a document specifying the query criteria.
Example: > db.users.find({“age” : 24})

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
What are the basic data types in MongoDB?
MongoDB supports a wide range of data types as values in documents. Documents in MongoDB are similar to objects in JavaScript. Along with JSON’s essential key/value–pair nature, MongoDB adds support for a number of additional data types. The common data types in MongoDB are:- Null {"x" : null} Boolean {"x" : true} Number {"x" : 4} String {"x" : "foobar"} Date {"x" : new Date()} Regular expression {"x" : /foobar/i} Array {"x" : ["a", "b", "c"]} Embedded document {"x" : {"foo" : "bar"}} Object ID {"x" : ObjectId()}
26
When to use MongoDB?
You should use MongoDB when you are building internet and business applications that need to evolve quickly and scale elegantly. MongoDB is popular with developers of all kinds who are building scalable applications using agile methodologies. MongoDB is a great choice if one needs to: Support a rapid iterative development. Scale to high levels of read and write traffic - MongoDB supports horizontal scaling through Sharding, distributing data across several machines, and facilitating high throughput operations with large sets of data. Scale your data repository to a massive size. Evolve the type of deployment as the business changes. Store, manage and search data with text, geospatial, or time-series dimensions.
27
When to use SQL vs NoSQL for your business?
Generally, NoSQL is preferred for: Graph or hierarchical data Data sets which are both large and mutate significantly, Businesses growing extremely fast but lacking data schemata. In terms of use cases, this might translate to social networks, online content management, streaming analytics, or mobile applications. SQL is more appropriate when the data is: Small Conceptually modeled as tabular In systems where consistency is critical.
28
Describe the difference for SQL vs. NOSQL in terms of Language.
SQL has been around for over 40 years, so it is recognizable, documented, and widely-used. Safe and versatile, it’s particularly well suited for complex queries. However, SQL restricts the user to working within a predefined tabular schema, and more care must be taken to organize and understand the data before it is used. The dynamic schemata of NoSQL databases allow representation of alternative structures, often alongside each other, encouraging greater flexibility. There is less emphasis on planning, greater freedom when adding new attributes or fields, and the possibility of varied syntax across databases. As a group, however, NoSQL languages lack the standard interface which SQL provides, so more complex queries can be difficult to execute. Though there are many dialects of SQL, all share a common syntax and almost-identical grammar. When querying relational databases, fluency in one language translates to proficiency in most others. On the other hand, there is very little consistency between NoSQL languages, as they concern a diverse set of unrelated technologies. Many NoSQL databases have a unique data manipulation language constrained by particular structures and capabilities.
29
Describe the difference for SQL vs. NOSQL in terms of Scalability.
Most SQL databases can be scaled vertically, by increasing the processing power of existing hardware. NoSQL databases use a master-slave architecture which scales better horizontally, with additional servers or nodes. These are useful generalizations, but it’s important to note: SQL databases can be scaled horizontally as well, though sharding or partitioning logic is often the user’s onus and not well supported. NoSQL technologies are diverse and while many rely on the master-slave architecture, options for scaling vertically also exist. Savings made using more efficient data structures can overwhelm differences in scalability; most important is to understand the use case and plan accordingly.
30
Describe the difference for SQL vs. NOSQL in terms of Structure.
SQL database schemata always represent relational, tabular data, with rules about consistency and integrity. They contain tables with columns (attributes) and rows (records), and keys have constrained logical relationships. NoSQL databases need not stick to this format, but generally fit into one of four broad categories: Column-oriented databases transpose row-oriented RDBMSs, allowing efficient storage of high-dimensional data and individual records with varying attributes. Key-Value stores are dictionaries which access diverse objects with a key unique to each. Document stores hold semi-structured data: objects which contain all of their own relevant information, and which can be completely different from each other. Graph databases add the concept of relationships (direct links between objects) to documents, allowing rapid traversal of greatly connected data sets.
31
Describe the difference for SQL vs. NOSQL in terms of Properties.
SQL databases must follow the "ACID" properties: - Atomicity: transactions must either succeed completely or fail completely, even if there is a system failure. - Consistency: the database must follow rules to prevent corruption and maintain its integrity. - Isolation: concurrent transactions should not affect each other, and their final result should be the same as if they were run sequentially. - Durability: successful transactions must be permanent, even if there is a system failure. NoSQL databases follow the "CAP" theorem, which means they can only guarantee two out of three properties: - Consistency: all requests receive the latest result or an error. - Availability: all requests get a response, regardless of the result's recency. - Partition tolerance: the system can continue to operate despite delays or losses between nodes. In summary, SQL databases ensure transactional integrity, while NoSQL databases prioritize scalability and availability.
32
Describe the difference for SQL vs. NOSQL in terms of Support and communities.
SQL databases represent massive communities, stable codebases, and proven standards. Multitudes of examples are posted online and experts are available to support those new to programming relational data. NoSQL technologies are being adopted quickly, but communities remain smaller and more fractured. However, many SQL languages are proprietary or associated with large single-vendors, while NoSQL communities benefit from open systems and concerted commitment to onboarding users. SQL is available to most major platforms, from operating systems to architectures and programming languages. Compatibility varies more widely for NoSQL, and dependencies need to be investigated more carefully.
33
What is mongoose in node js?
mongoose is an object modeling package for Node that essentially works like an ORM.
34
Explain the difference between using mongoose and the native MongoDB driver/connector?
Mongoose provides a straight-forward, schema-based solution to model your application data. It includes built-in type casting, validation, query building, business logic hooks and more, out of the box. It is a Object Document Mapper or ODM. An Object Modelling Tool. However, if our collection contains documents with an uncertain schema, the MongoDB driver is the most straightforward alternative. It allows for more flexibility as one can directly interact with the database.
35
Explain the difference between embedding and referencing (linking) for MongoDB data modeling.
Similarly to a relational database, MongoDB allows you to use schemas to define the fields and data types within your collections. One of the powerful schema options available in MongoDB is to relate documents to one another, either via embedding or referencing. Embedded documents are stored as children inside a parent document. This means they are all stored under one collection, and whenever you retrieve the parent document, you also retrieve all its embedded documents. Unlike embedded documents, referenced documents are stored in a separate collection to their parent document. Therefore, it’s possible to retrieve the parent document without retrieving any of its referenced documents. In storing the addresses of the child documents e.g. via a linked field using references.
36
Which of the following is an embedded data model in MongoDB? a) { "_id": 1, "name": "Ashley Peacock", "addresses": [ { "address_line_1": "10 Downing Street", "address_line_2": "Westminster", "city": "London", "postal_code": "SW1A 2AA" }, { "address_line_1": "221B Baker Street", "address_line_2": "Marylebone", "city": "London", "postal_code": "NW1 6XE" } ] } b) // Stored in the user collection { "_id": 1, "name": "Ashley Peacock", "addresses": [ 1000, 1001 ] }// Stored in the address collection { "_id": 1000, "address_line_1": "10 Downing Street", "address_line_2": "Westminster", "city": "London", "postal_code": "SW1A 2AA" }// Stored in the address collection { "_id": 1001, "address_line_1": "221B Baker Street", "address_line_2": "Marylebone", "city": "London", "postal_code": "NW1 6XE" }
A
37
How to install mongoose in node.js?
npm install mongoose
38
What is the --save option for npm install?
When we do "npm install", then it install the modules. If we need to update the version of module in package.json, then we have to do it manually. BUT when we do "npm install --save", then it install the modules and update the package.json automatically.
39
What is the difference between package.json and package-lock.json in a Node project?
package.json is a versioning file used to install multiple packages in your project. package.json file contains metadata about the project and also the functional dependencies that is required by the application. package.lock.json is created for locking the dependency with the installed version. Without package.lock.json, there might be some differences in installed versions in different environments.
40
What is the difference between dependencies and devDependencies in package.json?
Dependencies are modules your project depends on, devDependencies are modules you use to develop your project. Examples of dependencies are request, through2 and concat-stream. Examples of devDependencies are grunt, mocha, eslint, tape, and browserify.
41
What is likely causing the following error? npm ERR! Windows_NT 6.3.9600 npm ERR! argv "C:\\Program Files (x86)\\nodejs\\\\node.exe" "C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start" npm ERR! node v0.12.7 npm ERR! npm v2.11.3 npm ERR! path C:\vueproject\package.json npm ERR! code ENOENT npm ERR! errno -4058 npm ERR! enoent ENOENT, open 'C:\vueproject\package.json' npm ERR! enoent This is most likely not a problem with npm itself npm ERR! enoent and is related to npm not being able to find a file. npm ERR! enoent npm ERR! Please include the following file with any support request: npm ERR! C:\vueproject\npm-debug.log
missing package.json
42
Fill in the blanks (comments) //???????? var mongoose = require('mongoose'); //???????? mongoose.connect('mongodb://localhost:27017/mongodb'); //??????? var userSchema = mongoose.Schema({ name: String, //?????????? username: { type: String, required: true, unique: true }, //???????? password: { type: String, required: true }, admin: Boolean, location: String, created_at: Date //??????? }); //??????? var User = mongoose.model('User', userSchema); //?????? var userDetails = new User({ name: 'Test user',username:'testuser',password:'test12@',location:'mohali' }); userDetails.save(function (err) {if (err) console.log ('Error on save!')}); console.log(userDetails);
//include the js library var mongoose = require('mongoose'); //establish database connection mongoose.connect('mongodb://localhost:27017/mongodb'); //Create schema var userSchema = mongoose.Schema({ name: String, //datatype is string username: { type: String, required: true, unique: true }, //type is string and its required field and its unique password: { type: String, required: true }, admin: Boolean, location: String, created_at: Date //datatype of date }); //create User Object var User = mongoose.model('User', userSchema); //Save User details in database var userDetails = new User({ name: 'Test user',username:'testuser',password:'test12@',location:'mohali' }); userDetails.save(function (err) {if (err) console.log ('Error on save!')}); console.log(userDetails);
43
What is asynchronous programming?
Asynchronous programming uses an event loop to run the program. When a task needs to be performed, it's started, and the code keeps running without waiting for the result. Once the result is ready, an event is triggered, and the program continues executing the code from the event handler. This allows a single thread to handle multiple tasks at once.
44
What’s the output?async function getData() { return await Promise.resolve('I made it!'); } const data = getData(); console.log(data); A: "I made it!" B: Promise {: "I made it!"} C: Promise {} D: undefined`
An async function always returns a promise. The await still has to wait for the promise to resolve: a pending promise gets returned when we call getData() in order to set data equal to it. If we wanted to get access to the resolved value "I made it", we could have used the .then() method on data: data.then(res ⇒ console.log(res))` This would’ve logged "I made it!"". The correct answer is C.
45
Pros and cons of promise / why use promise?
Advantages: promise can solve callback hell, which greatly enhances the readability and maintainability of nested functions, Disadvantages: unable to cancel promise, errors need to be captured by callback function; If the callback function is not set, the error thrown by promise will not be reflected to the outside; When it is in the pending state, it is impossible to know which stage it has reached, whether it has just started or is about to complete
46
What is Callback Hell?
The asynchronous function requires callbacks as a return parameter. When multiple asynchronous functions are chained together then callback hell situation comes up.
47
What are the major features of VueJS?
Virtual DOM: It uses virtual DOM similar to other existing frameworks such as ReactJS, Ember etc. Virtual DOM is a light-weight in-memory tree representation of the original HTML DOM and updated without affecting the original DOM. Components: Used to create reusable custom elements in VueJS applications. Templates: VueJS provides HTML based templates that bind the DOM with the Vue instance data Routing: Navigation between pages is achieved through vue-router Light weight: VueJS is light weight library compared to other frameworks.
48
What are the lifecycle methods of VueJS?
Lifecycle hooks are a window into how the library you’re using works behind-the-scenes. By using these hooks, you will know when your component is created, added to the DOM, updated, or destroyed.
49
Describe the following VUEJS Basic App folder structure
1 - App.vue This is typically the root of your application defined in Vue Component file format. It’s usually something that defines the template for your page. 2 - main.js This is usually the JavaScript file that will initialize this root component into a element on your page. It is also responsible for setting up plugins and 3rd party components you may want to use in your app. 3 - router folder may contain the index.js file which contains all the router configurations. 4 - views folder contains components that are related to different views 5 - contains all other components (*.vue files) 6 - the assets folder contains images, css etc. that are used by components
50
What are directives in Vue.js?
Directives are instruction for VueJS to do things in a certain way. Essentially, a directive is some special token in the markup that tells the library to do something to a DOM element
51
What are the conditional directives?
VueJS provides set of directives to show or hide elements based on conditions. The available directives are: v-if, v-else, v-else-if and v-show v-if: The v-if directive adds or removes DOM elements based on the given expression. For example, the below button will not show if isLoggedIn is set to false. You can also control multiple elements with a single v-if statement by wrapping all the elements in a