CodeHs Unit 5 Flashcards
6 Questions
102 Views

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to lesson

Podcast

Play an AI-generated podcast conversation about this lesson

Questions and Answers

In the function start(), does the variable hasDog represent if the user has a dog?

  • No
  • Not Sure
  • Yes (correct)
  • Maybe
  • In the function start(), what does the variable canGraduate depend on?

  • Having enough course credits
  • Meeting all graduation requirements
  • Both A and B (correct)
  • None of the above
  • The variable noSchool is determined by whether it's a holiday or not a weekday.

    True

    What are the two inputs collected in the Rolling Dice function?

    <p>First die and second die</p> Signup and view all the answers

    What is one of the conditions for achieving gold status in Girl Scout Designation?

    <p>Selling at least 50 boxes</p> Signup and view all the answers

    What age defines a teenager according to the provided code?

    <p>13 or older</p> Signup and view all the answers

    Study Notes

    Programming Functions

    • 5.1.4 Do You Have A Dog?

      • Defines a function start() that checks if a person has a dog.
      • Initializes a variable hasDog set to false.
      • Prints the message with the dog's status.
    • 5.2.6 Can You Graduate?

      • Defines a function start() to determine if a student can graduate.
      • Reads two boolean inputs: hasCredits for course credits, and gradutionRequirements for meeting graduation criteria.
      • Calculates canGraduate using logical AND (&&) to combine both conditions.
      • Outputs the ability to graduate based on credits and requirements.
    • 5.2.7 School's Out

      • Defines a function start() that checks if there is school today.
      • Reads boolean inputs: weekDay and holiDay.
      • The variable noSchool is true if it's a holiday or not a weekday, using logical OR (||).
      • Prints whether there is school today based on the conditions.

    Game and Condition Checks

    • 5.3.5 Rolling Dice

      • The function start() prompts for values of two dice.
      • Uses readInt to capture the value of dieOne and dieTwo.
      • Checks if both dice show the same number to determine if doubles were rolled.
      • Outputs the result indicating if doubles were rolled.
    • 5.3.6 Girl Scout Designation

      • The function start() assesses eligibility for Girl Scout gold status.
      • Inputs for the number of boxes sold, badges earned, and volunteer hours are captured with readInt.
      • Conditions check whether the number of boxes (≥ 50), badges (≥ 10), and volunteer hours (≥ 25) meet gold status requirements.
      • Also, grants gold status if boxes sold are 100 or more.
      • Outputs whether the person has gold status based on conditions evaluated.

    Age Verification

    • 5.4.7 Teenagers
      • The function start() checks if a person is classified as a teenager based on age.
      • It reads an integer to gather the person's age from user input.
      • Further logic appears intended but not fully detailed in the note.

    Studying That Suits You

    Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

    Quiz Team

    Description

    Test your knowledge with these flashcards from CodeHs Unit 5. Each card features key concepts related to programming functions, such as checking if you have a dog or meeting graduation requirements. Perfect for mastering the basics of coding.

    More Like This

    Functions in Programming
    16 questions
    Overview of Functions in JavaScript
    10 questions
    JavaScript Functions and Strict Mode
    20 questions
    5. JavaScript Functions
    37 questions

    5. JavaScript Functions

    MagnanimousCloisonnism avatar
    MagnanimousCloisonnism
    Use Quizgecko on...
    Browser
    Browser