Rushikesh Dilwale

Download as pdf or txt
Download as pdf or txt
You are on page 1of 21

Rushikesh Dilwale application for Frontend Engineer

Rushikesh Dilwale
Total points: 43 (Cutoffs: 35, 25) Email: [email protected]
Date: 19-Feb-24 19:44PM Time taken: 3h:10m
Percentile Score: 96 ? Distribution Of Scores
Cheating: --

Detailed Scores

Detailed scores by section. Avg time is the average time taken by this candidate per question of this section.

Section Points Time Avg time


General Aptitude 4/10 1h:17m 0h:15m
Logical Analysis 6/6 0h:15m 05m:05s
JavaScript Web 8/10 0h:27m 05m:28s
ECMAScript 6 Knowledge 4/6 07m:22s 02m:27s
JavaScript Async 0 0h:18m 09m:20s
Angular Knowledge 3/10 06m:53s 01m:22s
React.js Knowledge 8/10 0h:23m 04m:44s
Programming 10/10 0h:14m 0h:14m

Answers

Answers(s) for Online Test for Frontend Engineer

Feedback Summary
No Splurge Appeared for test multiple times.

General Aptitude Objective Questions


Trading Wine Bottles:

A wine connoisseur had Rs. 12500. She used some of that money to buy two wine bottles, and then sold them both for
Rs. 6000 each. She made a profit of 20% on one and a loss of 20% on the other. How many rupees does she have left
now?

Expected Answer = 12000

Answer

Answer is Incorrect
Candidate's answer=0, Correct Answer=12000
Time taken: 10m:26s
Average Speed:

Maya drives from Boston to New York at an average speed of 51kmph. Then she immediately drives from New York to
Boston , at an average speed of 102kmph. What is is average speed in kmph for the whole journey? Round off your
answer to the nearest whole number. If you think there isnt sufficient data to answer this question, then put 0 as your
answer

Expected Answer = 68
Answer

Answer is Correct
68
Time taken: 04m:43s
Travellers:

In a group of 55 people, exactly 37 of them have visited US, exactly 37 of them have visited UK. 9 of them have been to
neither US nor UK. How many of them have visited both US and UK? If you think there isnt sufficient data to answer this
question, then put 0 as your answer.

Expected Answer = 28

Answer

Answer is Correct
28
Time taken: 0h:16m
Small machines and large machines:

At a BPO, the 31 associates in the US practice share 2 small machines and 3 large machines. The 8 associates in the
Europe practice all share small machines. The 63 associates in the India practice all share large machines. If the number
of large machines needed for the India practice is 3 more than the number of small machines needed for Europe
practice, how many associates can share each large machine? If you think there isnt sufficient data to answer this
question, then put 0 as your answer. (Assume that the number of associates who share each small machine is always
the same, and the number of associates who share any large machine is also always the same.)

Expected Answer = 9

Answer

Answer is Incorrect
Candidate's answer=8, Correct Answer=9
Time taken: 0h:21m
Pool Cues:

A pair of pool players have 7 different cues, and every day, they pick two random cues and play snooker for an hour. In
the last year, they have played together a total of 350 hours. Interestingly, their random picking of cues has worked so
well that each cue has been used the same number of hours. How many hours has each cue been used?

Expected Answer = 100

Answer

Answer is Incorrect
Candidate's answer=50, Correct Answer=100
Time taken: 0h:23m

Logical Analysis Objective Questions


Logic #1:

Consider this statement:

In a company, 80% of the revenue comes from customers buying Java programs.

Which of the following statements follow logically from this:

Select the closest option:

1. 80% of the customers want Java programs


2. 80% of the programmers in the company write Java
If all revenue of the company is generated by new programs written by their programmers, then 80% of the
revenue comes from programmers who write Java*
4. 20% of the revenue comes from C/C++ programs
5. 80% of the profits come from customers who want Java programs

Answer

Answer is Correct

