MERN Techleap MCQ


Hello friends if you are looking for MERN Techleap Multiple choice questions | MERN Techleap Question Answers | MERN Techleap MCQ with Answers | MERN Techleap Accenture Question Answers

Note: Please use “Find In Page” Option in Chrome to find out your questions.

Which of the following is the correct way to access the state of a component..
Ans:- c) this.state

What happens when the following render() method executes?
Render(){
Let tools = [“NPM”,”Webpack”..]…

Ans:- c) displays the list of tools in the array

You are developing a customer registration form that collects information about the
customer. One of the mandatory fileds to be filled in is the customers email id… What
should you use for this purpose?

Ans:- b)

<input type = “email” name = “email” required/>

Predict the output of the following code given below:
Console.log(“first”);
setTimeout(() => { console.log(“second”); … console.log(“third”);

Ans:- a) first third second

An element with a fixed position will
Ans:- c) Always stays in the same place, even if the page is scrolled.

Which of the following holds good for Node.js?
Ans:- b) Node is single threaded and uses async function calls to maintain the
concurrency.

Scenario:
A single page application has to be developed using React.js consisting of two
components Counter and Display. The Display component is configured as a child of the
Counter component….
Question:
State is …… in nature.

Ans:- b) Asynchronous

Scenario:
Rishab is center administrator in “Noora Education Center.” He wants a web application
to be created using react library…
Question:
In order to use redux pattern which npm packages Rishab must install….

Ans:- a) He must install redux and react-redux packages. Redux package will provide
feature of store, reducers and actions… ….. ….. …. Connect function and a provider.

Scenario:
Assume that you have been assigned with a task of creating an API for ordering cakes
through a web portal.
Question:
What will be the correct url string to connect with mongoose package to mongodb
running at your local machine.

Ans:- mongodb : //localhost : 27017/myapp

Which of the following selectors selects all paragraph elements whose lang attribute
contains the word “css”?

Ans:- c) p(lang ~= “css”)

What output is produced by the below code?
Console.log(“yes”);

Ans:- a) No output

Which of the following is the correct way of creating an object in Javascript?
Ans:- var employee = new Object();
employee.name = “John”;
employee.id = 101;
employee.company = “Accenture”;
AND
employee = {name : “John”, id : 101, company : “Accenture”}

Fill the blanks.
const express = require(“express”)

Ans:- b) express().listen

How do you pick the value of a port by default from environment variable in Node.js?
Ans:- console.log(process.env.PORT);

Scenario:
Meena wants to share one of the node package which she created with her team
members. Before that..
Question:
If Meena wants to publish a npm package which she created…

Ans:- c) Step1 : create package
Step2 : create package.json and readme.txt files inside the project.
Step3 : create npm account
Step4 : execute npm login command
Step5 : execute npm verify command
Step6 : execute npm publish command

Which of the below is the correct HTML markup to check if a valid three-digit number is
supplied as input?

Ans:- c) <input id = “txtValue” type = “text” pattern = “[0-9][3]”>

Consider the below and choose CORRECT statements.
A. mapStateToProps is called every time the store state changes
B. The second argument to the connect method is mapStateToProps

Ans:- c) Both A & C are correct.

Predict the output of the following code given below.
Promise resolve(1)

Ans:- a) 2

What is the value ‘a’ from the below code snippet?
Let a = 100;

Ans:- c) Identifier ‘a’ has already been declared

What is the benefit of shallow rendering?
Ans:- b) Test a component in isolation.

Scenario:
Assume that you have been assigned with a task of including a search page in an online
web application portal….
Question:
What should be the correct syntax for search route in routes list?

Ans:- <Route path = “Search” exact/>

Assume isLogin is TRUE if user is a logged in user. Which of the below will correctly
display the unread messages count only if user is logged in and has messages?

Ans:- {
isLogin && messages.length > 0 ?
<h2> You have {messages.length} unread messages </h2>
….
<h2> You don’t have unread messages </h2> 
}

