1D0-635: CIW JavaScript Specialist Exam Practice Test 2 — Flashcards | Certified Internet Web Professional | FatSkills

1D0-635: CIW JavaScript Specialist Exam Practice Test 2 — Flashcards

Fast review mode: answers are shown by default so you can skim quickly. Hide them if you want to self-test.

1 of 29 Ready
Which of the following is a valid variable name in JavaScript?
that
Shortcuts
Prev Space Show / hide Next
Turn this into a study set.
Sign in with Google to save tricky questions to your reminder list and resume on any device.
Sign in with Google Free • no extra password
\""},{"id":756113,"question":"Which of the following is a browser security issue that JavaScript developers should remember when developing a script?","answer":"Certain JavaScript functionality may be blocked by some browsers, which prevents the script from running as expected for all users."},{"id":756114,"question":"Which statement will open this Web document in a new browser window?","answer":"window.open(http://www.CIWcertified.com\");\""},{"id":756115,"question":"You want to display a series of elements. Which choice demonstrates the correct syntax for an array in JavaScript?","answer":"var myArray = new Array(1,2,3,4,5) for (var i = 0; i < myArray.length ; i++ ){ document.write( myArray[i] +
\" );\""},{"id":756116,"question":"Consider the following code: What will this alert display?","answer":"It is currently dark in the room"},{"id":756117,"question":"Consider the following code: What is the appropriate parameter for the alert() method in line 5 to reference the text in the firstName text box?","answer":"document.myForm.firstName.value"},{"id":756118,"question":"Consider the following code: When an invalid e-mail When an invalid e-mail address is entered, an alert is displayed to the user, but the form submission is not interrupted. What changes need to be made to the script in order to abort the submission if an invalid e-mail address is entered?","answer":"Add return false after the alert() statement."},{"id":756119,"question":"Suppose you define two variables as follows: var x =5; var y=5\"; Which statement will return the mathematical sum of these variables?\"","answer":"alert(x + parseInt(y));"},{"id":756120,"question":"Consider the following code: What is the expected result when you run this script in the browser?","answer":"No window alert box will appear because there is an error in the code."},{"id":756121,"question":"Consider the following statement: for (X; Y; Z) What does Z represent in this code?","answer":"The loop counter update expression"},{"id":756122,"question":"Which of the following is a practice associated with the security risk known as cross-site scripting (XSS)?","answer":"Inserting JavaScript code in a URL query string to perform an unintended or malicious action"},{"id":756123,"question":"Consider the following code: What needs to be changed to allow this script to run without error?","answer":"Change the characterAt method call to charAt"},{"id":756124,"question":"Which of the following is a reason why a developer would use a JavaScript library?","answer":"JavaScript libraries require a shorter learning curve than JavaScript."},{"id":756125,"question":"Which of the following will correctly declare the EmployeeID variable as a string data type?","answer":"var EmployeeID = 123\";\""},{"id":756126,"question":"Which of the following will correctly modify the value of an X/HTML element's attribute within the DOM?","answer":"setAttribute(AttributeName, NewValue)"},{"id":756127,"question":"Consider the following select list: Which of the following will select the third option in the list?","answer":"var list = document.getElementById(numlist\"); list.options.selectedIndex = 2;\""},{"id":756128,"question":"How is the alert() method different from prompt() and confirm()?","answer":"The prompt() and confirm() methods return a value, whereas alert() does not."},{"id":756129,"question":"Maria, a 22-year old student, is testing her JavaScript application, which includes the following code: Assuming Maria enters truthful information, what is the value of z after executing this code?","answer":"Maria is 22 years old"}]; let qno = 1; // 1-based index for display const total = CARDS.length || 1; const countSpan = document.getElementById('count'); const totalSpan = document.getElementById('total'); const quesDiv = document.getElementById('ques'); const ansDiv = document.getElementById('ans'); const statusSpan = document.getElementById('status'); const toggleAnsBtn = document.getElementById('toggleAns'); totalSpan.textContent = String(total); let autoTimer = null; const AUTO_MS = AUTOPLAY ? AUTO_DELAY : 12000; function setStatus(t){ statusSpan.textContent = t; } let studioTimer = null; function runStudioAuto(){ if (!IS_STUDIO || !AUTOPLAY) return; clearTimeout(studioTimer); studioTimer = setTimeout(() => { if (!ansDiv.classList.contains('show')) { toggleAnswer(); runStudioAuto(); } else if (qno < total) { nextQuestion(); runStudioAuto(); } }, AUTO_DELAY); } function disableBtns(){ document.getElementById("firstques").disabled = (qno <= 1); document.getElementById("prevques").disabled = (qno <= 1); document.getElementById("nextques").disabled = (qno >= total); document.getElementById("lastques").disabled = (qno >= total); } function cleanHtml(html){ if (!html) return ""; // If there is a trailing ", strip it. // Example: "

