CodeHs Unit 5 Flashcards
6 Questions
109 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 (A)

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 (A)</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

Flashcards

Function start() for dog ownership

A function that checks if a person owns a dog and prints the result.

Function start() for graduation

A function that determines if a student can graduate based on credits and graduation requirements.

Function start() for School days

A function to check if school is open today based on weekdays and holidays.

Checking for doubles in dice rolls

Determining if two dice show the same number (doubles).

Signup and view all the flashcards

Girl Scout Gold Status Conditions

Criteria for achieving Girl Scout gold status based on sales, badges, and volunteer hours.

Signup and view all the flashcards

Teenager Age Check

Identifying if an individual is considered a teenager based on age input.

Signup and view all the flashcards

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
JavaScript Functions and Comments Quiz
24 questions
Use Quizgecko on...
Browser
Browser