Assignments 1-3 Flashcards

1
Q

What is a mobile platform? Give two examples.

A

A mobile platform refers to the combination of hardware, software, as well as middleware.
Examples: Android, iOS.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What do we mean by mobile web? Is that a separate web from the World Wide Web (WWW)?

A

Mobile web is the way of accessing and interacting with the WWW using mobile devices, e.g, smartphones and tablets. It is not a separate web from the WWW. Instead, the term emphasizes accessing the same WWW through smaller screens and touch-based interfaces on mobile devices.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are some differences between developing web-based applications and services for mobile platforms versus desktop ones? Mention 5 items.

A

Developing for mobile platforms vs desktop:
1. Slower networks and higher latencies.
2. Slower hardware and less available memory.
3. Different browsing experience.
4. Different user contexts.
5. Different browser behavior (e.g., only the current tab is active and running effectively).
6. Mobile browsers’ heterogeneity.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is an emulator? How can it be useful for mobile web programming?

A

An emulator is a piece of software that translates compiled code from an original architecture to the platform where it is running. It allows running an OS and its native applications on another OS.

In the context of mobile web development, emulator is a desktop application that emulates a mobile platform (device hardware and OS). The mobile browser and OS are not aware of the emulator. Hence, the same code can be executed. Emulators allow the testing of web applications and performance analysis in a cost-effective and fast manner since you do not need to deploy the app on actual platforms.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is RESS? Discuss the two components in RESS focusing on improving mobile web development.

A

RESS stands for Responsive Web Design (RWD) and Server-Side Adaptation (RESS). It aims to provide the best of two worlds.

In this approach, our web application first decides on the server side about how to adapt to the client’s mobile platform (e.g., screen size). This is the server-side adaptation component.

Then it makes final adjustments on the client side. This is the client-side adaptation component to support RWD.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are the meta tag and viewport? How can you use those in your HTML file to design a mobile-optimized site? Write a sample markup.

A

For mobile friendly websites, check the meta tags, such as the viewport meta tag.
The browser’s viewport is the area of the window in which web content can be seen.

<head>
meta
name="viewport" content="width=device-width, initial-scale=1" />
</head>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What are the main sections of an HTML document body? Discuss those sections.

A
  • Header: The header should be as simple as possible, using an h1 title or a logo or company banner.
  • Main navigation: The main navigation should consist of no more than 5 main links, ordered by likelihood of use in a mobile context.
  • Content: Whatever you think is important and useful. Keep it concise.
  • Footer: The footer should include very brief copyright information, a home link, a back link, and
    optionally other related links (such as “go to top).
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

List the tags for creating a table in HTML.

A

<table> for the table
<tr> for the table’s rows
<td> for the data cells
<thead> for the table header
<tfoot> for the table footer
</tfoot></thead></td></tr></table>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How do you create a link to another web page in HTML? What is HTML fallback?

A

<a href=”http://www.example.com”>Example</a>

We should have a fallback mechanism for cases in which a client’s browser doesn’t support one of our (advanced) HTML tags, such as the progress tag. Browsers often ignore what they cannot understand or render.

<progress> 32%
<img></img>
Progress 32%
</progress>

If a browser supports the progress tag, it will ignore the child elements. However, if a browser does NOT support the progress tag, it will ignore the progress tag and only render the child elements

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Write a sample HTML document to
show how to use the HTML Viewport meta tag to support mobile and desktop browsers.

A

Sample HTML document:

<!DOCTYPE html>

<html>
<head>
<meta></meta>
<title>Sample HTML Document</title>
</head>
<body>
<h1>Sample Page</h1>
<p>This is a paragraph</p>
</body>
</html>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Which one should be avoided as much as possible, vertical or horizontal scrolling?

A

Horizontal scrolling should be avoided because it negatively impacts the User Experience

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Write a sample HTML document showing how to embed a video into your markup.

A

<!DOCTYPE html>

