Unite Family
Given three objects
Sample Input
{'surname' : 'Jones', 'city': 'Los Angeles'}
{'dish': 'puddings'}
{'pet': 'Peter'}
Sample Output
Mr and Mrs Jones went to a picnic in Los Angeles with a boy and a pet Peter. Mrs Jones made a special dish "puddings"
Sample output-2
Expected: Mr and Mrs Williams went to a picnic in Columbia with a boy and a pet Rocky. Mrs Williams made a special dish "cakes"
your output: Mr and Mrs Jones went to a picnic in Los Angeles with a boy and a pet Peter. Mrs Jones made a special dish "puddings"
Final Value with Appreciation
Given principal amount
principal as an input, time period in years time and appreciation percentage apprPercentage as optional inputs, write a JS function to return the final value finalValue with the given appreciation percentage and time period. The default values for time and apprPercentage are 2 and 5 respectively.
Quick Tip
The formula to calculate the final value with appreciation is,
finalValue = principal * (1 + time * appreciation / 100)
Sample Input 1
1000
2
3
Sample Output 1
1060
Sample Input 2
3000
Sample Output 2
3300.0000000000005
Write CSS code to make all second-level headings (h2 elements) green and italic.
Write CSS code to make all second-level headings (h2 elements) green and italic.
Create a webpage titled “Midterm Exam” which displays your full name, centered, with font size 30 pixels, bold format, in "Times New Roman" font and red in color using inline CSS.
String Slicing
Given two strings
inputString and subString as inputs, write a JS program to slice the inputString if it includes the subString. Slice the inputString starting from the subString to the end of the inputString.
Input
The first line of input contains a string inputString
The second line of input contains a string subString
Output
The output should be a sliced string or inputString (if the inputString does not include the subString)
Sample Input 1
JavaScript
S
Sample Output 1
Script
Sample Input 2
Language
air
Sample Output 2
Language
Split and Replace
Given three strings
inputString, separator and replaceString as inputs.
Write a JS program to split the
inputString with the given separator and replace strings in the resultant array with the replaceString whose length is greater than 7.
Quick Tip
You can use the string method split()
You can use the array method map()
Input
The first line of input contains a string inputString
The second line of input contains a string separator
The third line of input contains a string replaceString
Output
The output should be a single line containing the strings separated by a space
Sample Input 1
JavaScript-is-amazing
-
Programming
Sample Output 1
Programming is amazing
Sample Input 2
The&Lion&King
&
Tiger
Sample Output 2
The Lion King
String Ending with Vowel
Given an array of vowels in the prefilled code and a string
inputString as an input, write a JS program to check whether the inputString ends with a vowel.
Quick Tip
You can use the string methods toUpperCase() and endsWith().
Input
The input will be a single line containing a string inputString
Output
The output should be a single line containing a boolean value
Sample Input 1
Five
Sample Output 1
true
Sample Input 2
Apples grow best where there is cold in winter
Sample Output 2
false
Given an array
myArray of numbers, write a JS program to perform the following steps and log the result.
Multiply each value with 9.
Subtract 20 from each value.
Multiply each value with 7.
Log the values of the resulting array separated by a space.
Input
The input will be a single line containing an array myArray
Output
The output should be a single line with values separated by a space
Constraints
Each value in the array must be a number
Sample Input
[ 12, 2, 2, 4, 1 ]
Sample Output
616 -14 -14 112 -77
"use strict";
process.stdin.resume();
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());
/* Write your code here */
}
String Slicing
Given two strings
) Locate two AUPs, one from the internet (published online) and the second one should be for your institution (Richfield Graduate Institute of Technology).