Choose the INCORRECT statements in javascript?
Ans:- a) Supports variable hoisting in arrow functions
c) Supports interfaces
[ Answer is A & C ]

Which of the following are the features of NodeJS?
Ans:- NodeJS is highly Scalable
NodeJS is Asynchronous
[ Choose answers with the above keywords ] (2nd & 3rd option]

What is the output of below code:
Let ivar = 50;

Ans:- 50

Scenario:
Rishab is center administrator in “Noora Education Center.” He wants a web application
to be created using react library…
Question:
From the given code snippet of connect function, identify what are the behavior…

Ans:- c)
mapStateToProps : Is a function which will identify which states will be exposed as
props of the container component.
mapDispatchToProps : Is a function which will identify which actions will be exposed
as props on the container component.
CoursePage : It is container component which will receive data.

In Express, Middleware functions can perform which of the following tasks.
Ans:- Make changes to the request and the response objects.
End the request – response cycle
Call the next middleware function in the stack

Identify the value of “a” variable from the code given below
var a;
function fun1(a){
var a=10; }
function fun2(a){ …..

Ans:- c) Value of a is = undefined

Scenario:
Meena wants to share one of the node package which she created with her team
memebers…
Question:
What is the content of package.json file?

Ans:- a) The file contains project name, version, depndencies, development depndencies.

In the below react code, you could see key is defined for list element. Select the correct
statement about the purpose of key in react.

Ans:- a) Keys helps React identify which items have changed, added or removed.


You are handling the submit event on a form in a javascript function. How could you
ensure that the browser does not submit the form for you….

Ans :- b) Call event.preventDefault();

You are developing a front end application for an airline ticket reservation system using
React. Application should maintain a single source of data for an entire application.
Which of the following can be used in react to implement this solution?

Ans:- b) Redux

Which of the following is the correct output for the following JavaScript code.
var grade=’Z’;
var result=0;
switch(grade){ case ‘A’:
result+=10; ………

Ans:- d) 0

Which of the below are similar?
B) <div className={‘btn-panel’ + (this.props.visible ? ‘show’ : ‘hidden’)}>
C) <div className={‘btn-panel $ (this.props.visible ? ‘show’ : ‘hidden’)’}>

Ans:- b) B & C

Scenario:
Airway Intl, is a leading airways in the Asia Pacific region for the international travel.
They connect customers to all corners of the world. They provide services like economy
class, Business class..
Below is the code snippet created in App.js to set up the server using NodeJS..
Question:
While setting up the server the team has missed out configuring the code to parse..

Ans:- b) app.use(express.json());
app.use(express.urlencoded( {extended : true}));

What is the value of allCarIds[1]?
Function sendCars(day, ..allCarIds){.. sendCars(“Monday”, 100, 200, 555);

Ans:- b) undefined

Galaxy Bookstore want to expand their service online through website portal for their
customers..

Ans:- c) Reducer

Consider the below
@media print{ body { font-size: 12pt; }} }
Choose the incorrect statement

Ans:- c) Print can be replaced by speech. [If radio button given, choose this]
b) It will apply when the page is loaded in a browser. [else, choose both]

What is the difference between the ID and class attributes on elements in the body?
Ans:- a) An ID must be unique within the document while many items in the document
can share a class.

Predict the output of below code.
(function(c, b = () => c) ….

Ans:- c) Error

Scenario:
George is a developer and he wants to create web application using react library..
Question:
In order to store application data in multiple stores. Which pattern..

Ans:- a) George must use Flux as it can provide the feature of having multiple stores.

You have given an online trainings registration form to develop the details… How do you
set this?

Ans:- d) <input type=”text” autofocus/>, input[type=”text”]:focus{background- 
color:’yellow’}

Scenario:
Rishab is center administrator in “Noora Education Center”. He wants a web
application…
Question:
Which statement best describes Redux?

Ans:- b) Redux is an open-source JavaScript library for managing application state