<html>
<head>
<title>Embedded Video</title>
</head>
<body>
<h1>Sample Embedded Video</h1>

<video>
<source></source>

Your browser does not support the video tag.
</video>
</body>
</html>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is the first option for including CSS to enable styling for an HTML document?

A
  1. Style attributes inside of tags:
    It should be avoided as far as possible since it is not an efficient and scalable way of managing
    your styling.
    Example:

<h1>This is a header</h1>

<p>This is a paragraph.</p>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is the second option for including CSS to enable styling for an HTML document?

A
  1. Style tags inside of the (X)HTML markup
    -Use if your website is a one-page HTML document or if your homepage is very different from your other pages.
    - Include CSS in the <style> HTML tag inside of the <head> part (not <body>).
    - Typically faster than having external CSS files.</style>

Example:

<style>

body {background-color: powderblue;}
h1 {color: blue;}
p {color: red;}
</style>
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is the third option for including CSS to enable styling for an HTML document?

A

3.External stylesheet files (.css): In almost all other cases besides what we discussed above, this is the best option. In this case, you should reference the stylesheet (i.e., .css file) in the head part of your HTML document.

Example:

<head>
<link></link>
</head>

Put the following in mystyle.css:
body {background-color: powderblue;}
h1 {color: blue;}
p {color: red;}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Explain the use cases for the HTML media attribute and media queries. Which one is typically preferred?

A
  1. The HTML media attribute is used for changing the design and layout of a website on different devices. This allows for more than one stylesheet for the same HTML document or one stylesheet with different definitions on different types of media.
  2. Media queries are also used for changing the design and layout of a website on different devices. This introduces conditions about different properties, such as screen size and orientation.
  3. Media queries are preferred as media attributes, specifically the
    media=”handheld” attribute, is deprecated on many modern devices.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

Why do we need HTML for mobile web development?

A
  • HTML (HyperText Markup Language) is the standard markup language for documents to be shown in a web browser. This way, we can specify the content that should be rendered by the web browser on the client’s side.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

Why do we need CSS for mobile web development?

A
  • CSS (Cascading Style Sheets) is the standard style sheet language for specifying the styling of HTML/XML pages.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

How does AJAX help in mobile development?

A
  • AJAX (Asynchronous JavaScript and XML), which currently often uses JSON instead of XML, is a set of client-set web technologies for asynchronous web pages and web applications. The asynchrony is achieved by decoupling the data interchange layer and the presentation later. Hence, reloading the entire page is unnecessary once something changes.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

What is MIME Type?

A
  • MIME (Multipurpose Internet Mail Extension) Type is a String sent by the server to inform the client’s browser about the format of the document. Examples include text/css, text/html, video/mp4, image/jpeg, etc.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

What is DOCTYPE?

A
  • DOCTYPE is the first line in the HTML file: <!DOCTYPE html> tag.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

What is boilerplate?

A
  • A Boilerplate is a template that contains sections of the code that will be (re)used in many places with little or no change.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

Make code to include an image as a background in a CSS file.

A

<style>

.body {
 background-image: url('img_girl.jpg');
}
</style>
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

Write a sample markup of using media queries.

A

@media screen and (max-width: 992px) {
body {
background-color: blue;
}
}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Q

What is XHTML?

A

Extensible HyperText Markup Language, extends versions of the widely used HyperText Markup Language

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
26
Q

What is the World Wide Web (WWW)?

A

A global information system that allows content sharing based on the Hypertext Transfer Protocol (HTTP)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
27
Q

What is the name of the standard for the JavaScript language?

A

ECMAScript standard by ECMA International.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
28
Q

Name other scripting languages that conform to this standard.

A

JScript (Microsoft), ActionScript (Adobe).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
29
Q

Name two JavaScript functions that can be used to show a Hello World message. Provide examples for using them. State one main difference between the two functions from the user’s perspective.

A

alert(‘Hello World’);
document.write(‘Hello World’);