Exercise Options Candidate Choices


• 80% of the customers want Java programs
• 80% of the programmers in the company write Java
• If all revenue of the company is generated by new programs written by their
programmers, then 80% of the revenue comes from programmers who write Java ✔
• 20% of the revenue comes from C/C++ programs
• 80% of the profits come from customers who want Java programs
Summary: Correct Choices: 1 ✔ Wrong Choices = 0 ✗ Missing Answers: 0 ∅
Time taken: 06m:07s
Logic #5:

Consider this statement:

We shortlisted 20 CS/IT candidates and 10 non-CS/IT candidates. Our quota is to make a total of 15 job offers. We haven't
yet managed to contact the panel who interviewed the non-CS/IT candidates; but the panel who interviewed CS/IT
candidates, made offers to 10 of them. Based on this, we feel that the panel who interviewed the non-CS/IT has probably
made offers to 5 candidates.

The final conclusion in the statement is an example of which of the following:

Select the closest option:

1. Predicting the probability of a situation based on on the probability of the root cause of that situation
2. Predicting the probability of a particular situation based on the probability of a general case of that situation
3. Figuring out the probability of a general situation that's most likely to be applicable based on data-points collected
from a number of specific situations of that type
Using probability from one situation where data is available, to guess the probability of a similar situation.*
5. Guessing probability of a future situation based on a similar past events.

Answer

Answer is Correct

Exercise Options Candidate Choices


• Predicting the probability of a situation based on on the probability of the root cause
of that situation
• Predicting the probability of a particular situation based on the probability of a
general case of that situation
• Figuring out the probability of a general situation that's most likely to be applicable
based on data-points collected from a number of specific situations of that type
• Using probability from one situation where data is available, to guess the probability
of a similar situation. ✔
• Guessing probability of a future situation based on a similar past events.
Summary: Correct Choices: 1 ✔ Wrong Choices = 0 ✗ Missing Answers: 0 ∅
Time taken: 07m:52s
Logic #6:

Consider this statement:

In 2002, the IIT JEE entrance exam was a subjective exam. Various student and parent groups raised objections to this,
but their objections were ignored by the JEE management. Data from the results of the 2002 test showed that non-English
medium school students had fared very badly in the JEE. Soon after the results were announced, a Public Interest
Litigation (PIL) was filed against the method of conducting the JEE in the courts. During this PIL, the court ruled that the
subjective nature of the JEE is unfair to certain section of students. As a result, from then on, the JEE has always been
conducted as a purely objective test.

Which of the following statements follow logically from this:

Select the closest option:

1. Before 2002, students from non-English medium schools always fared badly in JEE
The JEE is now an objective test because of the court ruling in the PIL.*
3. If the JEE management had paid attention to the objections raised by student/parent groups, the PIL could have been
avoided
4. Before 2002, JEE was a subjective test because the JEE management believed that a subjective test is better than an
objective test
5. Use of a purely objective test for JEE 2002 would have prevented the PIL

Answer

Answer is Correct

Exercise Options Candidate Choices


• Before 2002, students from non-English medium schools always fared badly in JEE
• The JEE is now an objective test because of the court ruling in the PIL. ✔
• If the JEE management had paid attention to the objections raised by
student/parent groups, the PIL could have been avoided
• Before 2002, JEE was a subjective test because the JEE management believed
that a subjective test is better than an objective test
• Use of a purely objective test for JEE 2002 would have prevented the PIL
Summary: Correct Choices: 1 ✔ Wrong Choices = 0 ✗ Missing Answers: 0 ∅
Time taken: 01m:16s

JavaScript Web Objective Questions


Client Side:

Which of the following can't be done with client-side JavaScript?

Select the closest option:

1. Validating a form
2. Sending a form's contents by email
Storing the form's contents to a database file on the server*
4. None of the above

Answer

Answer is Correct

Exercise Options Candidate Choices


