CECS 189D EXAMINATION #1

Similar documents
Such JavaScript Very Wow

COMP519 Web Programming Lecture 16: JavaScript (Part 7) Handouts

PES DEGREE COLLEGE BANGALORE SOUTH CAMPUS 1 K.M. before Electronic City, Bangalore WEB PROGRAMMING Solution Set II

Midterm Exam. 5. What is the character - (minus) used for in JavaScript? Give as many answers as you can.

710 Index Attributes, 127 action attribute, 263 assigning, bottom attribute, domain name attribute, 481 expiration date attribute, 480 8

PIC 40A. Lecture 10: JS: Wrapper objects, Input and Output, Control structures, random numbers. Copyright 2011 Jukka Virtanen UCLA 1 04/24/17

Chapter 1 Introduction to Computers and the Internet

JavaScript CS 4640 Programming Languages for Web Applications

CSC Web Programming. Introduction to JavaScript

COMS 469: Interactive Media II

Student, Perfect Final Exam May 25, 2006 ID: Exam No CS-081/Vickery Page 1 of 6

Forms, Form Events, and Validation. Bok, Jong Soon

JavaScript: More Syntax and Using Events

Javascript Methods. concat Method (Array) concat Method (String) charat Method (String)

CITS1231 Web Technologies

JavaScript: Events, DOM and Attaching Handlers

Controlled Assessment Task. Question 1 - Describe how this HTML code produces the form displayed in the browser.

JavaScript Specialist v2.0 Exam 1D0-735

Full file at Tutorial 2: Working with Operators and Expressions

CS Final Exam Review Suggestions - Spring 2018

Fundamentals of Website Development

COMS 469: Interactive Media II

(from Chapters 10/11 of the text)

Chapter 4 Basics of JavaScript

Section 1. How to use Brackets to develop JavaScript applications

2/6/2012. Rich Internet Applications. What is Ajax? Defining AJAX. Asynchronous JavaScript and XML Term coined in 2005 by Jesse James Garrett

Lab 1 Concert Ticket Calculator

CITS3403 Agile Web Development Semester 1, 2018

write vs. writeln Prompting as Page Loads Today s Goals CSCI 2910 Client/Server-Side Programming Intermediate File vs. HTML Output

c122mar413.notebook March 06, 2013

New Perspectives on Creating Web Pages with HTML. Tutorial Objectives

3Lesson 3: Functions, Methods and Events in JavaScript Objectives

JavaScript: Introduction to DOM and Attaching Handlers

3 The Building Blocks: Data Types, Literals, and Variables

Javascript. UNIVERSITY OF MASSACHUSETTS AMHERST CMPSCI 120 Fall 2010

COMP519 Practical 5 JavaScript (1)

Coding in JavaScript functions

CIW 1D CIW JavaScript Specialist.

Javascript in the Corvid Servlet Runtime Templates

JavaScript: More Syntax

CSC309 Midterm Exam Summer 2007

5. Strict mode use strict ; 6. Statement without semicolon, with semicolon 7. Keywords 8. Variables var keyword and global scope variable 9.

Web Site Development with HTML/JavaScrip

UNIT-4 JAVASCRIPT. Prequisite HTML/XHTML. Origins

PHP / MYSQL DURATION: 2 MONTHS

EECS1012. Net-centric Introduction to Computing. Lecture Introduction to Javascript

CITS1231 Web Technologies. JavaScript Math, String, Array, Number, Debugging

Client vs Server Scripting

Lab 3 - Pizza. Purpose. Assignment

Programming language components

1$ 5 ! $ 6 4 * Source: 0 "!*! 0! * 8 97 ?!$ 5 0 *! 4! $ 0 : * ' () 7;7 7<7

a Why JavaScript? jonkv interactivity on the web CGI JavaScript Java Applets Netscape LiveScript JavaScript 1: Example

