ITS practice
![]() |
![]() |
![]() |
Título del Test:![]() ITS practice Descripción: Estudiantes que aman its |




Comentarios |
---|
NO HAY REGISTROS |
You are writing a JavaScript program that collects employee data and stores it in a database. Your program handles a wide variety of data, including text and different types of numbers. You need to ensure that the program handles the data so that it can be stored in the database with the correct data type. For each code segment, determine the data type that is being handled. Move the appropriate data types from the list on the left to the correct code segments on the right. You may use each data type once, more than once, or not at all. var age = 23;. var exempt = false;. var initial = ‘D’;. var zip = “81000”;. var salary = 123.5;. You are creating a form that allows customers to choose the spice level of their food. If they choose Spicy, the page should display a warning. You write the following code. Line numbers are included for reference only. 01 <form name = “orderForm” action = “#” method = “post”> 02 <select name = “heatIndex” required> 03 <option>Mild</option> 04 <option>Medium</option> 05 <option>Spicy</option> 06 </select> 07 <button onclick = “checkWarning()”>Order</button> 08 </form> You write the following JavaScript code to display the warning: 09 function checkWarning(){ var option = document.forms.orderForm[“heatIndex”]; if (option == “Spicy”) { alert(“Spicy food: Good Luck!”); } }. Change line 07 to <button onchange = “checkWarning();”>Order</button>. Change line 07 to <button onclick = “checkWarning();”>Order</button>. Change line 10 to var option = document.forms.orderForm[“heatIndex”].value;. Change line 10 to var option.value = document.forms.orderForm[“heatIndex”];. You are creating a function name countdown. The function accepts a parameter named start, and displays a countdown from that number to (and including) zero in increments of one. Complete the code by selecting the correct option from each drop-down list. Note: You will receive partial credit for each correct selection. function countdown(start) { for ( ){ console.log(i); } } Mark the option to complete this exercise. var i=start;. var i=ZNM;. i>=0;. i<=0;. i--. i++. You work as a JavaScript develop. You are writing a simple script that performs the following actions: Declares and initializes an array. Fills the array with 10 random integers. Adds every other number starting with the first element. Complete the code by selecting the correct option from each drop-down list. Note: You will receive partial credit for each correct selection. var numbers = ; for (var i = 0; i < 10; i++) { numbers. (Math.round(Math.abs(Math.random() * 10))); } var sum = 0; for (var j = 0; j < 10; j = j+2 ) { sum += ; } console.log(sum);. []. (). push. Shift. numbers[j]. numbers[u]. You need to determine whether a string named str is empty. What is the correct syntax?. str == “null”. str == “empty”. str == null. str === “”. You are creating a dynamic HTML page by using JavaScript The page displays an image of the sun. When the user moves the mouse pointer across the image, the image should change from the sun to the moon. When the user moves the mouse pointer away from the image, the image should revert to the sun. You need to write the code for the image swap. Which two events should you program for? (choose 2). onmouseup. onmouseenter. onmousedown. onmouseout. onmouseover. You are designing a web page with a script that must dynamically change the content of a paragraph element to display the value returned by the function randomQuote(). You write the following code. Line numbers are included for reference only. 01 <!DOCTYPE html> 02 <html> 03 <body> 04 <p id=“tester” onclick=“changeText()”>Click to change the content.</p> 05 <input type=“button” value=“Change Text” onclick=“changeText()” /> 06 <script> 07 function changeText() { 08 09 } 10 </script> 11 </body> 12 </html>. document.getElementById(“tester”).script = randomQuote();. document.getElementById(“tester”).innerHTML = randomQuote();. document.getElementById(“tester”).tittle = randomQuote();. document.getElementById(“tester”).value = randomQuote();. You are creating an application that requires a title and a numbered list. The title will not include any HTML markup. Complete the code by selecting the correct option from each drop-down list. Note: You will receive partial credit for each correct selection. <body> <h1 id=“title”></h1> <section id=“showList”></sectio <button id=“wish”>Wish List</button> <script> var list=[“Bicycle”,”Guitar”,”Computer”,”Camera”]; var text=“<ol>”; document.getElementById(“wish).addEvenListener(“click”,fuction(){ for (var sub=0;sub<list.length;sub++){ text+=“<li>”+list[sub] + “</li>”; } text+=“</ol>”; }) </script> </body>. document.getElementById(“title”)textContent=“Wish List”,. document.getElementById(“showList”)textContent=“Wish List”,. document.getElementById(“showList”).innerHTML= text;. document.getElementById(“Title”).innerHTML= text;. You are developing a web page that displays students registration information. You need to test the code to ensure that it retrieves and displays the student information correctly. Complete the code by selecting the correct option from each drop-down list. Note: You will receive partial credit for each correct selection. <h2>New Student Registration</h2> <script> this.firstName = first; this.lastName = last; this.major = major; this.year = year; this.info = function(){ document.write( “<p>You are registered as ” + this.firstName + “ ” + this.lastName + “</p>” + “<p>You are a ” + this.year + “ who is majoring in ” + this.major + “</p>”); } } </script> </body>. class student(firstName, lastName, major, year){. class student(firstName, nickName, major, year){. var newStudent = new student(“Sherlock”, “Sassafrass”, “IT”, “freshman”);. var newStudent = old student(“Sherlock”, “Sassafrass”, “IT”, “freshman”);. newStudent.info();. oldStudent.info();. You are writing a web application that stores customer information in an array of objects. Each Customer object has the following properties: customerName lastOrderDate orderAmount You need to create and populate a list of customers and identify customers who placed orders in the last 3 years. Complete the code by selecting the correct option from each drop-down list. for (var i = 0; i < customers.length; i++) { var customer = customer[i]; var currentDate = new Date(); var orderDate = new Date(customer.lastOrderDate); if - <3) { console.log(“Customer “ + customer[i].customerNAme + “ placed order “ + dateDiff(currentDate, orderDate)); } }. currentDate.getFullYear(). currentDate.getFullYear{}. orderDate.getFullYear(). orderDate.getFullYear{}. In the first drop-down list, select the code that changes the button color when the page loads. In the second drop-down list, select the code that changes the button color when the user clicks the button. Note: You will receive partial credit for each correct selection. <button id=“btn”>Change</button> <script> function changeColor(){ var colors=[“blue”, “green”, “pink”, “orange”]; sub = Math.floor(Math.random()*4); document.getElementById(“btn”).style.background = colors[sub]; } </script> . document.body.onload=changeColor();. div.body.onload=changeColor();. document.getElementById(“btn”).onclick=changeColor();. document.getElementByTagName(“btn”).onclick=changeColor();. Your company offers a 10 percent discount if the day of the week is Wednesday. You need to write a JavaScript function name getDiscount that meets the following requirements: Accepts the day of the week (day) as a string. Returns the appropriate discount. Complete the code by selecting the correct option from each drop-down list. 01 function getDiscount(day) { 02 var discount = 0; 03 day = day.toLowerCase(); 04 05 06 discount = .1; 07 break; 08 09 discount = 0; 10 break; 11 } 12 return discount; 13 }. switch (day) {. switch (month) {. case “wednesday”:. case “Monday":. default:. definet:. You are creating a script that will assign a category based on the user’s age. The script must implement the following rules: Assign users who are at least 24 years old but less than 36 years old to CAT1. Assign users who are at least 36 years old but less than 46 years old to CAT2. Assign all other users to CAT3. Complete the code by moving the appropriate code segments from the list on the left to the correct positions on the right. You may use each code segment once, more than once, or not at all. Note: There is more than one correct order. You will receive partial credit for each response. You will receive credit for any correct order.. else. else if (age >= 24 && <= 35). else if (age >= 36 && age <= 45). else if (age > 45). if (age >= 24 && age <= 35). if (age >= 36 && age <= 45). if (age > 45). You review the following JavaScript code: var x = “10”; var y = x + 10; When the code runs, what is the value of y?. 20. 1010. NaN. The value of y is undefined. You need to create an external JavaScript file that contains a function named showArea. The function displays the area of a rectangle. Which code segment correctly implements this requirement?. <head> <script> function showArea(length, width) { alert(length * width); } </script> </head>. function showArea(length, width) { alert(length * width); }. <script> function showArea(length, width) { alert(length * width); } </script>. <body> <script> function showArea(length, width) { alert(length * width); } </script> </body>. |