Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

CSCI 2910 JavaScript Quiz - Part 2 - Prof. David L. Tarnoff, Quizzes of Computer Science

The solutions to the javascript part 2 quiz from the csci 2910 course held in spring 2006. The quiz covers various topics such as escape characters, parsing strings to integers and floats, using the isnan() function, and form element properties.

Typology: Quizzes

Pre 2010

Uploaded on 08/18/2009

koofers-user-dkx
koofers-user-dkx 🇺🇸

3

(1)

10 documents

1 / 1

Toggle sidebar

Related documents


Partial preview of the text

Download CSCI 2910 JavaScript Quiz - Part 2 - Prof. David L. Tarnoff and more Quizzes Computer Science in PDF only on Docsity! Name: ________________________________ CSCI 2910 JavaScript Part 2 Quiz Spring 2006 1. Rewrite the following line of JavaScript using escape characters instead of the embedded single and double quotes. document.write("<a class='menu'>"); document.write("<a class=\"menu\">"); 2. Consider the line of code: retval = parseInt("1392 North Roan Street", 10); a.) What value would retval contain? 1392 b.) Would retval be a string or a scalar (numeric value)? parseInt() returns an integer value. 3. Consider the line of code: retval = parseFloat("$12.56"); What value would retval contain? "NaN" – the returned value would be "not a number" since the string begins with $. 4. Consider the line of code: retval = isNaN("tarnoff"); What value would retval contain? Since "tarnoff" is not a number, inNAN("tarnoff") would return "true". 5. True or False: The form object has a method reset() that is used to simulate the user pressing the reset button on a form. 6. JavaScript can be used to force the cursor to appear in a specific textbox using the form element method _____________. a.) force() b.) blur() c.) activate() d.) goto() e.) focus() f.) click() 7. The form element property .value works differently for different form elements. For each of the following, describe what value the property returns. text_name.value: returns the text contained inside the text box button_name.value: returns the text printed on the button face select_name.value: returns the value of the selected option 8. If the string email_string does not contain the symbol "@", what would the return value be for the JavaScript code email_string.indexOf("@")? If indexOf() does not find the character or substring it was looking for, it returns a -1.
Docsity logo



Copyright © 2024 Ladybird Srl - Via Leonardo da Vinci 16, 10126, Torino, Italy - VAT 10816460017 - All rights reserved