URLs and web servers. Server side basics. URLs and web servers (cont.) URLs and web servers (cont.) Usually when you type a URL in your browser:

JavaScript CS 4640 Programming Languages for Web Applications

Client-Side Web Technologies. JavaScript Part I

What Is JavaScript? A scripting language based on an object-orientated programming philosophy.

Elementary Computing CSC 100. M. Cheng, Computer Science

COMS W3101: SCRIPTING LANGUAGES: JAVASCRIPT (FALL 2017)

Princeton University COS 333: Advanced Programming Techniques A Subset of JavaScript

JavaScript Introduction

Lab 2 Population. Purpose. Assignment Lab 2 analyzes population growth of a town as well as compare the population growth of two towns.

Lecture 3: The Basics of JavaScript. Background. Needs for Programming Capability. Origin of JavaScript. Using Client-side JavaScript

Alpha College of Engineering and Technology. Question Bank

CSC Javascript

LECTURE-2. Functions review HTML Forms. Arrays Exceptions Events. CS3101: Scripting Languages: Javascript Ramana Isukapalli

Text Input and Conditionals

5/19/2015. Objectives. JavaScript, Sixth Edition. Introduction to the World Wide Web (cont d.) Introduction to the World Wide Web

BEFORE CLASS. If you haven t already installed the Firebug extension for Firefox, download it now from

EXERCISE: Introduction to client side JavaScript

1. Cascading Style Sheet and JavaScript

By the end of this section of the practical, the students should be able to:

DbSchema Forms and Reports Tutorial

HTML5 and CSS3 More JavaScript Page 1

Produced by. App Development & Modeling. BSc in Applied Computing. Eamonn de Leastar

By the end of this section of the practical, the students should be able to:

Client-side Development using HTML, Javascript and CSS

Princess Nourah bint Abdulrahman University. Computer Sciences Department

JavaScript: The Basics

JavaScript s role on the Web

Web Programming and Design. MPT Junior Cycle Tutor: Tamara Demonstrators: Aaron, Marion, Hugh

DbSchema Forms and Reports Tutorial

JavaScript and XHTML. Prof. D. Krupesha, PESIT, Bangalore

COMP284 Practical 6 JavaScript (1)

INSTITUTE OF AERONAUTICAL ENGINEERING (Autonomous) Dundigal, Hyderabad

(from Chapter 10/11 of the text)

Then there are methods ; each method describes an action that can be done to (or with) the object.

Web Programming Step by Step

Basics of JavaScript. Last Week. Needs for Programming Capability. Browser as Development Platform. Using Client-side JavaScript. Origin of JavaScript

COMS 469: Interactive Media II

JAVASCRIPT BASICS. JavaScript String Functions. Here is the basic condition you have to follow. If you start a string with

Princeton University COS 333: Advanced Programming Techniques A Subset of JavaScript

Unit Test Plan for the Joomla Menu Manager

DC71 INTERNET APPLICATIONS JUNE 2013

Introduction to JavaScript p. 1 JavaScript Myths p. 2 Versions of JavaScript p. 2 Client-Side JavaScript p. 3 JavaScript in Other Contexts p.

Project 3 Web Security Part 1. Outline

JavaScript Functions, Objects and Array


HTML 5 and CSS 3, Illustrated Complete. Unit L: Programming Web Pages with JavaScript

The course is supplemented by numerous hands-on labs that help attendees reinforce their theoretical knowledge of the learned material.

and event handlers Murach's C# 2012, C6 2013, Mike Murach & Associates, Inc. Slide 1

Transcription:

CECS 189D EXAMINATION #1 SPRING 10 70 points MULTIPLE CHOICE 2 points for each correct answer Identify the choice that best answers the question on a Scantron 882 with a pencil #2. When you're on the campus to return the exam, you can buy the scantron at the coffee shop. Chapter 1 1. A web application is a type of a. client/server application c. JavaScript application b. database application d. server-side application 2. An HTTP response is sent from a. the web server to the application server b. the application server to the web server c. the client to the web server d. the web server to the client 3. When a client requests a dynamic web page, the XHTML is generated by a. the web server b. an application server c. a database server d. the web browser 4. JavaScript code is run by the a. database server b. application server c. web server d. web browser 5. Which of the following is NOT one of the four core web technologies? a. XHTML b. CSS c. DOM d. PHP 6. To load a web page into a web browser, you can a. type the URL of the web page into the browser s address bar b. type the just the filename of the web page into the browser s address bar c. type the domain name of the web page into the browser s address bar d. click the browser s Back button

7. To view the source code for a web page in the Firefox or IE browser, you can select the appropriate command from the Chapter 2 a. File menu b. Source menu c. View menu d. Page menu 8. When you use a text editor like Notepad++, it provides color coding and auto completion a. for the JavaScript in a file b. for both the JavaScript and XHTML in a file c. for the JavaScript, XHTML, and CSS in a file d. for JavaScript, XHTML, and CSS files based on the file extension 9. If there s an error in your JavaScript code when you re using Firefox, you can view the error message in the Error Console by selection the appropriate command from the a. File menu c. Tools menu b. View menu d. Error menu 10. A JavaScript identifier a. isn t case-sensitive b. can t start with a $ sign c. can t start with a number d. can t be more than 128 characters long 11. Assume username equals Tom and userage equals 22. What is displayed in a dialog box when the following statement is executed? alert(userage + " \nis " + username + "'s age."); a. 22 is Tom's age. b. 22 is Tom's age. c. 22 \nis Tom's age. d. 22 \n is Tom's age. 12. Which of the following is a valid statement for declaring and initializing a variable named length to a starting value of 120? a. length = 120; c. var length = 120; b. int length = 120; d. num length = 120; 13. After the statements that follow are executed, var firstname = "Ray", lastname = "Harris"; var fullname = lastname; fullname += ", ";