alert() interrupts the user’s interaction with a modal dialogue box. document.write() injects the message on the same HTML page.

30
Q

Write a sample HTML document showing how to embed audio into your markup.

A

<!DOCTYPE html>

<html>
<head>
<title>Embedded Video</title>
</head>
<body>
<h1>Sample Embedded Audio</h1>
<audio>
<source></source>
Your browser does not support the audio tag.
</audio>
</body>
</html>

31
Q

Explain the defer and async keywords in JavaScript and HTML. Provide examples.

A

Defer: Defers the execution of the script until the whole document has been parsed.
Async: Defines that the execution should be done asynchronously without blocking other downloads.



32
Q

Describe two ways to include your JavaScript code in an HTML document.

A
  1. JS code inside the script tag

    // Code here
  2. Path to an external script in the scr attribute of the script tag:
    
    
33
Q

Name 3 open-source JavaScript libraries and frameworks. Also, one example of a mobile web friendly framework for JS.

A
  1. Node.js
  2. React.js
  3. Vue.js
  4. Zepto.js (mobile web friendly for JS)
34
Q

What is Node.js?

A

Allows backend development; used for server-side scripting; event-driven architecture; Cross-platform JS runtime environment.

35
Q

What is React.js?

A

Front-end JS library that helps build efficient, interactive UIs for web apps.

36
Q

What is Vue.js?

A

Written in TypeScript. Front-end development for single-page web applications.

37
Q

What is Zepto.js?

A

(mobile web friendly for JS): JS library with jQuery compatible API.

38
Q

What are the choices for the mobile strategy?

A
  1. Browser-based apps
  2. Full-screen web apps
  3. Native web apps
39
Q

What is progressive enhancement?

A
  • Only one set of code that works with all devices
  • Layers of compatibility
  • Allow every user to access the basic content and functionality
40
Q

What is regressive enhancement?

A

Starts by supporting high-end platforms and adds polyfills, libraries that fill gaps, to support older platforms.
Drawback: Not suitable to some mobile platforms due to the performance overhead.

41
Q

What is the Pareto principle?

A

80/20 principle.
- 80% of your desktop site will be useless to mobile users!
- Or perhaps 80% of your mobile website or web app users will need only 20% of your desktop version’s content.

42
Q

What are the typical vertical zones?

A
  1. Header
  2. Main navigation
  3. Content
  4. 2nd lvl navigation
  5. Footer
43
Q

What is the meta tag for content type and charset?

A

There is one for XHTML (no time to memorize)
One for HTML5 (meta optional):

<meta></meta>

44
Q

What are HTML forms and how are they useful?

A

Can help improve the user experience, ex, in writing text or other forms of input (checkbox, list), and then taking some action based on the input.
- Action (do something client side (JS) or server side (PHP, or Java Servlets))

45
Q

What is a POST request?

A
  • Opposite of GET
  • Used when sending data, such as a form or uploading a file
46
Q

What is a GET request?

A
  • Only used to request data
  • Can be cached
  • NEVER used when dealing with SENSITIVE data
  • Length restrictions
47
Q

Write HTML form example :)

A

<form>
<input></input>
<label>Accept terms and conditions</label>
</form>

48
Q

What is graceful degradation?

A

Develop for the latest technologies and browsers and their designs automatically work for the lesser functions available on older browsers.
- Drawback for mobile: performance and compatibility issues.

49
Q

What is a potential solution for having to develop for mobile devices? (1)

A

Device detection
- Should be avoided (complicated, maintainability issues).

50
Q

What is a potential solution for having to develop for mobile devices? (2)

A

Use internal HTML, CSS, and JS mechanisms to provide a fallback
- Should be done whenever possible.

51
Q

What is a potential solution for having to develop for mobile devices? (3)

A

Use a polyfill: Developer’s implementation of a feature that is not supported by a browser.
- Drawback for mobile: performance overhead (battery power): usually if it doesn’t support a feature, it is older with fewer resources.

