0% found this document useful (0 votes)
118 views12 pages

Habilidad vs Agilidad en Quiz App

This document provides instructions for Assignment 1, which involves creating a customizable one-page quiz app. It describes the required functionality, appearance, and behavior of the quiz, including: - Displaying questions and answer choices - Selecting and submitting answers - Reviewing answers and scores after submission - Restarting the quiz Students are asked to implement this quiz app by modifying the HTML, CSS, and JavaScript code provided in a starter pack to handle the user interface and interactive behavior as outlined. The app needs to make API calls to retrieve and submit quiz data. It also needs a responsive design that adapts to mobile screens.

Uploaded by

Vinh VP
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
118 views12 pages

Habilidad vs Agilidad en Quiz App

This document provides instructions for Assignment 1, which involves creating a customizable one-page quiz app. It describes the required functionality, appearance, and behavior of the quiz, including: - Displaying questions and answer choices - Selecting and submitting answers - Reviewing answers and scores after submission - Restarting the quiz Students are asked to implement this quiz app by modifying the HTML, CSS, and JavaScript code provided in a starter pack to handle the user interface and interactive behavior as outlined. The app needs to make API calls to retrieve and submit quiz data. It also needs a responsive design that adapts to mobile screens.

Uploaded by

Vinh VP
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

WPR – Fall 2021

Assignment 1: Quiz App


IMPORTANT: This assignment must be done individually.

Read Section A to understand the programming requirements, Section B to understand the


programming tasks that you need to carry out and Section C to know what you need to submit as
the result.

A. Description
In this assignment, you will create a customizable one-page “Quiz App”

1. Overall appearance and behavior


The following video shows the look and behavior of the quiz we are asking you to implement.

[Link]

One detail that is hard to see in the video:

• To select the answer, we can click the radio box, text or anywhere into the option
• After the quiz is completed (i.e. review mode - after submitting your answers), it should
not be possible to change your answer anymore.

1|P a g e
Section measurements

2|P a g e
Font faces, size, and colors:
Common
• The font face is 'Proxima Nova', and the fallback fonts are, in order, 'Helvetica',

'Arial',sans-serif.

• The font size is 18px.


• The font color is #222222
Header

• It has a #ccc border in the bottom that is 1px thick.


Course name
• The font face is 'Helvetica' and the fallback font is sans-serif.

• The font size is 32px.


• The font weight is bold.
• The font color is #ee3322.
MERN Stack (Yellow circles)
• The background color is #ffee00

• They have rounded corners with radius 100%.


• The font weight is bold.
• The text is vertical and center aligned to the circle.
• They are rotated 30 degrees to the left. Hint: see css properties transform w3schools
Quiz name

• The back ground color is semi-transparent, which is rgba(255, 255, 255, 0.9)
• The font face is 'Pangolin', and the fallback fonts are 'Trebuchet MS', cursive
• The font size is 60px
• The font color is black

3|P a g e
• Space between the border and the content of the element is 10px.
• The quiz name is vertical and center aligned to the quiz image.
Author

• The font size is 14px


• The author is center aligned to the page
• Note: You have to replace “Cong Nguyen” by your name as the author of your
assignment.

Images
• Quiz image
o Quiz name has a background image (images/[Link]).
o Its height is 425px.
o The background size is set to cover
o The background position is anchored in the middle

Buttons

• The font color is white


• Blue buttons:
o The background color is #2196F3
o When users move the mouse over, the background color is #0d8bf2
• Green buttons:
o The background color is #4CAF50
o When users move the mouse over, the background color is #46a049

2. Choice list
You need to finish styling the question and answers.

Choice list

4|P a g e
• There is 1px between each answer

Choice: un-selected

• Space between radio & text is 15px


• The background color is #f1f1f1
• When users move the mouse over, the background color is #ddd

Choice: selected

• When users selected the answer, the background color is #ddd

5|P a g e
Choice: review after complete the quiz

• The radio boxes are disabled


• Correct answer has background #d4edda
• Wrong answer has background #f8d7da
• The label: Correct answer/ Your answer
o The position is at the far end of answer
([Link] may be helpful)
o The background color is semi-transparent rgba(0,0,0, 0.2)

6|P a g e
3. Boxes & Result view

• The background color is #f1f1f1


• It has a solid border with #dcdcdc color of that is 1px thick
• The font size of the score (number of corrected answers - 1/10) is 24px

4. Mobile layout
You need to also modify the CSS and HTML if necessary to implement support a mobile view.
The video below shows an example of how it should look and behave:

[Link]

• If the page is viewed on mobile:


o The viewport should be set to zoom-level 100%, and the width should be the
device width
• If the device screen size is less than 700px wide:
o The width of the page content should be 95% instead of 700px
• If the device screen size is less than 500px wide:
o The yellow circles in the page header should not appear

5. Quiz behavior

This is a 10-question one-page quiz app. Write the code necessary to implement the quiz
behavior as detailed below.

7|P a g e
Even though you will mostly be writing JavaScript for this part, you may need to also update the
HTML or CSS in order to implement the behavior as described.

The app has 3 screens (modes), including (1) read some information about the quiz → start quiz
→ (2) answer quiz questions → submit your answers → (3) review your answer

Screen 1: Introduction
This is the 1st screen shown to the users with some information before starting the quiz.

Starting the quiz


When the users click “Start the X quiz”, the webpage need to:

• Calling the provided API to get the attempt ID & an array of questions

POST: [Link]

o Request data: none


o JSON Response: status (201) + the new attempt (contains attempt ID & an
array of questions)

• Displaying received questions on the Screen 2: Attempt quiz

Screen 2: Attempt quiz


This is the 2nd screen shown to the users with questions & their answers to select.

• You should also make the page scroll to the top of the page.
o You can call [Link](); to do this. See mdn for more details.

Clicking an answer
When the users click an answer choice (radio box, text or anywhere into the option), the answer
choices should update in the following way:

• For the selected item:


o The radio box should change from unchecked to checked
o Background color is #ddd

8|P a g e
Changing an answer
If the user has not completed the quiz (i.e. not click submit yet), they should be able to change
their answer to a question by clicking a different answer.

After the user has submitted the answers, the answer choices should lock and it should no longer
be possible to change an answer, until the user clicks “Try again” or refreshes the page.

Submitting your answers


When user click “Submit your answers”, the webpage need to:

• Confirming if user really want to finish attempt or not, if yes


• Calling the Submit API to send user selected answers & received back the score

POST: [Link]

o Request data:

▪ Route param: id of the attempt


▪ JSON body: an object of user selected answers {questionID:
userSelectedAnswerIndex}

e.g. {5f61d4ec7c0f0531a4cedf41: 0, …}
// user selected the first answer (index = 0) of question with id
5f61d4ec7c0f0531a4cedf41

o JSON Response:

▪ status (200) + the attempt (contains questions, user selected


answers, correct answers of the same format, score e.g. 9/10,
scoreText e.g. Perfect!!)

• Displaying received questions, user selected answers, correct answers & the score on the
Screen 3: Review quiz

NOTE: received questions - not the dumpy text as in the demo screenshot

Screen 3: Review quiz


This is the 3rd screen shown to the users with the score + feedback text (scoreText) & also
reviewing the selected answer with the correct one.

• The page should remain in this “completed” state until the user refreshes the page or
clicks “Try again”.

9|P a g e
Restarting quiz
When user click “Try again”, the webpage need to show back the Screen 1: Introduction

• You should also make the page scroll to the top of the page.
o You can call [Link](); to do this. See mdn for more details.

B. Task requirements
1. Download the starter_pack for folder structure suggested to you. We expect you will have
to make modifications to the following files to complete the assignment:

• [Link]: Write your HTML here (<head> section has been partially completed for
you)
• [Link]: Write your CSS here (pay attention about the mobile layout)
• [Link]: Write your JavaScript here.
o This is the file in which we expect you to implement the quiz behavior.
o You should define and attach event listeners in this file.

2. HTML: Copy and paste the text of [Link] into your [Link] file, then add the
HTML tags necessary to style the page. Later you will likely need to make some
modifications for the mobile layout and the JavaScript.

Note: create all 3 screens before hiding them using JavaScript

3. CSS: in the [Link] file,

• Add appropriate CSS to style your page as described in section A.2


• Add appropriate viewport & CSS media queries to support the mobile view. (see section
A.4)

Note: style all 3 screens before hiding them using JavaScript

4. JavaScript: in the [Link] file, to accomplish quiz behavior as described in section A.5

• Screen 1: Introduction
o Handle user action: starting the quiz & displaying questions on Screen 2
• Screen 2: Attempt quiz
o Handle user action: selecting an answer

10 | P a g e
o Handle user action: changing an answer
o Handle user action: submitting your answers & display result, review questions on
Screen 3
• Screen 3: Review quiz
o Handle user action: restart the quiz

5. Weekly plan:

You have to schedule yourself a weekly plan to complete your tasks, an example is given
below.

Week HTML CSS JS


- header
- quiz title, author
1 - screen 1: introduction
- screen 2: attempt quiz
+ Question name & option
- screen 3: review quiz
+ Your answer/ Correct answer
+ Correct or Wrong
2
+ result view
- mobile layout
- hide screen 2, 3
- handle user click buttons
to show/ hide (navigate
3 between) screens
- handle user click an
answer / change answer
- handle user click: start
the quiz (call api →
populate questions &
4
show screen 2)

