logo

Crowdly

UCB - MCD4540 Engineering Smart Systems - Trimester 1 - 2025

Шукаєте відповіді та рішення тестів для UCB - MCD4540 Engineering Smart Systems - Trimester 1 - 2025? Перегляньте нашу велику колекцію перевірених відповідей для UCB - MCD4540 Engineering Smart Systems - Trimester 1 - 2025 в lms.monashcollege.edu.au.

Отримайте миттєвий доступ до точних відповідей та детальних пояснень для питань вашого курсу. Наша платформа, створена спільнотою, допомагає студентам досягати успіху!

In this unit you have been introduced to flowcharts. Select all flowchart shapes that are used in the unit which have correct descriptions attached.

100%
0%
0%
0%
0%
0%
100%
100%
100%
0%
100%
100%
Переглянути це питання

Which of the following code fragments correctly implement the following algorithm?

  1. Generate a random number as a secret number
  2. Ask the user to guess the number
  3. Convert the guess to an integer
  4. Compare the guess to the secret

    1. If match

      1. print "Congratulations"
    2. If not a match

      1. go to step 2
0%
0%
100%
0%
Переглянути це питання

Select all code fragments that correctly implement the pseudocode below.

  1. Obtain user input as val
  2. Check if val is "quit"

    1. If so, quit.
    2. If not, continue
  3. Convert val to a float

    1. If fail, quit
  4. Check if val is a positive number and less than 1000

    1. If so, print "success"
    2. If not, quit
100%
100%
0%
0%
Переглянути це питання

What is the result printed by the code shown

a = 9.1

b = 5

Переглянути це питання

Finally, you should write appropriate file header documentation for the program (in previous parts).

You will need to modify your work as follows:

  • Add a parameter to the function which replaces the input variable from Part A
  • This parameter will contain / accept a list of values which meets the input requirements from the previous parts
  • You should assume that no invalid values are passed to this parameter and thus do not need to write additional validation for the parameter
  • Your program should process the values provided in the list of values via the parameter, instead of using inputs from the user

Finally, write some test code that will execute only if the file is run directly (i.e. test code won't run when imported as a module), to demonstrate that the function does not crash and works correctly when provided values via its parameter.

Переглянути це питання

Next, write some code to make the program you've written (in previous parts) into a function.

The function should be named generate_sequence.

The function should not accept any parameters (user input read inside the function instead). 

You should modify the code you wrote in part D to return a dictionary with appropriately named keys containing the information required upon program end (return should take place after the summary is printed).

You should write appropriate function header documentation for the function.

Переглянути це питання

Next, write some code (adding onto the previous part) that meets the following requirements:

  • When the program ends, it should print out a nicely formatted summary of the following information (listed below).
    • number of invalid user inputs  
    • list of all sequences generated (one list per line)

Переглянути це питання

Next, write some code (adding onto the previous part) that validates the input value provided by the user to the following requirements:

  • The user input should should be non-negative (positive), less than 500 and has no more than 3 decimal places.
  • If the input does not meet the requirements above, you should  print the message 'You must provide a valid input' and ask the user for a new input
Note: to check if a given value has no more than n decimal places, you can check if the given value is equal to the same value rounded to n decimal places. 

Переглянути це питання

Next, write some code (adding onto the previous part) that validates the input value provided by the user to the following requirements:

  • The user input should contain an integer value.
  • If the input isn't an integer value, you should print the message  'The value provided is invalid, try again' and ask the user for a new input

Переглянути це питання

Write some code meeting the requirements below (not in a function). You should assume the user will only provide valid input in this part.

  • The program should ask the user for a numeric input which should be saved to a variable named stop.
  • For now, you should cast the user input to an integer
  • Then, generate a sequence of values using the algorithm below:
    1. Generate a list of numbers, that are multiples of both 5 and 7, between 1 and stop.
    2. The last value in the list should be less than or equal to stop.
  • Then, the program should print this sequence of values out as a list of numbers
  • The program should then print an empty line and restart.
  • The program only ends if the user hits CTRL+C.

Переглянути це питання

Хочете миттєвий доступ до всіх перевірених відповідей на lms.monashcollege.edu.au?

Отримайте необмежений доступ до відповідей на екзаменаційні питання - встановіть розширення Crowdly зараз!