Web Applications and Flask programming Flashcards

1
Q

Define a native application.

A

A native application is an application software that is developed for use on a particular platform or device

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

State 3 advantages of using native applications over web applications.

A
  1. Native applications are usually more efficient than web applications because native applications are customised for a specific platform
  2. Native applications tend to have more direct access to device features, such as the camera, GPS and accelerometer, as compared to web applications
  3. Native applications can function without Internet access, unlike web applications
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

State 3 disadvantages of using native applications over web applications

A
  1. More costly to develop native applications as every platform and operating system requires a different version of the native application, unlike web applications, which can run on any device that can run a web browser
  2. Native applications require users to install updates, either manually or automatically, which creates more hassle as compared to web applications, which do not require its users to install updates
  3. Users have to download and install native applications in order to use them, creating more hassle as compared to web applications, which do not require any download or installation to be used
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Define a web application.

A

A web application is an application software that runs on a web server and is accessed by a web browser

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

State 3 advantages of using web applications over native applications. (5 in total)

A
  1. Web applications are more platform independent than native applications because web applications can run on any platform that can run a web browser, unlike native applications, which require a specific version of the native application to be developed for each platform
  2. It is easier to maintain a web application with a single code base as compared to a native application with multiple code bases for different versions for different platforms
  3. Users do not need to install updates to use web applications because the updating is done on the server-side, unlike native applications, which require users to install updates
  4. Users do not need to download and install web applications to use them, unlike native applications, which require users to download and install them
  5. Web applications are more easily shared as compared to native applications as users only need to share a URL in order to share a web application, while users have to share the program files of a native application in order to share it
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

State 3 disadvantages of using web applications over native applications. (4 in total)

A
  1. Web applications usually have less access to device features, such as the camera, GPS and accelerometer, as compared to native applications
  2. Web applications may not function in the same way across different browsers or even different versions of the same browser
  3. Web applications require Internet access in order to be used, unlike native applications
  4. Web applications may have a less ideal user experience as compared to native applications because web applications are not customised for any specific platform, while native applications are more user friendly as they are customised for specific platforms and OS.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What are the roles of HTML and CSS in creating a web application?

A

HTML is used to structure the content and give it semantic meaning

CSS is responsible for the design, styling, and layout of the content

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

How is the GET method and POST method different in sending data? (2 differences)

A
  1. Sending data using the GET method appends the data being sent to the URL, making it less secure while sending data using the POST method does not cause the data being sent to appear in the URL, making it more secure
  2. Flask defaults to using the GET method while in order to use the POST method, it must be specified in both the HTML form attribute and the Python function
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is the role of Flask in creating a web application?

A

Python operates in the background to process user requests and return a response.

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

When should GET method be used when sending data?

A

When data is collected in the form of a non-sensitive input

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

When should POST method be used when sending data?

A

Mostly used in sending forms, especially when handling file uploads, or sensitive data.

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

What are the 10 usability principles?

A
  1. Visibility of System Status
  2. Match between System and Real World
  3. User Control and Freedom
  4. Consistency and Standards
  5. Error Prevention
  6. Recognition rather than recall
  7. Flexibility and Efficiency of use
  8. Aesthetic and Minimalist Design
  9. Help users recognise, diagnose, and recover from errors
  10. Help and Documentation
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is User Control and Freedom? What is an example of it?

A

User have the freedom to navigate and perform actions, including undoing accidental actions.

For example, support undo, redo, and cancel (to exit from the current interaction)

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

What is Flexibility and Efficiency of Use? What is an example of it?

A

Able to transform itself to suit multiple users, allowing people to pick whatever way that works for them.

Example: Shortcut buttons, personalisation and customisation. May transform itself for novice and advanced users eg. advanced settings.

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

What are the tags that must be present in an HTML document?

A

html
head
title
body

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

What is the minimal code for a Flask app?

A

from flask import Flask, render_template, request

app = Flask(__name__)

@app.route(…)
def function1():
# retrieve any required request data from request obj
# jinja template files must be in ‘templates’ folder
return render_template(‘index.html’) # replace with appropriate template name

app.run() # by default, runs on 127.0.0.1:5000

17
Q

The following HTML snippet is used in index.html to capture user input and send it to the ‘/’ route with a GET request:

input type=”text” name=”search”

What is the Python code used to retrieve the data in the route function?

A

remember to import request first


data = request.args[‘search’]

18
Q

The following HTML snippet is used in index.html to capture user input and send it to the ‘/’ route with a POST request:

input type=”text” name=”search”

What is the Python code used to retrieve the data in the route function?

A

remember to import request first


value = request.form[‘search’]

19
Q

The following Python code is used to retrieve data from user input sent to the route ‘/profile’:

@app.route(‘/profile’, methods=[“POST”])
def search():
value = request.form[‘address’]

return render_template(‘profile.html’, data=value)

Write the HTML needed to implement this form.

A

Brainscape does not support HTML, so the angled tag brackets are omitted here

# note that the value attribute of the element determines the label shown on the submit button

form action=’/profile’ method=’post’
input type=’text’ name=’address’
input type=’submit’ value=’Submit’
/form

20
Q

The following Python code is used to retrieve data from user input sent to the route ‘/search’:

@app.route(‘/search’, methods=[“GET”])
def search():
value = request.args[‘query’]

return render_template(‘search.html’, data=value)

Write the HTML needed to implement this form.

A

Brainscape does not support HTML, so the angled tag brackets are omitted here

# note that the value attribute of the element determines the label shown on the submit button

form action=’/search’ method=’get’
input type=’text’ name=’query’
input type=’submit’ value=’Submit’
/form

21
Q

Write HTML for a page asking for user input

A

Brainscape does not support HTML, so the angled tag brackets are omitted here

# note that the value attribute of the element determines the label shown on the submit button

html
head
title
/title
/head
body
form action=’/destination’ method=’get’
label
/label
input type=’text’ name=’name’
input type=’submit’ value=’Submit’
/form
/body
/html

22
Q

Write HTML for a form with a single text input field and a submit button

A

Brainscape does not support HTML, so the angled tag brackets are omitted here

# note that the value attribute of the element determines the label shown on the submit button

form action=’/destination’ method=’get’
label
/label
input type=’text’ name=’name’
input type=’submit’ value=’Submit’
/form