Magical Indices
Given an array of integers and a number
Write a JS program to determine the number of valid indices.
For example, an array A = [10, 20, 30] and a value x = 25.
We have values 10, 20, 30 at indices 0,1,2 respectively.
So there are 2 valid indices.
Sample Input 1
[1, 2, 3, 5, 7]
13
Sample Output 1
3
"use strict";
process.stdin.resume();
process.stdin.setEncoding("utf-8");
/////
////
function main() {
let integers = JSON.parse(readLine());
let value = JSON.parse(readLine());
/* Write your code here and log the output */
}
Product of array Items
given an array integers, write JS program to get the product of the integers in the given array.
input
the input will be containing single line integers.
output
the output should be single line containing the product as shown in sample outputs.
input1
[1,2,3]
output1
[1 * 2 * 3 = 6]
input2
[-1, -2, -3]
output2
[-1*-2*-3 = -6]
"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() {
let integers = JSON.parse(readLine());
/* Please do not modify anything above this line */
/* Write your code here and log the output */
}
squares of Array items
input
output
input1
[[1,2],[3,4],[5,6]]
output1
[ [ 1,4],[9,16],[25,36]]
input2
[12,[24],36,[48,60]]
output2
[144,[576],1296,[2304,3600]]
"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() {
let myArray = JSON.parse(readLine())
/* Write your code here and log the output */
}
Find the First Value
Given an array myArray of positive integers, write a JS program to find the smallest integer divisible by 2 and 3.
input
the input will be a single line containing an myArray
output
the output should be a single line containing a number divisible by 2 and 3 or undefined.
input1
[51,18,15,12]
output1
12
input2
[41,29,17,19,31]
output2
undefined
"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() {
let myArray = JSON.parse(readLine());
/* Write your code here and log the output */
}
Replacing Array Item
input
output
input1
[1,2,3,"four",5,6]
"four"
4
output1
[1,2,3,4,5,6]
input2
[22,44,88,352,352]
352
176
output2
[22,44,88,176,352]
"use strict";
process.stdin.resume();
process.stdin.setEncoding("utf-8");
let inputString = "";
let currentLine = 0;
////
/////
function main() {
let myArray = JSON.parse(readLine().replace(/'/g, '"'));
let targetItem = JSON.parse(readLine().replace(/'/g, '"'));
let replaceItem = JSON.parse(readLine().replace(/'/g, '"'));
Write your code here and log the output
}
CCBP Login
Reference image:
https://assets.ccbp.in/frontend/content/dynamic-webapps/ccbp-login-op.gif
<!DOCTYPE html>
<html>
<head> </head>
<body>
<div class="container">
<h1 class="form-heading">CCBP Login</h1>
<form id="myForm">
<div class="username">
<label for="name" class="username-heading">User Name</label>
<input autocomplete="off" type="text" id="name" class="input" />
<p id="nameErrMsg" class="error-message"></p>
</div>
<div class="password">
<label for="password" class="password-heading">Password</label>
<input type="password" id="password" class="input" />
Bike Search
Use the below reference image
https://assets.ccbp.in/frontend/content/dynamic-webapps/bike-search-op.gif
HTML
<!DOCTYPE html>
<html>
<head></head>
<body>
Your code goes here
</body>
</html>
Instructions
Achieve the design with HTML, CSS, and functionality with JS
1. Add code to the HTML file to reference the script.js file using best practices. Other than this, do not modify either the HTML or CSS file. 2. In the script.js file set strict mode for JavaScript. 3. Create a new h3 element with your name in it and insert it before the first paragraph. 4. In the footer, add a cite element with the text "Information and photos from Wikipedia" where "Wikipedia" is a link to the page "https://en.wikipedia.org/wiki/Bumblebee". 5. console.log the number of paragraphs with some descriptive text (open the browser console to see the output). 6. Add the class "special" to the second h2 element. 7. Select all the figcaptions and make the font italic. (This will require a for loop.) 8. Once complete, use Zip to compress the whole folder (including all files) and submit the zip file.
Use loops and control structure create a program that grades the following list of students given the table grade below
Using multi dimensional arrays, create an array that will store 10 items of stock with brand name. Number of stock in store and Quantity sold