Popular Galaxy Book store now wants to go online and provide their services. You are
proposing to use MERN stack for their application development..

Ans:- a) MERN is full stack javascript technology stack which is 100% free and using single
uniform language throughout the stack helps in building the application faster in a cost
effective manner.

Why a NodeJS code is pretty fast although being written in JavaScript?
Ans:- c) Being built on Google Chrome’s V8 Javascript engine

Which of the following commands can you use to update your installed version of npm?
Ans:- a) npm install –g npm

Scenario:
Airway Intl, is a leading airways in the Asia Pacific region for the international travel…

Ans:- b) let findAll = (req, res) => {
Airlines.find({month : ‘April’})
.then(data => {

res.send(data);
})
.catch(err => {
res.status(500).send({
message: err.message || “Some error occurred while retrieving the airlines data” });

Sonu developed an e-commerce application and implemented Redux to maintain the
state of the components…

Ans:- d) connect function

Sam is a developer and creating MERN stack web application using single page
application concept..
Question:
What will be the complete route configuration for the application..

Ans:- b)

Ans:- b) <Route path = “/” component={Home}/>
<Route path=”/About” component={AboutUs}/> 
<Route path=”/Contact” component={Contact}/>

John is working for “ABC” company and the company asked him to create application
which consists of..
Question:
Company being the main component in the application, how can you..

Ans:- b) Data can be passed from one component to another component using props
concept in react.

Airway Intl, is a leading airways in the Asia Pacific region for the international travel.
They connect customers to all corners of the world. They provide services like economy
class, Business class..
Below is the code snippet created in App.js to set up the server using NodeJS and
Express. Assume all the necessary modules are installed..
Question:
Create a new route to fetch all the Airlines details in the current project folder
structure..

Ans:- c) //Router object
var router = require(“express”).Router();
//Fetch all the airlines data
router.get(“/”, airlines.findAll);

Assume that you have been assigned with a task of creating an api for ordering cakes
through a web portal. Database to be used..
Question:
For one of the routes “/login”, the response must be a view generated using EJS view
engine. Which of the below…

Ans:- a) res.render()

Select the correct solution to resolve this error.
Import React from ‘react’;
Export class MyComponent extends React.Component{…

Ans:- a) Bind the event listener in constructor by adding this.clickHandler =
this.clickHandler.bind(this)

Rishab is center administrator in “Noora Education Center”..
Question:
In order to store data related to Student and Course, what needs to be crated by
Rishab?

Ans:- c) He must create only one store and 2 reducers -….

Given the code below, identify which type of css is applied for <h2> tag? 
<style> 
h1{color:blue} … 
Ans:- a) Inline Stylesheet

Which statement is TRUE about media queries in CSS 3?
A. Define rule to check…
B. The media type “printer” is not supported by media query..

Ans:- a) Only A

If we want to go back to history 2 times, which code will be used in JavaScript?
Ans:- c) history.go(-2)

A TODO application is rendering a data from the server using Axios Api as just before
rendering the component and updating the data using setState.
Choose the correct statement to use setState in componentWillMount lifecycle hook?

Ans:- b) componentWillMount will invoke before mounting occurs and setting state will
not trigger re-render.

Predict the output of the following code snippet:
let arr1 = [1,2,3];
let arr2=[…arr1,5];
arr2.push(4);
console.log(arr2);

Ans:- a) 1, 2, 3, 5, 4

scenario:
John is working for “ABC” company and the company asked him to create application 
which consists of react…
Question:
As per the scenario if John is creating React class component then how he can pass 
companyName data of a Company component to… … .. correct syntax.
Ans:- a) class Company extends Component { 
render() {
return {
<div>
<h1> Company Component </h1> 
<Employee companyName = “ABC” /> 
</div>
} 
}
}

Identify Express features from the following.
Ans:- Route Management
Session Management
Easy error handling

What type of an object is returned from a function declared with an ‘async’ keyword?
Ans) Promise


Leave a Reply

Your email address will not be published. Required fields are marked *