• Validating a form
• Sending a form's contents by email
• Storing the form's contents to a database file on the server ✔
• None of the above
Summary: Correct Choices: 1 ✔ Wrong Choices = 0 ✗ Missing Answers: 0 ∅
Time taken: 06m:19s
Noscript:

The <noscript> tag:

Select the closest option:

1. Is executed when the <script> tag (i.e. the part containing JavaScript code, for example) is empty
2. Is used to programmatically turn off script execution on a webpage
Is executed when page is loaded with scripts (e.g. JavaScript) disabled*
4. Was used in IE6 and older browsers, and is no longer supported by newer browsers
5. Was used with HTML4.0 and earlier protocols, and is no longer supported by HTML5

Answer

Answer is Correct

Exercise Options Candidate Choices


• Is executed when the <script> tag (i.e. the part containing JavaScript code, for
example) is empty
• Is used to programmatically turn off script execution on a webpage
• Is executed when page is loaded with scripts (e.g. JavaScript) disabled ✔
• Was used in IE6 and older browsers, and is no longer supported by newer
browsers
• Was used with HTML4.0 and earlier protocols, and is no longer supported by
HTML5
Summary: Correct Choices: 1 ✔ Wrong Choices = 0 ✗ Missing Answers: 0 ∅
Time taken: 00m:42s
setTimeout:

Consider the following JavaScript code:

function f() {
// Do something
}
setTimeout(f, 2000);

Which of the following statements represents the most accurate description of when function f is guaranteed to be
called?

Select the closest option:

1. More than 1000 milliseconds (i.e. 1 second) but less than 3000 milliseconds (i.e. 3 seconds) after setTimeout
2. Exactly 2000 milliseconds after setTimeout
3. More than 1999 milliseconds, but less than 2001 milliseconds after setTimeout
4. More than 2000 milliseconds, but less than 2001 milliseconds after setTimeout
More than 2000 milliseconds after setTimeout - but there is no guarantee of how much more*

Answer

Answer is Correct

Exercise Options Candidate Choices


• More than 1000 milliseconds (i.e. 1 second) but less than 3000 milliseconds (i.e. 3
seconds) after setTimeout
• Exactly 2000 milliseconds after setTimeout
• More than 1999 milliseconds, but less than 2001 milliseconds after setTimeout
• More than 2000 milliseconds, but less than 2001 milliseconds after setTimeout
• More than 2000 milliseconds after setTimeout - but there is no guarantee of how
much more ✔
Summary: Correct Choices: 1 ✔ Wrong Choices = 0 ✗ Missing Answers: 0 ∅
Time taken: 0h:11m
Order of Output:

Assume that you are using a third-party JavaScript library, which provides you with function called doStuff(callback).
This function does some complex calculation asynchronously, and then calls the callback function with two arguments
callback(results, err). If there was any error in the calculation, then err will be a non-null string. If the operation
was a success, results will be a non-null string. Consider the following JavaScript code that you have written:

console.log("A");
doStuff((results, err) => {
if (err) {
console.log("B");
}
console.log("C");
});
console.log("D");

Which of the following output sequences can NEVER be produced by this code. (Note: you have to choose those
sequences of outputs that are impossible to produce as the output of the above code under any circumstances.)

Select all that apply:

1. A B C D
2. A C D
3. A D C
4. A D B C
None of the above (i.e. under the appropriate circumstances each of the above sequences are possible.)*

Answer

Answer is Incorrect

Exercise Options Candidate Choices


•ABCD
•ACD
•ADC
•ADBC ✗
• None of the above (i.e. under the appropriate circumstances each of the above
sequences are possible.) ∅
Summary: Correct Choices: 0 ✔ Wrong Choices = 1 ✗ Missing Answers: 1 ∅
Time taken: 04m:11s
JavaScript in head:

Consider the following lines in the <head> section of a JavaScript page:

