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

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

JavaScript CS 4640 Programming Languages for Web Applications

CSC Web Programming. Introduction to JavaScript

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

CGS 3066: Spring 2015 JavaScript Reference

JavaScript Lecture 1

Lecture 05 I/O statements Printf, Scanf Simple statements, Compound statements

What is PHP? [1] Figure 1 [1]

JavaScript CS 4640 Programming Languages for Web Applications

UNIT -II. Language-History and Versions Introduction JavaScript in Perspective-

Sample CS 142 Midterm Examination

Manju Muralidharan Priya. CS4PM Web Aesthetics and Development WEEK 11

Frontend II: Javascript and DOM Programming. Wednesday, January 7, 15

React. HTML code is made up of tags. In the example below, <head> is an opening tag and </head> is the matching closing tag.

Proper_Name Final Exam December 21, 2005 CS-081/Vickery Page 1 of 4

Client-Side Web Technologies. JavaScript Part I

Princess Nourah bint Abdulrahman University. Computer Sciences Department

First Name Last Name CS-081 March 23, 2010 Midterm Exam

Overview: Programming Concepts. Programming Concepts. Names, Values, And Variables

Overview: Programming Concepts. Programming Concepts. Chapter 18: Get With the Program: Fundamental Concepts Expressed in JavaScript

Chapter 3 - Simple JavaScript - Programming Basics. Lesson 1 - JavaScript: What is it and what does it look like?

JavaScript. Learn to program using your browser

c122mar413.notebook March 06, 2013

VARIABLES & ASSIGNMENTS

Sample CS 142 Midterm Examination

CECS 189D EXAMINATION #1

JavaScript: Sort of a Big Deal,

JavaScript Lecture 2

A.A. 2008/09. Why introduce JavaScript. G. Cecchetti Internet Software Technologies

CSCI 131, Midterm Exam 1 Review Questions This sheet is intended to help you prepare for the first exam in this course. The following topics have

JavaScript. History. Adding JavaScript to a page. CS144: Web Applications

Perfect Student Midterm Exam March 20, 2007 Student ID: 9999 Exam: 7434 CS-081/Vickery Page 1 of 5

Student, Perfect Midterm Exam March 24, 2006 Exam ID: 3193 CS-081/Vickery Page 1 of 5

Using Scala in CS241

CS1046 Lab 4. Timing: This lab should take you 85 to 130 minutes. Objectives: By the end of this lab you should be able to:

JavaScript: More Syntax

JavaScript: More Syntax and Using Events

Assessment - Unit 3 lessons 16-21

Exercise 1 Using Boolean variables, incorporating JavaScript code into your HTML webpage and using the document object

JavaScript Basics. The Big Picture

Acknowledgments. Who Should Read This Book?...xxiv How to Read This Book...xxiv What s in This Book?...xxv Have Fun!...xxvi

JavaScript Programming

JavaScript. What s wrong with JavaScript?

Chapter 17. Fundamental Concepts Expressed in JavaScript

Sample CS 142 Midterm Examination

CSCI 111 First Midterm Exam Spring Solutions 09.05am 09.55am, Wednesday, March 14, 2018

PHP by Pearson Education, Inc. All Rights Reserved.

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

HTML5 and CSS3 More JavaScript Page 1

JME Language Reference Manual

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

Chapter 3 Data Types and Variables

Working with JavaScript

Control Structures. Important Semantic Difference

PLT Fall Shoo. Language Reference Manual

Ruby: Introduction, Basics

CISC 1600 Lecture 2.4 Introduction to JavaScript

GE U111 Engineering Problem Solving & Computation Lecture 6 February 2, 2004

AN OVERVIEW OF C, PART 3. CSE 130: Introduction to Programming in C Stony Brook University

XML. Jonathan Geisler. April 18, 2008

Node.js Training JavaScript. Richard richardrodger.com

