Sample CS 142 Midterm Examination

Similar documents
Sample CS 142 Midterm Examination

Sample CS 142 Midterm Examination

CS 142 Final Examination

CS142 Winter 2017 Midterm Grading Solutions and Rubric

Front End Programming

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

c122sep2914.notebook September 29, 2014

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

Best Practices Chapter 5

Financial. AngularJS. AngularJS. Download Full Version :

UI Course HTML: (Html, CSS, JavaScript, JQuery, Bootstrap, AngularJS) Introduction. The World Wide Web (WWW) and history of HTML

Financial. AngularJS. AngularJS.

AngularJS AN INTRODUCTION. Introduction to the AngularJS framework

As we design and build out our HTML pages, there are some basics that we may follow for each page, site, and application.

Chapter 1 Introduction to Dreamweaver CS3 1. About Dreamweaver CS3 Interface...4. Creating New Webpages...10

Building Web Applications

CS 140 Midterm Examination Winter Quarter, 2012

1. Setup a root folder for the website 2. Create a wireframe 3. Add content 4. Create hyperlinks between pages and to external websites

University of Washington, CSE 154 Homework Assignment 8: Baby Names

CSE 154: Web Programming Autumn 2018

welcome to BOILERCAMP HOW TO WEB DEV

Interactor Tree. Edith Law & Mike Terry

COMP 1130 Programming Fundamentals (Javascript Rocks)

How to set up a local root folder and site structure

a Very Short Introduction to AngularJS

University of Washington, CSE 190 M Homework Assignment 8: Baby Names

CS140 Operating Systems and Systems Programming Midterm Exam

BA. (Hons) Graphics Design

Positioning in CSS: There are 5 different ways we can set our position:

CUSTOMER PORTAL. Custom HTML splashpage Guide

AngularJS Introduction

[AVWSQ-ADWCS6]: WSQ ICDL Adobe Dreamweaver CS6

ver Wfl Adobe lif Sams Teach Yourself Betsy Bruce Robyn Ness SAMS 800 East 96th Street, Indianapolis, Indiana, USA WlM John Ray ^lg^

IN4MATX 133: User Interface Software

Varargs Training & Software Development Centre Private Limited, Module: HTML5, CSS3 & JavaScript

Santa Monica College. GRAPHIC DESIGN 65: Web Design I Course Syllabus

WEBSITE PROJECT 2 PURPOSE: INSTRUCTIONS: REQUIREMENTS:

Total Living Choices (TLC) Web Application Embedding and Implementation Manual

Overview of the Adobe Dreamweaver CS5 workspace

In-ADS User Guide. Estonian Land Board Versioon 1.9.1

Computing Science: National 5 and Higher skills, knowledge and understanding

COMP519 Web Programming Lecture 3: HTML (HTLM5 Elements: Part 1) Handouts

Advanced Dreamweaver CS6

COMS 359: Interactive Media

Macromedia - Fireworks TechNotes: How to create transparent Pop-up Menus

Objective % Select and utilize tools to design and develop websites.

Figure 1 Forms category in the Insert panel. You set up a form by inserting it and configuring options through the Properties panel.

jquery Tutorial for Beginners: Nothing But the Goods

How to lay out a web page with CSS

8/19/2018. Web Development & Design Foundations with HTML5. Learning Objectives (1 of 2) Learning Objectives (2 of 2) What is JavaScript?

Getting Started with CSS Sculptor 3

CSE 154: Web Programming Autumn 2018

Comprehensive AngularJS Programming (5 Days)

widgetjs Documentation

Web Application Development

How to lay out a web page with CSS

All Adobe Digital Design Vocabulary Absolute Div Tag Allows you to place any page element exactly where you want it Absolute Link Includes the

Flash Ads. Tracking Clicks with Flash Clicks using the ClickTAG

This course is designed for web developers that want to learn HTML5, CSS3, JavaScript and jquery.

CSC Web Programming. JavaScript Browser Objects

Introduction to using HTML to design webpages

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

JavaScript: Introduction to DOM and Attaching Handlers

CS142 - Web Applications

Programming in HTML5 with JavaScript and CSS3

AngularJS Intro Homework

CS140 Operating Systems and Systems Programming Midterm Exam

ANGULARJS INTERVIEW QUESTIONS

CSI 3140 WWW Structures, Techniques and Standards. Browsers and the DOM

