the goal of this coding exam is to quickly get off you the ground with the array method every().
input
output
input1
[{'name': 'Blake Hodges', 'points':[76, 98, 88, 84]},[{'name': 'James Anderson', 'points':[0, 98, 12, 33]},[{'name': 'Matthew Norton', 'points':[89, 67, 83, 93]}
output1
['Blake Hodges]
function readLine() {
return inputString[currentLine++];
}
function main() {
const candidatesList = JSON.parse(readLine().replace(/'/g, '"'));
/* Please do not modify anything above this line */
// Write your code here
}
Car Race
the goal of this code is to get output using with Classes.
input
first line of input contains a string playerName
second line of input contains a number nitro
third line of input contains a number speed
output
the output contains multiple lines with the appropriate texts
input1
Alyssa
100
1
output1
Race has started
Speed 50; Nitro 50
speed 70; Nitro 60
Alyssa is the winner
Speed 0; Nitro 60
function readLine() {
return inputString[currentLine++];
}
// Create your Super Class Race and Sub Class Car here
function main() {
const playerName = readLine();
const nitro = JSON.parse(readLine());
const speed = JSON.parse(readLine());
const car1 = new Car(playerName, nitro, speed);
console.log(car1.startRace());
car1.nitroBoost();
console.log(`Speed ${car1.speed}; Nitro ${car1.nitro}`);
car1.accelerate();
console.log(`Speed ${car1.speed}; Nitro ${car1.nitro}`);
console.log(car1.endRace());
car1.applyBreak();
console.log(`Speed ${car1.speed}; Nitro ${car1.nitro}`);
}
Bunty Birthday
the goal of the code to get output using with DateMethods.
input
output
input1
['2000-05-13', 'June 7 2021','03/24/2000']
output1
1
2
input2
['Jan 26 2000','Dec 13 2001, 'Nov 18 2001']
output2
function readLine() {
return inputString[currentLine++];
}
function main() {
const birthdaysList = JSON.parse(readLine().replace(/'/g, '"'));
const buntyBirthday = new Date("2000-06-13");
/* Please do not modify anything above this line */
// Write your code here
}
Selected words to Uppercase
the goal of this code to get output using string methods startsWith(), endsWith() and toUpperCase()
convert uppercase if a string in wordsList starts or ends with the given myString
log the array containg the converted strings in the console
input
the first line containing an array wordsList
second line containing a string myString
output
the output should be single line containing an array with converted strings
input1
['absolute','umbrella','achivement','formula']
a
output1
['ABSOLUTE', 'UMBERELLA','ACHIVEMENT','FORMULA']
function readLine() {
return inputString[currentLine++];
}
function main() {
const wordsList = JSON.parse(readLine().replace(/'/g, '"'));
const myString = readLine();
/* Please do not modify anything above this line */
// Write your code here
}
Flattening & case conversion
the given code to get output using array methods flat(),map() and string methods toLowerCase() and toUpperCase().
input
the first line input is an array nestedArray
the second line input is a number depth
output
the output containing an array with words having even lengths in lowercase and odd length in uppercase
input1
['Inspector', ['ANKLE',['HIKE']],'pawn']
output2
['INSPECTOR','ANKLE', 'hike',' pawn']
function readLine() {
return inputString[currentLine++];
}
function main() {
const nestedArray = JSON.parse(readLine().replace(/'/g, '"'));
const depth = JSON.parse(readLine());
/* Please do not modify anything above this line */
// Write your code here
}
words with vowels
the goal of the code is to get output using array method filter()
input
the input will be single line containing an array wordsList
output
the output should be single line containing an array with filtered words
input1
['Sword', 'Myth', 'Patient' ,'Rhythm] output2
['Sword', 'Patient']
"use strict";
process.stdin.resume();
process.stdin.setEncoding("utf-8");
let inputString = "";
let currentLine = 0;
process.stdin.on("data", (inputStdin) => {
inputString += inputStdin;
});
process.stdin.on("end", (_) => {
inputString = inputString.trim().split("\n").map((str) => str.trim());
main();
});
function readLine() {
return inputString[currentLine++];
}
function main() {
const wordsList = JSON.parse(readLine().replace(/'/g, '"'));
const vowelsList = ["a", "e", "i", "o", "u"];
// Write your code here
}
the goal of this code is to quickly get you off the ground with the array method map().
input
the input will be single line containing an array myArray.
output
the output will be single line containing the newArray.
constaints
Strings should be given in quotes
input1
[ 1, 'David' 10, {'points':97}, 25, 'alphabet', true]
output1
[2, 'string' 20, 'object', 50, 'string', 'boolean']
"use strict";
process.stdin.resume();
process.stdin.setEncoding("utf-8");
let inputString = "";
let currentLine = 0;
process.stdin.on("data", (inputStdin) => {
inputString += inputStdin;
});
process.stdin.on("end", (_) => {
inputString = inputString.trim().split("\n").map((str) => str.trim());
main();
});
function readLine() {
return inputString[currentLine++];
}
function main() {
const myArray = JSON.parse(readLine().replace(/'/g, '"'));
// Write your code here
}
Bob a builder has come to you to build a program for his business. He needs to determine the square footage of a room in order to buy materials and calculate costs. Bob charges $125 per square metre. The program is going to ask the user to enter the name of a room. It will then ask for the width and length of the room (in meters) to be built. The program will calculate the room area and use this information to generate an approximate cost. Your program will display the room, the total area and the approximate cost to the screen.
Using Pseudocode, develop Javascript for this problem.
Double the numbers
the goal of this code is to get quickly off the ground with array method map().
input
output
constraints
sample input1
[1, 'David', 10, {'points':97}, 25, 'alphabet', true]
sample output1
[2, 'string' 20, 'object', 50, 'string' 'boolean']
function readLine() {
return inputString[currentLine++];
}
function main() {
const myArray = JSON.parse(readLine().replace(/'/g, '"'));
/* Please do not modify anything above this line */
// Write your code here
}
the goal of this code is to quickly get you off the ground with Creating and Consuming Promises.
input
output
based on inputs
sampleinput1
true
true
sampleoutput1
Taken Shower
Had Breakfast
Got to Work
function main() {
const isHotWaterReady = JSON.parse(readLine());
const isBreakfastReady = JSON.parse(readLine());
/* Please do not modify anything above this line */
// Write your code here
const takingShower = () => {
return new Promise((resolve,reject) => {
isHotWaterReady ? resolve("Taken Shower") : reject ("Hot Water Not Ready")
});
}
const breakFast = () => {
return new Promise((resolve,reject) => {
isBreakfastReady ? resolve("Had Breakfast") : reject ("Breakfast Not Ready")
});
}