<head>
<script src="file1.js"></script>
<script src="file2.js"></script>
</head>

Unfortunately, loading the two javascript files is slowing down the rendering of this page, and it is required to improve the
situation. To complicate matters, the code in file2.js uses some of the code from file1.js so it would be a problem
if they got loaded in the wrong order. Assuming that the HTML in the rest of the page can be rendered properly without
the JavaScript (i.e. there are appropriate fallbacks), which of the following statements are true?
Select all that apply:

1. It is not possible under any circumstances for the webpage to start rendering before loading the JavaScript files, as
long as the <script> tag is in the <head> section.
2. This problem can be fixed by using the async attribute on both the <script> tags
This problem can be fixed by using the defer attribute on both the <script> tags*
4. This problem can be fixed by using the async attribute for file1.js and the defer attribute for file2.js
5. This problem can be fixed by using the defer attribute for file1.js and the async attribute for file2.js

Answer

Answer is Correct

Exercise Options Candidate Choices


• It is not possible under any circumstances for the webpage to start rendering before
loading the JavaScript files, as long as the <script> tag is in the <head> section.
• This problem can be fixed by using the async attribute on both the <script> tags
• This problem can be fixed by using the defer attribute on both the <script> tags ✔
• This problem can be fixed by using the async attribute for file1.js and the
defer attribute for file2.js
• This problem can be fixed by using the defer attribute for file1.js and the
async attribute for file2.js

Summary: Correct Choices: 1 ✔ Wrong Choices = 0 ✗ Missing Answers: 0 ∅


Time taken: 04m:56s

ECMAScript 6 Knowledge Objective Questions


ES6 const:

Consider the following ECMAScript6 code:

What is the result of running this code?

Select the closest option:

1. It will give an error message X is read-only (or something similar)


2. It will give an error message X.a is already defined (or something similar)
3. It will print 1 to the console log
It will print 3 to the console log*
5. It will print undefined to the console log

Answer

Answer is Correct

Exercise Options Candidate Choices


• It will give an error message X is read-only (or something similar)
• It will give an error message X.a is already defined (or something similar)
• It will print 1 to the console log
• It will print 3 to the console log ✔
• It will print undefined to the console log
Summary: Correct Choices: 1 ✔ Wrong Choices = 0 ✗ Missing Answers: 0 ∅
Time taken: 02m:48s
ES6 implicit this #1:

Consider the following ECMAScript6 code:

What is the result of running this code?

Select the closest option:

1. It will give a compilation error


2. It will pop up an alert message "identifier this is undefined"
3. It will print 424242 to the console log
It will print undefinedundefinedundefined to the console log*
5. It will print complete successfully with an empty line output to the console

Answer

Answer is Correct

Exercise Options Candidate Choices


• It will give a compilation error
• It will pop up an alert message "identifier this is undefined"
• It will print 424242 to the console log
• It will print undefinedundefinedundefined to the console log ✔
• It will print complete successfully with an empty line output to the console
Summary: Correct Choices: 1 ✔ Wrong Choices = 0 ✗ Missing Answers: 0 ∅
Time taken: 04m:18s
ES6 implicit this #2:

Consider the following ECMAScript6 code:


What is the result of running this code?

Select the closest option:

1. It will give a compilation error


2. It will pop up an alert message "identifier this is undefined"
It will print 424242 to the console log*
4. It will print undefinedundefinedundefined to the console log
5. It will print complete successfully with an empty line output to the console

Answer

Answer is Incorrect

Exercise Options Candidate Choices


• It will give a compilation error
• It will pop up an alert message "identifier this is undefined"
• It will print 424242 to the console log ∅
• It will print undefinedundefinedundefined to the console log ✗
• It will print complete successfully with an empty line output to the console
Summary: Correct Choices: 0 ✔ Wrong Choices = 1 ✗ Missing Answers: 1 ∅
Time taken: 00m:16s

JavaScript Async Objective Questions


async/await #1:

Consider the following JavaScript code:


What happens when this code is run?

Select the closest option:

1. After 6 seconds, first second and done are all printed to the console together, and the program stops
2. done is printed to the console immediately. After 3 seconds, first is printed. After 3 more seconds second is
printed. Then the program stops.
3. done is printed to the console immediately. After 3 seconds, first and second are both printed to the console
together, and the program stops
After 3 seconds, first is printed to the console. After 3 more seconds second and done are printed
together. Then the program stops.*
5. done is printed to the console immediately. 6 seconds later, first second are both printed together and then the
program stops.

Answer

Answer is Incorrect

Exercise Options Candidate Choices


• After 6 seconds, first second and done are all printed to the console together,
and the program stops
• done is printed to the console immediately. After 3 seconds, first is printed. After
3 more seconds second is printed. Then the program stops.
• done is printed to the console immediately. After 3 seconds, first and second
are both printed to the console together, and the program stops ✗
• After 3 seconds, first is printed to the console. After 3 more seconds second
and done are printed together. Then the program stops. ∅
• done is printed to the console immediately. 6 seconds later, first second are
both printed together and then the program stops.
Summary: Correct Choices: 0 ✔ Wrong Choices = 1 ✗ Missing Answers: 1 ∅
Time taken: 01m:22s
async/await #2:
Consider the following JavaScript code:

What happens when this code is run?

Select the closest option:

After 3 seconds, first second and done are all printed to the console together, and the program stops*
2. done is printed to the console immediately. After 3 seconds, first is printed. After 3 more seconds second is
printed. Then the program stops.
3. done is printed to the console immediately. After 3 seconds, first and second are both printed to the console
together, and the program stops
4. After 3 seconds, first is printed to the console. After 3 more seconds second and done are printed together. Then
the program stops.
5. done is printed to the console immediately. 6 seconds later, first second are both printed together and then the
program stops.

Answer

Answer is Incorrect

Exercise Options Candidate Choices


• After 3 seconds, first second and done are all printed to the console together,
and the program stops ∅
• done is printed to the console immediately. After 3 seconds, first is printed. After
3 more seconds second is printed. Then the program stops.
• done is printed to the console immediately. After 3 seconds, first and second
are both printed to the console together, and the program stops ✗
• After 3 seconds, first is printed to the console. After 3 more seconds second
and done are printed together. Then the program stops.
• done is printed to the console immediately. 6 seconds later, first second are
both printed together and then the program stops.
Summary: Correct Choices: 0 ✔ Wrong Choices = 1 ✗ Missing Answers: 1 ∅
Time taken: 0h:17m

Angular Knowledge Objective Questions


Pipe parameter:

Consider the following Angular Pipe:

import { Pipe, PipeTransform } from '@angular/core';


@Pipe({name: 'discount'})
export class DiscountPipe implements PipeTransform {
transform(value: cost, percent?: number): number {
return cost * (isNaN(percent) ? 90 : percent) / 100;
}
}

If price represents a valid numeric value, which of the following expressions will result in a value that is 90% of price?

Select all that apply:

{{price|discount}}*
2. {{price|discount|90}}
{{price|discount:90}}*
4. {{price|discount:0.9}}
5. {{price|discount(90)}}

Answer

Answer is Partially Correct.

Exercise Options Candidate Choices


• {{price|discount}} ∅
• {{price|discount|90}}
• {{price|discount:90}} ✔
• {{price|discount:0.9}}
• {{price|discount(90)}}
Summary: Correct Choices: 1 ✔ Wrong Choices = 0 ✗ Missing Answers: 1 ∅
Time taken: 01m:53s
*ngFor #2:

Consider this Angular code:

<div *ngFor="let item of mylist; let y=odd">{{ y }}</div>

If mylist has been initialized as mylist = ['23'] in the right place, then what will the output html be?

Select the closest option:

1. <div>false</div><div>true</div>
2. <div>true</div><div>false</div>
3. <div>true</div>
<div>false</div>*
5. <div>false true</div>
Answer

Answer is Incorrect

Exercise Options Candidate Choices


• <div>false</div><div>true</div>
• <div>true</div><div>false</div> ✗
• <div>true</div>
• <div>false</div> ∅
• <div>false true</div>
Summary: Correct Choices: 0 ✔ Wrong Choices = 1 ✗ Missing Answers: 1 ∅
Time taken: 00m:29s
Angular template:

Consider this Angular code:

<div>{{ let x = 4; let y = 2; x*y }}</div>

What will this output?

Select the closest option:

1. <div>8</div>
2. <div>42</div>
3. <div>4</div><div>2</div>
4. <div>4*2</div>
Nothing. This is a syntax error.*

Answer

Answer is Incorrect

Exercise Options Candidate Choices


• <div>8</div> ✗
• <div>42</div>
• <div>4</div><div>2</div>
• <div>4*2</div>
• Nothing. This is a syntax error. ∅
Summary: Correct Choices: 0 ✔ Wrong Choices = 1 ✗ Missing Answers: 1 ∅
Time taken: 01m:09s
Restricted Area #2:

In an Angular app, there is one area that is restricted. This consists of a route restricted and a module
RestrictedModule, which should only be accessible to logged in users who have admin rights. Consider the following
code in the routing module for this app:

{
path: 'restricted',
loadChildren: () => import('./rest/restricted.module').then(
m => m.RestrictedModule),
},

We wish to ensure that the RestrictedModule is only loaded when a logged in user with admin rights navigates to the
restricted route. Specifically, if a user who is not logged in navigates to the restricted route, the module should not
be loaded. What is needed to implement this?

Select all that apply:

1. Use the CanActivate route guard


2. Use the CanActivateChildren route guard
3. Use the Resolve route guard
Use the CanLoad route guard*
5. Nothing needs to be done, this behavior is automatically handled by Angular

Answer

Answer is Incorrect

Exercise Options Candidate Choices


• Use the CanActivate route guard ✗
• Use the CanActivateChildren route guard
• Use the Resolve route guard
• Use the CanLoad route guard ✔
• Nothing needs to be done, this behavior is automatically handled by Angular
Summary: Correct Choices: 1 ✔ Wrong Choices = 1 ✗ Missing Answers: 0 ∅
Time taken: 01m:39s
ng-content #1:

Consider the following angular componenty:

import { Component } from '@angular/core';

@Component({
selector: 'my-monster',
template: `<div>AAA</div><ng-content></ng-content>`
})
export class MonsterComponent {}

And the corresponding HTML:

<my-monster><div>BBB</div></my-monster>

What will be the HTML generated by this?

Select the closest option:

1. <div>AAA</div>
2. <div>AAA</div><ng-content><div>BBB</div></ng-content>
<div>AAA</div><div>BBB</div>*
4. <div>BBB</div>
5. This is a syntax error

Answer

Answer is Correct

Exercise Options Candidate Choices


• <div>AAA</div>
• <div>AAA</div><ng-content><div>BBB</div></ng-content>
• <div>AAA</div><div>BBB</div> ✔
• <div>BBB</div>
• This is a syntax error
Summary: Correct Choices: 1 ✔ Wrong Choices = 0 ✗ Missing Answers: 0 ∅
Time taken: 01m:43s

React.js Knowledge Objective Questions


Sibling State:

Consider a react component Money which has two children Rupees and Paisa. Both, Rupees and Paisa components
have a state containing an amount property which can be modified. You are asked to implement an addPaisa(amt)
method to the Paisa component which increments the amount in Paisa by amt and if the total goes above hundred,
then decrement it by 100, and increment the amount in Rupees component by 1. What is it the right way for addPaisa in
Paisa to access the state of Rupees?

Select the closest option:

