wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Quiz - JS Sequences - Conditionals structures

Total questions: 13

Worksheet time: 17mins

Name
Class
Date
1.

Which image presents the correct process to calculate an increment to an article after the price and the number are entered?

Attention: The options include some syntax errors.

a)

b)

c)

2.

A program is required to evaluate 2 conditions gender and civil status. Only single woman are invited to the attend party; otherwise you are not allowed to attend.

Choose the image that presents the "best solution" to the proposed situation.

Attention: "The options include some syntax errors".

a)

b)

c)

d)

3.

The correct code the accomplishes the next condition would be: "assign a name for a user and display it on an alert" (attention to syntax errors).

a)

b)

c)

d)

4.

Evaluate 2 conditions gender and civil status. If the user typed woman, evaluate if is single or married; else just show "you are a man".

Choose the option that presents the solution to this problem.

a)

b)

c)

5.

After checking the previous program, you are going to rewrite it correcting all the mistakes (you can add or remove content). Note: The program presents 4 mistakes.

4 lines
6.

Choose the option that solves correctly the next problem: "Write a program that asks the user for a three-digit number and shows the hundreds, tens, and ones. Use console method to display these answers." 

a)

b)

c)

7.

"An amusement park has established the cost of tickets per person is $3500. A family of 8 people will visit the park, realizing that a 3% discount will be applied on the total price to pay by the tickets. You must create a program that shows the discount amount applied over the total tickets and the total value the family will pay for the tickets after the discount is applied". 

You are going to complete the part 2 doing the necessary calculations to display the asked information in alert methods (use only the presented variables)

4 lines
8.

Observe the previous program; then, considering the next condition which option will be displayed on the screen when you run the program?

Note: the color that the user typed was "blue"

Note: "pay attention to the operator used in the program"

a)

"both conditions are displayed"

b)

"this is not the correct color, try again!"

c)

"congratulations, you guessed the correct color"

9.

Consider the next problem: "In Colombia a person can retire if some conditions are accomplished: women when they are 57 or more - men when they are 62 or more. Choose the program that solves correctly the problem.

a)

b)

c)

10.

Maria is planning her day, but she’s not sure whether to go outside or stay home. She opens your weather assistant app. The app should ask her what the weather is like and respond with a useful message.

  • If the weather is sunny or partly cloudy, the app should respond:
    "Nice weather to go outside!"

  • If the weather is rainy or stormy, the app should respond:
    "Better stay inside or take an umbrella."

  • If the weather is both snowy and windy, the app should respond:
    "snowy and windy" or something similar.

  • If the input doesn’t match any known weather type, respond:
    "Weather type not recognized."

a)

b)

c)

11.

Observe attentively the previous problem, you are going to rewrite it all correcting the 9 different mistakes that it includes.

Note: you can start with let option, don´t include comments.

4 lines
12.

In a social app, users want to know the age gap between them. 
Ask two users for their ages. Then: 

  • Show "There is a big age gap." if the difference is more than 10 years. 

  • Show "The age gap is acceptable." if 10 or fewer years. 
    Then check if the difference is even or odd, and show "The difference is even" or "The difference is odd". 

  • Choose the program that displays the correct solution

a)

b)

c)

13.

Analyze the next problem, then complete the output displaying in a single line the answer that you consider must be displayed (use the given variables). Use a document.write ( ) method-

Note: "the syntax will be essential to display the information correctly".

4 lines