52
Q

What are client-side feature and device detection?

A
  1. HTML fallbacks
  2. CSS fallbacks and conditionals
  3. JS fallbacks
  4. Platform detection
53
Q

Give an example of a CSS conditional

A

@supports (box-shadow: 2px silver){
#element {
box-shadow: 2px silver;
}
}

54
Q

Give an example of JS fallback

A

if (navigator.geolocation!=undefined){
// Geolocation is available
} else {
// Fallback
}

55
Q

Explain JS navigator object for platform detection

A
  • JS has a navigator object that represents the client browser on which the code is running
  • Properties:
    1. appName (the browser’s name)
    2. appVersion (the browser’s version)
    3. userAgent (a long string identifying the browser)
    4. plugin
    5. platform (the OS)
    6. userLanguage
56
Q

Give a JS Platform detection example

A

// Detects if it is an Android device
var isAndroid = navigator.platform.indexOf(“android”)>=0

57
Q

Explain server-side feature and device detection

A
  1. HTTP request, client sends request to server using its IP address.
  2. The request has a header and an optional body (GET, POST, PUT, DELETE)
    - Header has the field User-Agent
  3. Server responds with status code
58
Q

What is User-Agent?

A

The name of the browser or platform that originated the request.

59
Q

Give an example of using the <img></img> tag.

A

<img src=”banner.jpg” alt=”Our banner” width=”200” height=”80”>

60
Q

What is the canvas tag?

A
  1. A rectangular area on an HTML page
  2. By default, no border and no content
  3. Used to draw graphics on a web page
61
Q

Give an example of using the Canvas tag

A

<canvas></canvas>

62
Q

Give an example using the CSS element selector

A

p {
text-align: center;
color: red;
}

63
Q

Give an example using the CSS ID selector

A

para1 {

text-align: center;
color: red
}

<p> Hello! </p>

64
Q

Give an example using the CSS class selector

A

.class1 {
text-align: center;
color: red;
}

<p class=”class1” Helllloo! </p>

65
Q

Another media query example (stylesheet)

A

<link></link>

66
Q

Another media query example (inside stylesheet)

A

@media screen and (max-device-width: 480px){
body {
background-color: red;
}
}

67
Q

JS and battery power?

A
  1. JS consumes battery power
  2. Low battery is one of the biggest problems for every mobile user
  3. Unused JS consume for nothing
  4. Not providing a mobile-specific website and viewport means more power consumption
  5. KEEP JS CODE TO A MINIMUM
68
Q

Give an example of HTML form and JS (1)

A

<form id=“my_form” onsubmit=”return setAction(this)” method=“POST”>
<label>Age:</label><br></br>
<input></input><br></br>
<label>Favorite Color:</label><br></br>
<input></input><br></br><br></br>
<input></input>
<input></input>
</form>

69
Q

Give an example of HTML form and JS (2)

A

Put this in the head of index.html file:


function setAction(form){
document.getElementById("my_form").action = window.location.toString().slice(0,-1) +
":8080";
}
70
Q

Give an example of HTML form and JS (3)

A

Modify myfirst.js server-side script:
const http = require(‘http’);
const { parse } = require(‘querystring’);
const server = http.createServer((req, res) => {
if (req.method === ‘POST’) {
collectRequestData(req, result => { res.end(Are you a ${result.age} years old who likes ${result.fcolor}? I like you!);
});
}
});
server.listen(8080);

71
Q

Give an example of HTML form and JS (4)

A

function collectRequestData(request, callback) {
const FORM_URLENCODED = ‘application/x-www-form-urlencoded’;
if(request.headers[‘content-type’] === FORM_URLENCODED) {
let body = ‘’;
request.on(‘data’, chunk => { body += chunk.toString(); });
request.on(‘end’, () => { callback(parse(body)); });
}
else { callback(null); }
}