CodeHS Unit 2 Flashcards
13 Questions
100 Views

CodeHS Unit 2 Flashcards

Created by
@UnparalleledEcoArt

Questions and Answers

What is the primary function of the Welcome Program?

  • To print the user's name. (correct)
  • To output current year.
  • To answer user questions.
  • To display ASCII art.
  • What does the ASCII Art program display?

  • A pattern
  • A cat
  • A dog
  • A shape (correct)
  • What integer value does the Variables program assign to currYear?

    2023

    What does the Answering Questions program ask the user?

    <p>All of the above</p> Signup and view all the answers

    In the Poetry program, what can the user do?

    <p>Write a poem</p> Signup and view all the answers

    What is calculated in the Area of a Rectangle program?

    <p>Area</p> Signup and view all the answers

    What must the user input in the Add Fractions program?

    <p>Numerators and denominators</p> Signup and view all the answers

    What happens to the double value in Casting to Int program?

    <p>It gets cast to an int</p> Signup and view all the answers

    What type of value does the Casting to Double program output?

    <p>A double</p> Signup and view all the answers

    In the Movie Ratings program, the movie rating is rounded to the nearest ___

    <p>int</p> Signup and view all the answers

    The Ice Cream program prints whether the user likes ice cream.

    <p>True</p> Signup and view all the answers

    What determines if someone can ride in the Roller Coaster program?

    <p>Tall enough and old enough</p> Signup and view all the answers

    In the Triple Double program, the user is asked for points, rebounds, and ___

    <p>assists</p> Signup and view all the answers

    Study Notes

    Welcome Program

    • Introduces a simple class Welcome that extends ConsoleProgram.
    • Outputs personal information using System.out.println().

    ASCII Art

    • Class Art illustrates basic ASCII art creation features.
    • Utilizes System.out.println() for visual text representation.

    Our First Integer

    • Variables class demonstrates integer usage with int currYear = 2023;.
    • Displays the current year in the console.

    Answering Questions

    • Variables class showcases multiple variable types: String, int, double, and boolean.
    • Outputs a best friend's name, a lucky number, room square footage, and ballet participation status.

    About You

    • Class AboutYou collects user input for favorite food, color, and movie through readLine().
    • Displays collected input on the console.

    Poetry

    • Class Poetry combines static text printing with user-generated content.
    • Prompts user to write a poem and then displays it.

    Area of a Rectangle

    • Area class prompts for rectangle dimensions using readDouble().
    • Calculates and displays the area of the rectangle in square units.

    Add Fractions

    • Class AddFractions helps compute the sum of two fractions.
    • Uses user input for numerators and denominators, calculates the sum, and formats the output.

    Casting to an Int

    • CastingToInt class demonstrates type casting from double to int.
    • Displays the integer value of a double with a truncation feature.

    Casting to a Double

    • Class CastingToDouble illustrates type casting from int to double.
    • Computes the quotient of two integers as a double for accurate division.

    Movie Ratings

    • Class MovieRatings takes a movie rating from the user.
    • Demonstrates rounding technique to the nearest integer after adding 0.5.

    Ice Cream

    • IceCream class gathers user preferences regarding ice cream with a boolean input.
    • Outputs user response directly to the console.

    Roller Coaster

    • Class RollerCoaster checks eligibility for riding based on height and age.
    • Combines boolean conditions to determine if the user can ride and outputs the result.

    Triple Double

    • Class TripleDouble collects user statistics: points, rebounds, and assists.
    • Intended to use boolean logic for further calculations, although incomplete.

    Studying That Suits You

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

    Quiz Team

    Description

    This quiz covers CodeHS Unit 2 flashcards, focusing on key programming concepts like the Welcome Program and ASCII Art. Each card includes code snippets for better understanding. Test your knowledge and understanding of these basic programming structures!

    More Quizzes Like This

    Use Quizgecko on...
    Browser
    Browser