Label

{ img.src = img.src; }); countSpan.textContent = String(qno); disableBtns(); setStatus("Ready"); // Update reminder checkbox for this card const cb = document.getElementById('addtoremind'); const cv = document.getElementById('check-validator'); if (cb && card.id) { cb.value = String(card.id); cb.checked = false; if (cv) cv.textContent = ""; } } if (IS_STUDIO && AUTOPLAY) { runStudioAuto(); } function nextQuestion(){ if (qno >= total) return; qno++; renderCard(); } function prevQuestion(){ if (qno <= 1) return; qno--; renderCard(); } function firstQuestion(){ if (qno === 1) return; qno = 1; renderCard(); } function lastQuestion(){ if (qno === total) return; qno = total; renderCard(); } function toggleAnswer(){ if (!ansDiv) return; if (ansDiv.classList.contains('show')) { ansDiv.classList.remove('show'); toggleAnsBtn.textContent = "Show answer"; } else { ansDiv.classList.add('show'); toggleAnsBtn.textContent = "Hide answer"; } } function toggleAuto(){ const btn = document.getElementById("toggleAuto"); if (autoTimer) { clearInterval(autoTimer); autoTimer = null; btn.textContent = "Auto: Off"; setStatus("Auto paused"); return; } autoTimer = setInterval(() => { if (qno >= total) { clearInterval(autoTimer); autoTimer = null; btn.textContent = "Auto: Off"; setStatus("Reached last card"); return; } nextQuestion(); }, AUTO_MS); btn.textContent = "Auto: On"; setStatus("Auto running"); } document.addEventListener('keydown', (e) => { if (e.key === 'ArrowLeft') { e.preventDefault(); prevQuestion(); return; } if (e.key === ' ') { e.preventDefault(); toggleAnswer(); return; } if (e.key === 'Enter' || e.key === 'ArrowRight') { e.preventDefault(); if (!ansDiv.classList.contains('show')) { toggleAnswer(); } else { nextQuestion(); } return; } }); if (IS_STUDIO) { document.addEventListener('keydown', (e) => { if (e.code === 'KeyF') { e.preventDefault(); const root = document.querySelector('.panel') || document.documentElement; if (!document.fullscreenElement) root.requestFullscreen?.(); else document.exitFullscreen?.(); } }); } disableBtns(); renderCard(); // initial sync if (IS_STUDIO && AUTOPLAY) { runStudioAuto(); } function addToReminder(val){ const cb = document.getElementById('addtoremind'); const isChecked = cb && cb.checked; const target = document.getElementById("check-validator"); if (target) target.innerHTML = "loading"; const u = "https://www.fatskills.com/remindthis.php?checked=" + (isChecked ? "true" : "false") + "&qid=" + encodeURIComponent(val); fetch(u, { credentials: "include" }) .then(r => r.text()) .then(t => { if (target) target.innerHTML = t; }) .catch(() => { if (target) target.textContent = ""; }); } window.addToReminder = addToReminder; window.toggleAnswer = toggleAnswer; window.toggleAuto = toggleAuto; window.nextQuestion = nextQuestion; window.prevQuestion = prevQuestion; window.firstQuestion = firstQuestion; window.lastQuestion = lastQuestion;