100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
Khan Academy Programming exam 2022/2023 with 100% correct answers $11.49   Add to cart

Exam (elaborations)

Khan Academy Programming exam 2022/2023 with 100% correct answers

 35 views  0 purchase
  • Course
  • Institution

Joo-won is writing code to calculate the volume of a cone based on this formula: Volume=(Pi(r)^2)(h/3) He's testing his code on this cone: The code starts with these variables, where radius represents rrr and height represents hhh: radius ← 2 height ← 5 The built-in constant PI stores...

[Show more]

Preview 4 out of 37  pages

  • November 29, 2022
  • 37
  • 2022/2023
  • Exam (elaborations)
  • Questions & answers
avatar-seller
Khan Academy Programming

Joo-won is writing code to calculate the volume of a cone based on this formula:



Volume=(Pi(r)^2)(h/3)



He's testing his code on this cone:

The code starts with these variables, where radius represents rrr and height represents hhh:

radius ← 2

height ← 5

The built-in constant PI stores an approximation of PI

Which expression correctly calculates the volume? correct answerPI * (radius * radius) * (height / 3)



A local search website lets users create lists of their favorite restaurants.

When the user first starts, the website runs this code to create an empty list:

localFavs ← []

The user can then insert and remove items from the list.

Here's the code that was executed from one user's list making session:

APPEND(localFavs, "Udupi")

APPEND(localFavs, "The Flying Falafel")

APPEND(localFavs, "Rojbas Grill")

APPEND(localFavs, "Cha-Ya")

APPEND(localFavs, "Platano")

APPEND(localFavs, "Cafe Nostos")



INSERT(localFavs, 3, "Gaumenkitzel")

REMOVE(localFavs, 5)

,What does the localFavs variable store after that code runs? correct answer"Udupi", "The Flying Falafel",
"Gaumenkitzel", "Rojbas Grill", "Platano", "Cafe Nostos"



Alissa is programming an app called ShirtItUp, where users can customize a t-shirt with their own phrase
on it.

Which variable would she most likely use a string data type for? correct answerphrase: The custom
phrase entered by the user



This program uses a conditional to determine whether a child will have free or attached earlobes.

if (fatherAllele = "G" OR motherAllele = "G")

{

earlobeType ← "free"

}

ELSE

{

earlobeType ← "attached"

}

In which situations will earlobeType be "free"?

👁️Note that there may be multiple answers to this question. correct answerWhen fatherAllele is "G" and
motherAllele is "G"



When fatherAllele is "G" and motherAllele is "g"



When fatherAllele is "g" and motherAllele is "G"



This short program displays the winning result in a ship naming contest:

DISPLAY ("Schoolie")

DISPLAY ("McSchoolFace")

Part 1: How many statements are in the above program?

,Part 2: What does the program output? correct answer2



Schoolie McSchoolFace



Emanuel is writing a program to decide which fairgoers can ride on the rollercoaster, based on their
height.

The rollercoaster has a sign posted that states: "RIDERS MUST BE AT LEAST 48" TALL TO RIDE"

The variable riderHeight represents a potential rider's height (in inches), and his program needs to set
canRide to either true or false.

Which of these code segments correctly sets the value of canRide?

👁️Note that there are 2 answers to this question. correct answerIF (riderHeight ≥ 48) {

canRide ← true

}

ELSE {

canRide ← false

}



IF (riderHeight < 48) {

canRide ← false

}

ELSE {

canRide ← true

}



This program simulates a game where two players try to make basketball shots . Once either player
misses 5 shots, the game is over.

1: player1Misses ← 0

2: player2Misses ← 0

3: REPEAT UNTIL (player1Misses = 5 OR player2Misses = 5)

4: {

, 5: player1Shot ← RANDOM(1, 2)

6: player2Shot ← RANDOM(1, 2)

7: IF (player1Shot = 2)

8: {

9: DISPLAY("Player 1 missed! ☹")

10: }

11: IF (player2Shot = 2)

12: {

13: DISPLAY("Player 2 missed! ☹")

14: }

15: IF (player1Shot = 1 AND player2Shot = 1)

16: {

17: DISPLAY("No misses! ☺")

18: }

19: }

Unfortunately, this code is incorrect; the REPEAT UNTIL loop never stops repeating.

Where would you add code so that the game ends when expected?

👁️Note that there are 2 answers to this question. correct answerBetween line 9 and 10



Between line 13 and 14



Nikki read that it's healthy to take 10,000 steps every day. She's curious how many steps that'd be per
minute, walking from 10AM to 10PM, and is writing a program to figure it out.

The program starts with this code:

stepsPerDay ← 10000

hoursAwake ← 12

Which lines of code successfully calculate and store the steps per minute?

👁️Note that there may be multiple answers to this question. correct answerstepsPerMin ← stepsPerDay
/ hoursAwake / 60

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying these notes from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller EAGLE5. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy these notes for $11.49. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

85169 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy study notes for 14 years now

Start selling
$11.49
  • (0)
  Add to cart