1. Using this.parent.rupees.setState
2. Using this.parent.rupees.state.amount
3. Using this.getParent().getChildren()[0].setState
4. Using window.Money.rupees.setState
It is not possible for a component to access a sibling component's state*

Answer

Answer is Correct

Exercise Options Candidate Choices


• Using this.parent.rupees.setState
• Using this.parent.rupees.state.amount
• Using this.getParent().getChildren()[0].setState
• Using window.Money.rupees.setState
• It is not possible for a component to access a sibling component's state ✔
Summary: Correct Choices: 1 ✔ Wrong Choices = 0 ✗ Missing Answers: 0 ∅
Time taken: 03m:32s
useState #3:

Consider the following react code:


import React, { useState } from 'react';
function MyComp() {
for (let i=0; i<3; i++) {
const [cnt, setCnt] = useState(i);
}
setCnt(cnt + 1);
console.log('cnt is ' + cnt);
}

Which of the following statements is true?

Select all that apply:

1. The first time MyComp is called, it will print cnt is 3


2. The second time MyComp is called, it will print cnt is 6
3. The first time MyComp is called, it will print cnt is 1
4. The first time MyComp is called, it will print cnt is 2
This is illegal because useState cannot be used in a for loop*

Answer

Answer is Correct

Exercise Options Candidate Choices


• The first time MyComp is called, it will print cnt is 3
• The second time MyComp is called, it will print cnt is 6
• The first time MyComp is called, it will print cnt is 1
• The first time MyComp is called, it will print cnt is 2
• This is illegal because useState cannot be used in a for loop ✔
Summary: Correct Choices: 1 ✔ Wrong Choices = 0 ✗ Missing Answers: 0 ∅
Time taken: 03m:21s
React.js applicability:

Which of the following statements about React.js's applicability to a particular domain are true?

Select all that apply:

1. Because of overheads of React.js, it is not an ideal framework if you want to simply build a basic CRUD
(Create/Read/Update/Delete) frontend
2. Because all React.js components are embedded inside other components, it is not a good framework if you want to
implement various independent UI components that need to be mixed-and-matched to produce a frontend
3. React.js cannot be used in the frontend if the backend is written using ASP.NET or other Microsoft technologies
One of the important features of React.js is that not only does it perform on the client side, but it can also be
rendered server side, and they can work together inter-operably.*
5. If you have a large web-page and need to continuously update just a small part of that page, React.js is not a good
framework - the continuous page refreshes will result in bad performances.

Answer
Answer is Correct

Exercise Options Candidate Choices


• Because of overheads of React.js, it is not an ideal framework if you want to simply
build a basic CRUD (Create/Read/Update/Delete) frontend
• Because all React.js components are embedded inside other components, it is not
a good framework if you want to implement various independent UI components that
need to be mixed-and-matched to produce a frontend
• React.js cannot be used in the frontend if the backend is written using ASP.NET or
other Microsoft technologies
• One of the important features of React.js is that not only does it perform on the
client side, but it can also be rendered server side, and they can work together ✔
inter-operably.
• If you have a large web-page and need to continuously update just a small part of
that page, React.js is not a good framework - the continuous page refreshes will
result in bad performances.
Summary: Correct Choices: 1 ✔ Wrong Choices = 0 ✗ Missing Answers: 0 ∅
Time taken: 0h:11m
React.js error:

Consider the following React/JSX code:

function attr(props) {
return <div>The value is {props.value}</div>
}
ReactDOM.render(
<attr value="v1"/>,
document.getElementById('mydiv')
);

This code has an error and does not work as expected. Which of the following is the problem with this code?

Select all that apply:

1. The first argument of ReactDOM.render must be a JavaScript object, and not HTML/JSX code
2. The second argument of ReactDOM.render be document.getElementById('root')
3. The function attr should return a string or JavaScript object, and not HTML/JSX code
attr needs to be capitalized as Attr*
5. None of the above