Discussion 1H Notes (Week 3, April 14) TA: Brian Choi Section Webpage:

CONTENTS: What Is Programming? How a Computer Works Programming Languages Java Basics. COMP-202 Unit 1: Introduction

(Refer Slide Time: 01:40)

Ruby: Introduction, Basics

Javascript. Many examples from Kyle Simpson: Scope and Closures

Client vs Server Scripting

CIW 1D CIW JavaScript Specialist.

Javascript. UNIVERSITY OF MASSACHUSETTS AMHERST CMPSCI 120 Fall 2010

Chapter 3. More Flow of Control. Copyright 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley

Contents. Jairo Pava COMS W4115 June 28, 2013 LEARN: Language Reference Manual

Programming Basics and Practice GEDB029 Decision Making, Branching and Looping. Prof. Dr. Mannan Saeed Muhammad bit.ly/gedb029

PHP 5 Introduction. What You Should Already Know. What is PHP? What is a PHP File? What Can PHP Do? Why PHP?

Project 3 Web Security Part 1. Outline

Place User-Defined Functions in the HEAD Section

CS142 Winter 2017 Midterm Grading Solutions and Rubric

COMPUTER PROGRAMMING LOOPS

JavaScript: Introduction, Types

Reviewing all Topics this term

What is Java Script? Writing to The HTML Document. What Can JavaScript do? CMPT 165: Java Script

JavaScript. The Bad Parts. Patrick Behr

CSc Introduction to Computing

EXAMINATION INSTRUCTIONS

Simple Java Reference

Lecture 6. Assignments. Java Scanner. User Input 1/29/18. Reading: 2.12, 2.13, 3.1, 3.2, 3.3, 3.4

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

SPARK-PL: Introduction

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

Objectives. Introduce the core C# language features class Main types variables basic input and output operators arrays control constructs comments

Student, Perfect CS-081 Final Exam May 21, 2010 Student ID: 9999 Exam ID: 3122 Page 1 of 6 Instructions:

Human-Computer Interaction Design

Web Site Design and Development JavaScript

Boolean Expressions. Is Equal and Is Not Equal

Flow Control. CSC215 Lecture

COMP 2718: Shell Scripts: Part 1. By: Dr. Andrew Vardy

Boolean Expressions. Is Equal and Is Not Equal

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

PHP. Interactive Web Systems

Crayon (.cry) Language Reference Manual. Naman Agrawal (na2603) Vaidehi Dalmia (vd2302) Ganesh Ravichandran (gr2483) David Smart (ds3361)

JavaScript. History. Adding JavaScript to a page. CS144: Web Applications

Transcription:

First Name Last Name CSCi 90.3 March 23, 2010 Midterm Exam Instructions: For multiple choice questions, circle the letter of the one best choice unless the question explicitly states that it might have multiple correct answers. Put other answers in the spaces indicated. There is no penalty for guessing, so answer all questions. Unless otherwise indicated, all questions count equally. Note: my word processor sometimes skips question numbers. (Really!) 1. Which statement is correct? A. All JavaScript code for a web page is executed by the web server. B. All web pages must include JavaScript code in order to work. C. Users have no control over whether JavaScript code for a web page actually runs or not. D. Virtually all web browsers can run JavaScript programs. E. JavaScript and Java are the same thing. 2. What does the statement, console.log( hello ); do? A. It displays the word hello at the top of a web page. B. It creates a pop-up window that says hello. C. It displays the word hello on a JavaScript console, such as the Firebug console. D. It says that hello is a number. E. It says that hello is an object. 3. Tell what console.log( ); would display for each of the following values of A. typeof 123 B. typeof hello C. typeof { } D. typeof NaN E. typeof [ ] 4. What is the character + (plus) used for in JavaScript? Give as many answers as you can. 5. What is the character - (minus) used for in JavaScript? Give as many answers as you can. 6. What is the character. (period) used for in JavaScript? Give as many answers as you can.