fullname += firstname; a. firstname is "Harris" c. fullname is "Ray" b. firstname is "Ray Harris" d. fullname is "Harris, Ray" 14. After the statement that follows is executed, ratetext contains var ratetext = document.getelementbyid("rate"); a. the string that was entered in the XHTML element with rate as its id b. a reference to the XHTML element with rate as its id c. the value that was entered in the XHTML element with rate as its id d. the XHTML element with rate as its id 15. After the statements that follow are executed, guest contains var guest = "Ray Harris"; var quest = guest.substr(0,3).touppercase(); a. "Ray Harris" c. "Ray" b. "RAY Harris" d. "RAY" 16. When the statement that follows is executed, JavaScript var rate = parsefloat(document.getelementbyid("rate").value); a. executes the getelementbyid method, executes the value method of the resulting object, and executes the parsefloat method on that value b. executes the getelementbyid method, gets the value property of the resulting object, and executes the parsefloat method on that value c. executes the parsefloat method, executes the getelementbyid method, and executes the value method of the resulting object d. executes the parsefloat method, executes the getelementbyid method, and gets the value property of the resulting object 17. After the if statement that follows is executed, what will the value of discountamount be? var discountamount; var ordertotal = 200; if (ordertotal > 200) { discountamount = ordertotal *.3; else if (ordertotal > 100) { discountamount = ordertotal *.2; else { discountamount = ordertotal *.1; a. 0.0 c. 40.0 b. 20.0 d. 60.0 18. What will futurevalue contain after the for loop has been executed one time? var years = 10; var annualrate = 10; var futurevalue = 1000; annualrate = annualrate / 100; for ( i = 1; i <= years; i++ ) { futurevalue = futurevalue * (1 + annualrate);

a. 1000 c. 11000 b. 1100 d. 1010 Code example 2-1 var calculatetax = function ( subtotal, taxrate ) { var tax = subtotal * taxrate; tax = parsefloat( tax.tofixed(2) ); return tax; 19. (Refer to code example 2-1) Which call statement will get the right result if the subtotal is $1000, the tax rate is 8%, and the value that s returned by the function should be stored in a numeric variable? a. var tax = calculatetax( $1000, 8% ); b. var tax = calculatetax( 1000, 8 ); c. var tax = calculatetax( 1000,.08 ); d. calculatetax( subtotal, taxrate ); Code example 2-2 var $ = function ( id ) { return document.getelementbyid( id ); var display_name_click = function () { $("name_text_box").value = "Mike"; window.onload = function () { $("display_button").onclick = display_name_click; 20. (Refer to code example 2-2.) Assuming the web page for this script has a text field with an id attribute of name_text_box and a button with an id attribute of display_button, what will happen when the user clicks the button? Chapter 3 a. The application will display Mike in a dialog box. b. The application will display Mike in the text field named name_text_box. c. The application will display Mike in the button named display_button. d. The application won t display anything. 21. An error that doesn t cause an error but produces the wrong results is known as a a. runtime error b. user error c. logic error d. syntax error 22. In the Firefox browser without Firebug, you can display error messages by selecting the appropriate command from the a. File menu b. View menu

Chapter 6 c. Error menu d. Tools menu 23. If the prompt method displays a dialog box, and the user enters some text and clicks on the OK button, what does the prompt method return? a. a null value b. a Boolean value c. a numeric value d. a string value 24. For the following code, if the user clicks the Cancel button in the first dialog box that s displayed, a second dialog box is displayed that says... var firstname = prompt("please enter your first name:"); if ( firstname == null ) { alert("you must enter your first name."); else if (firstname == "") { alert("first name is required."); else { alert("thank you."); a. Please enter your first name: b. You must enter your first name. c. First name is required. d. Thank you. 25. What property of the Radio object is used to determine if a radio button is selected? a. the value property b. the checked property c. the selected property d. the radio property 26. For a Textarea object, what property do you use to get the text that has been entered into the text area? a. the value property b. the text property c. the name property. d. the string property. 27. For the following code, an event handler named investment_change is var investment_change = function () { var years = parseint( $("years").value ); alert("years: " + years); window.onload = function () { $("investment").onchange = investment_change; a. attached to the onload event of the global window object.

b. attached to the onload event of a control with an id of investment. c. attached to the onchange event of the global window object. d. attached to the onchange event of a control with an id of investment. 28. Assuming you have a radio button with an id of contact_via, which of the following statements selects that radio button? a. $("contact_via").selected = true; b. $("contact_via").checked = true; c. $("contact_via").value = true; d. $("contact_via").enabled = true; 29. How can you clear a check from a Checkbox object? Chapter 7 a. set its clear property to true b. set its checked property to false c. set its value property to an empty string d. call its blur method 30. What method of the Number object returns a string with the number rounded to the specified number of decimal places? a. the tostring method b. the round method c. the toprecision method d. the tofixed method 31. What method of the String object searches the string for an occurence of the specified search string? a. the charat method b. the search method c. the indexof method d. the substring method 32. Which of the following statements is NOT a valid way to create a date object named birthday? a. var birthday = "12/2/1978"; b. var birthday = new Date(); c. var birthday = new Date("12/2/1978"); d. var birthday = new Date(1978, 11, 2); 33. What method of the Date object gets the day of the month in local time? a. the getmonth method b. the getdate method c. the getday method d. the getdayofmonth method

34.What text does the following code display in the dialog box? var investment = "$100"; if (isnan(investment) investment <= 0) { alert("investment is not valid."); else { alert("investment: " + investment.tofixed(2)) a. Investment is not valid. b. Investment: $100 c. Investment: $100.00 d. Investment: 100.00 35. What is the value of salestax after the following code executes? var salestax = 53.937; salestax = parsefloat( salestax.tofixed(2) ); a. NaN b. 53.937 c. 53.94 d. 53.93