PASS4TEST. IT Certification Guaranteed, The Easy Way! We offer free update service for one year

Introduction to WEB PROGRAMMING

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

Exam Questions Demo Microsoft. Exam Questions

5/19/2015. Objectives. JavaScript, Sixth Edition. Understanding Syntax Errors. Introduction to Debugging. Handling Run-Time Errors

Learning Adobe DreamWeaver CS4. Module 1 Contents. Chapter 1: Introduction to DreamWeaver CS4. Chapter 2: Entering Text and Graphics

San José State University Department of Computer Science CS-174, Server-side Web Programming, Section 2, Spring 2018

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

Introduction to Dreamweaver CS4:

AIM. 10 September

HTML HTML. Chris Seddon CRS Enterprises Ltd 1

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

Javascript. Many examples from Kyle Simpson: Scope and Closures

ANGULARJS - MOCK TEST ANGULARJS MOCK TEST II

COMPSCI 120 Fall 2017 Review Questions for Midterm #2 Professor William T. Verts

Learning Adobe DreamWeaver CC. Module 1 Contents. Chapter 1: Introduction to DreamWeaver CC

Hyper Text Markup Language

KillTest *KIJGT 3WCNKV[ $GVVGT 5GTXKEG Q&A NZZV ]]] QORRZKYZ IUS =K ULLKX LXKK [VJGZK YKX\OIK LUX UTK _KGX

How to lay out a web page with CSS

Creating Web Pages with SeaMonkey Composer

CodeValue. C ollege. Prerequisites: Basic knowledge of web development and especially JavaScript.

CIS 228 (Spring, 2012) Final, 5/17/12

3 Days Training Program

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

JavaScript CS 4640 Programming Languages for Web Applications

JAVASCRIPT - CREATING A TOC

Understanding Angular Directives By Jeffry Houser

Web Design 101. What is HTML? HTML Tags. Web Browsers. <!DOCTYPE html> <html> <body> <h1>my First Heading</h1> <p>my first paragraph.

PIC 40A. Lecture 4b: New elements in HTML5. Copyright 2011 Jukka Virtanen UCLA 1 04/09/14

COMS W3101: SCRIPTING LANGUAGES: JAVASCRIPT (FALL 2018)

Transact Qualified Front End Developer

Transcription:

Sample CS 142 Midterm Examination Winter Quarter 2016 You have 1.5 hours (90 minutes) for this examination; the number of points for each question indicates roughly how many minutes you should spend on that question. Make sure you print your name and sign the Honor Code below. During the examination you may consult two double sided pages of notes; all other sources of information, including laptops, cell phones, etc. are prohibited. I acknowledge and accept the Stanford University Honor Code. I have neither given nor received aid in answering the questions on this examination. (Signature) (Print your name, legibly!) (SUID stanford email account for grading database key) Problem #1 #2 #3 #4 #5 #6 #7 #8 #9 Total Score Max 16 18 8 10 9 8 8 7 6 90 1

Problem #1 (16 points) In class we described the structuring of web applications in model, view, and controllers. For each of the pieces of an web application implementation listed below, state which parts (model, view, or controller) would the piece be most associated with. Provide a brief justification for all your answers. A. CSS rules B. JavaScript code C. HTML D. Angular Directive E. Angular Service F. Database data G. DOM event handlers H. Animations 2

Problem #2 (18 total points) While submitting your class assignment at the last minute before the deadline you discover you have the view template and a screenshot of the view running but appear to have lost the Angular controller for the view. Your job is to create a controller that given the view template would plausibly generate what is seen in the screenshot. Write your answer on the following page. view template <divng controller="mycontroller"> <div> <label>name:</label> <inputtype="text"ng model="person.name"placeholder="entera name"> <h1>{{greeting}}{{person.name}}!</h1> <ol> <ling repeat="cinfavcolors"> <span>{{c.name}}'sfavoritecoloris{{c.color}}</span> </li> </ol> <buttonng if="buttonshow"ng click="buttonclicked()"> Button#1(hasbeenclicked{{buttonClicks}}times) </button> <png show="buttonclicks%2"> Button#1wasclickedanODDnumberoftimes </p> <png show="!(buttonclicks%2)"> Button#1wasclickedanEVENnumberoftimes </p> </div> </div> screenshot 3

Problem 2 continued Implement the controller for the view template on the previous page. (16 points) angular.module("cs142app",[]).controller("mycontroller",function($scope){ }); 4

Problem 2 continued (2 points) The view template in this problem uses both an ng if attribute on the button element and an ng show attribute on the odd/even message paragraph elements. Given the usage in the template and controller, do you agree with the use of ng show instead of ng if for the paragraph elements? Provide an argument as to why or why not. 5

Problem #3a (4 points) You direct a browser to a URL http://www.example.com/initial page/index.html which replies with a web page with the following links: <ahref="/starts/with/a/slash">linka</a> <ahref="no/starting/slash">linkb</a> Provide the full URL that would be navigated to when you click on each of the links: I. LinkA II. LinkB Problem #3b (4 points) What does the web server typically do with the fragment part of the URL? What does the browser do with it? 6

Problem #4a (5 points) Describe what is meant by a CSS breakpoint. Include a description of how breakpoints are implemented and give an example of how they are used. Problem #4b (5 points) The a tag in HTML in addition to the attribute href= supports an attribute named target=. Forexample a link to the Google search page could be written as: <atarget="_blank"href="http://www.google.com">google</a> The target="_blank " causes the browser to open a new window for the page being fetched by the link rather than the default (t arget="_self" ) which switches the current window to the link. Although traditionally links that open new windows were frowned upon for annoying users, single page applications tend to use them for all external links. Give a reason why this is the case. 7

Problem #5 (9 points) Consider the following fragments of HTML and JavaScript: HTML <divid="a">a <divid="b">b <divid="d">d</div> </div> <divid="c">c</div> </div> JavaScript functioncallback(event){ console.log(event.target.id+''+event.currenttarget.id) } document.getelementbyid('a').addeventlistener("click",callback,false); document.getelementbyid('b').addeventlistener("click",callback,false); document.getelementbyid('c').addeventlistener("click",callback,false); document.getelementbyid('d').addeventlistener("click",callback,false); I. What would be printed out if the user clicked on the letter 'D'? II. If the order of the calls to addeventlistener were reversed so we instead registered the listeners in the div id order of 'd', 'c', 'b', 'a', what would be printed out if the user clicked on the letter 'D'? III. If we change the JavaScript so that the third argument to each addeventlistener() call is true (i.e. register them as capture rather than bubble listeners) and keep the original order from Part I, what would be printed out if we clicked on the letter 'C'? 8

Problem #6 (8 points) Consider the following JavaScript: functionjeep(){ this.organization="daimlerchrysler"; } Jeep.prototype.color="blue"; varblue=newjeep(); console.log(blue.organization); //LineA console.log(blue.color); //LineB varred=newjeep(); red.color="red"; console.log(red.organization); //LineC console.log(red.color); //LineD Jeep.organization="Chrysler"; Jeep.prototype.color="green"; console.log(blue.organization); //LineE console.log(blue.color); // LineF console.log(red.organization); //LineG console.log(red.color); //Line H In the table below list what is printed at each console.log statement: console.log statement What is printed by the console.log Line A Line B Line C Line D Line E Line F Line G Line H 9

Problem #7 (8 points) I. What mechanism is most commonly used to tie the styling information in CSS files to the HTML elements they style? II. If your CSS doesn't set the width and height of an element, how is the width and height of that element determined? III. Explain the difference between a CSS position of fixed and absolute. IV. What is the difference between marking a element with the CSS "display:none;" and marking the element "visibility:hidden;"? 10

Problem #8 (7 points) I. Web applications are frequently constructed as a distributed system utilizing a multitiered architecture with three tiers List and provide a brief description of the three tiers. II. AngularJS contains a number of concepts including templates, controllers, scopes, directives, and services. For each of the following parts of a web application state which AngularJS concepts from the list above would be most relevant for the part's implement. Provide a brief justification with your answers. A. A JavaScript library for communicating with the web server to get data models. B. A help widget that is placed in the same spot on every view of the web application. The widget displays helpful information fetched from the web server. 11

Problem 9 (6 points) I. Some JavaScript coding standards require that var statements in functions are always placed at the start of the function, rather than close to where the declared variable is used (as is typically done in C and Java programs). Give a compelling reason for this recommendation. II. What does the following bit of JavaScript print out? vara=[1,2,,4,5]; console.log([a[4],a[2],a[5]]); III. What does the following bit of JavaScript print out? varx=1; (function(x){ console.log(x); x=3; })(2); console.log(x); 12