7. If you see foo.bar in JavaScript (and nothing is wrong), what do you know about foo? Circle all correct answers: A. It is a function B. It is an array C. It is an object D. It is a property of the window object E. It is a string 8. If you see foo.bar in JavaScript (and nothing is wrong), what do you know about bar? Circle all correct answers: A. It is a function B. It might be a function C. It is not a function D. It is a property of foo E. It is a property of the window object 9. What is the value of hello + 5? A. hello+5, a function B. hello5, a string C. hello+5, a string D. 5, a number E. undefined, you cannot add a string and a number 10. What is the value of 1.22E2 + 1? A. 1.22E21 B. 1.22E3 C. 123 D. 1221 E. 1231 11. What is typeof foo before foo has ever been assigned a value? A. function B. array C. object D. number E. undefined 12. In an if statement, what goes inside the parentheses that follow the keyword, if? A. The statements to be executed repeatedly B. An expression that produces a value that is either true or false C. Curly braces D. Two semicolons E. An object 13. The else part of an if statement can be omitted.

14. JavaScript has two different kinds of for loop. 15. All JavaScript arrays are objects 16. All JavaScript objects are arrays 17. What property of a JavaScript array tells how many elements are in it? A. height B. width C. length D. breadth E. num_elements 18. Write a function named sumarray that receives on an array of numbers as an argument and returns the sum of all the numbers. This function does not have to determine whether the argument is actually an array and it does not have to test the elements of the array to see whether they are numbers or not. Answer Here: 19. Write a statement that passes an array with 5 numbers to the sumarray function defined in the previous question, and displays the value returned by the function by using console.log(). Answer here: 20. What is the significant difference between the following two statements: window.cs903 = function() { console.log( cs903 ); }; window.onload = function() { console.log( onload ); }; A. Nothing significant. They just display different messages when they are called. B. The first one displays two messages, but the second one displays three messages. C. The first one can be used only in this course, but the second one can be used anywhere. D. The first one will not work in Internet Explorer, but the second one will. E. The second one, but not the first one, will be called automatically when the DOM tree has been built.

21. What is the type of window.cs903 in the previous question? A. integer B. string C. function D. number E. object 22. Assume obj is an object; tell what the type of prop will be each time the body of the following loop is executed: for (var prop in obj) { } A. prop will always be a string. B. prop will always be a number. C. propʼs type will depend on the type of the property to which it refers. D. prop will always be an object. E. prop will always be an array. 23. What are a, b, and c in the following statement? var x = { a:1, b:2, c: hello }; A. They are objects inside the variable x. B. They are properties of the object x. C. They are elements of the array x. D. They are event handlers. E. They are numbers. 24. What is the relationship between an XHTML web page and the DOM? A. There is a DOM tree for every element of a web page. B. There is a DOM tree for every attribute of a web page. C. There is a DOM tree for every CSS rule used by a web page. D. The DOM tree for a web page contains a JavaScript object for each XHTML element in the body of the web page. E. Each Document in the Object Mode is the stylesheet of a web page. 25. Assume a JavaScript variable named foo is a paragraph element in the DOM. What JavaScript property of foo contains information about the CSS properties of the paragraph? A. foo.code B. foo.color C. foo.style D. foo.css E. foo.properties 26. What is displayed when the following assignment statement is executed: var foo = function(x) { console.log(typeof x); }; A. Nothing. This just defines the function; it does not execute it. B. number C. string D. It depends on what x is E. The sum of the elements in array x.

27. Given the statement in the previous question has just been executed, what does this statement display? foo([9, 8, 7, 6, 5, 4, 3, 2, 1]); A. Nothing. This just defines the function; it does not execute it. B. Blastoff! C. 45 D. array E. 9 28. What will be the value of xanadu[0] and xanadu[1] after the following two statements are executed? Answer in the space below. var xanadu = [ ]; xanadu[1] = 123;