Answer

Answer is Incorrect

Exercise Options Candidate Choices


• The first argument of ReactDOM.render must be a JavaScript object, and not
HTML/JSX code
• The second argument of ReactDOM.render be document.getElementById('root')
• The function attr should return a string or JavaScript object, and not HTML/JSX
code ✗
• attr needs to be capitalized as Attr ∅
• None of the above
Summary: Correct Choices: 0 ✔ Wrong Choices = 1 ✗ Missing Answers: 1 ∅
Time taken: 03m:10s
ReactJS events:

Consider the following code used in a ReactJS app:

function eventAction() {
function doClick(e) {
// click processing
return false;
}

return (
<a href={someUrl} onClick={doClick}>
My button
</a>
);
}

The idea is that when My button is clicked the doClick function is called, and the default processing (going to
someUrl) should be disabled. However, there is a problem with this code. What is the recommended way to do this?

Select the closest option:

1. The doClick function should return true


2. The onClick attribute should be changed to onClick="doClick(); return false;
The doClick function should call e.preventDefault() instead of returning false*
4. Replace href={someUrl} with href="#"
5. None of the above

Answer

Answer is Correct

Exercise Options Candidate Choices


• The doClick function should return true
• The onClick attribute should be changed to onClick="doClick(); return
false;
• The doClick function should call e.preventDefault() instead of returning false ✔
• Replace href={someUrl} with href="#"
• None of the above
Summary: Correct Choices: 1 ✔ Wrong Choices = 0 ✗ Missing Answers: 0 ∅
Time taken: 01m:43s

Programming
No Splurge:
Consider a JSON string that looks like this:

[
["Swiggy", 123],
["Swiggy", 227],
["Zomato", 103],
["Zomato", 171],
["Dunzo", 131],
["Zomato", 122],
["Swiggy", 181]
]

This string encodes a list of payments made by a person for various delivery services. Each element of the list is a itself a
list of two elements - the first is the name of the service, and the second is the amount.

Write a function/method in JavaScript to take such a string and return the number of services for which this person has
never paid an amount of 200 or more.

For example, if the above string is passed to your code, it should return 2 (since this person has never paid 200 or more
for Zomato and Dunzo.) Remember, the input will be passed to you as a string.

In the comments in your code, indicate what is the running time of your program e.g. O(n^2) or O(n log n). You get
bonus points if your program has a average running time of O(n log n) or O(n).

Answer

Feedback:

Appeared for test multiple times

-by ReliScore

function findHighestAverageService(jsonString) {

const payments = JSON.parse(jsonString);

const serviceMap = new Map();

for (const [service, amount] of payments) {


if (serviceMap.has(service)) {
const { totalAmount, count } = serviceMap.get(service);
serviceMap.set(service, { totalAmount: totalAmount + amount, count: count + 1 });
} else {
serviceMap.set(service, { totalAmount: amount, count: 1 });
}
}

let maxService = null;


let maxAverage = 0;
for (const [service, { totalAmount, count }] of serviceMap.entries()) {
const average = totalAmount / count;
if (average > maxAverage) {
maxAverage = average;
maxService = service;
}
}

return maxService;
}

const arr = [["Swiggy", 123], ["Swiggy", 227], ["Zomato", 103], ["Zomato", 171], ["Dunzo", 131], ["Zomato

const jsonString = JSON.stringify(arr);


const highestAverageService = findHighestAverageService(jsonString);
console.log(highestAverageService);

Solution Quality: Good. Time taken: 0h:14m, Num attempts: 1, Answered on: 20/02 01:14

Feedback:

Appeared for test multiple times

-by ReliScore

Summary

Rushikesh Dilwale
Total points: 43 (Cutoffs: 35, 25) Email: [email protected]
Date: 19-Feb-24 19:44PM Time taken: 3h:10m
Percentile Score: 96 ? Distribution Of Scores
Cheating: --

You might also like