- handle user click: submit


the quiz (call api →
populate review questions

11 | P a g e
& show screen 3)
- restart the quiz
- test your application (mobile layout, correct result corresponding to clicked items,
restart quiz)

C. Submission
You must submit a single zip file containing the application to the portal by the due date. The zip
file name must be of the form a1_Sid.zip, where Sid is your student identifier (the remaining
bits of the file name must not be changed!). For example, if your student id is 1801040001 then
your zip file must be named a1_1801040001.zip.
IMPORTANT: failure to name the file as shown will result in no marks being given!

NO PLAGIARISM: if plagiarism is detected, 0 mark will be given!

12 | P a g e

Common questions

Powered by AI

The main steps involved in creating the customizable 'Quiz App' include understanding the overall appearance and behavior requirements, implementing the necessary HTML, CSS, and JavaScript, and ensuring responsiveness for mobile views . The development involves three main screens: the introduction, the attempt quiz, and the review quiz screen . HTML formatting, CSS styling including font, color, and layout for desktop and mobile, and JavaScript for functionality like event listeners, API calls, and handling user actions, are crucial to the app .

Considerations for preparing CSS include ensuring consistent typography using specified fonts and sizes, adjusting button styles and colors for distinct states (hover, active), and setting responsive layouts with media queries. For desktop, this involves fixed widths for layout blocks, whereas for mobile, it involves adaptive widths and hiding non-critical UI elements like decorative circles when the screen size is too small . Additionally, ensuring the alignment and spacing are adequate for touch interfaces is critical for a seamless mobile user experience .

The mobile layout should be handled by adjusting the CSS and HTML to ensure the page fits different screen sizes. This includes setting the viewport to a zoom level of 100%, and making the page content width adaptive based on device width, such as 95% width if the screen size is less than 700px . On smaller screens, unnecessary elements like the yellow circles should be hidden to save space and improve usability . Moreover, media queries should be used in CSS to ensure appropriate styling for different device sizes .

The quiz app ensures selected answers are accurate by locking them upon submission and using API communication to validate choices against correct answers . Feedback is given by comparing user-selected answers with correct ones and displaying the results and comments like scoreText, e.g., 'Perfect!!' or a score out of 10 . Additionally, the UI updates to highlight correct/incorrect selections based on background color changes, enhancing user understanding of their performance .

Handling user interactions requires the implementation of event listeners and the appropriate JavaScript code to manage the quiz lifecycle. When starting the quiz, an API is called to fetch questions and display them on the screen . During the attempt phase, users select and change their answers dynamically through event handling mechanisms . Finally, when reviewing the quiz, the application processes the submitted answers, compares them with the correct answers, and displays feedback, achieved by calling the submission API and updating the DOM based on the response .

Styling quiz elements with specific colors and hover effects is significant for improving usability and accessibility. Colors help to visually distinguish states (e.g., hover, active), guide user actions, and enhance the overall aesthetic appeal, making the interface both intuitive and engaging . Hover effects provide immediate visual feedback, which is essential for interactive elements like buttons, enhancing the user's experience by making the interface feel responsive and dynamic .

During the review process, the quiz app provides feedback by differentiating correct and incorrect answers via background color changes. Correct answers highlight in green, while incorrect ones show in red, providing visual confirmation of performance . Labels indicating 'Correct answer' or 'Your answer' are positioned to accompany the respective choices for precise feedback, enhancing the user's learning experience by clearly displaying which answers were right or wrong .

Disabling the ability to change answers after quiz completion ensures the integrity of the quiz results, preventing any alterations post-submission which could lead to inaccuracies or unfair advantages. It also solidifies the quiz state for review purposes, allowing users to look back on their submissions and learn from their mistakes without being able to retroactively alter their responses, which helps in maintaining a fair assessment standard .

JavaScript should manage user navigation by switching between the introduction, attempt, and review screens based on user actions . This involves showing the introduction screen initially, then displaying the questions screen upon start, and locking interactions after submission, leading to the review screen displaying the results and correct answers . Functions should handle clicks on 'Start', 'Submit', and 'Try Again' buttons, with appropriate API calls and UI updates to reflect the current state of the quiz accurately .

The assignment ensures plagiarism prevention by requiring individual completion and specifying a unique submission format that includes the student's identifier in the file name. Any detection of plagiarism results in a zero mark, clearly dissuading students from copying each other's work . This setup encourages originality and ensures the student's engagement with the material to maintain academic integrity .

You might also like