100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.2 TrustPilot
logo-home
Exam (elaborations)

KHAN ACADEMY PROGRAMMING STUDY LIST 2024 COMPLETE GUIDE SOLVED AND VERIFIED 100%

Rating
-
Sold
-
Pages
37
Grade
A+
Uploaded on
21-04-2024
Written in
2023/2024

KHAN ACADEMY PROGRAMMING STUDY LIST 2024 COMPLETE GUIDE SOLVED AND VERIFIED 100% 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? Ans- PI * (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? Ans- "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? Ans- phrase: 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. Ans- When 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? Ans- 2 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. Ans- IF (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. Ans- Between 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. Ans- stepsPerMin ← stepsPerDay / hoursAwake / 60 stepsPerMin ← (stepsPerDay / hoursAwake) / 60 A gardener is writing a program to detect whether the soils for their citrus trees are the optimal level of acidity. IF (measuredPH > 6.5) { soilState ← "high" } ELSE { IF (measuredPH < 5.5) { soilState ← "low" } ELSE { soilState ← "optimal" } } Which of these tables shows the expected values of soilState for the given values of measuredPH? Ans- measuredPH soilState 4.7 "low" 5.4 "low" 5.5 "optimal" 6.2 "optimal" 6.5 "optimal" 6.7 "high" 7.2 "high" Darian is making a program to track his grades. He made the mistake of using the same variable name to track 3 different test grades, though. Here's a snippet of his code: a ← 89 a ← 97 a ← 93 What will be the value of a after this code runs? Ans- 93 KittyBot is a programmable robot that obeys the following commands: Name Description walkForward() Walks forward one space in the grid. turnLeft() Rotates left 90 degrees (without moving forward). turnRight() Rotates right 90 degrees (without moving forward). KittyBot is currently positioned in the second row and third column of the grid, and is facing the bottom edge of the grid. We want to program KittyBot so that she pounces on both of the MouseyBots, walking exactly into the squares where they're hiding. Which of these code segments accomplishes that goal? Ans- REPEAT 2 TIMES { walkForward() turnRight() walkForward() turnLeft() turnLeft() } Nuru writes this code to calculate the final cost of an item with a discount applied: price ← 0.7 discount ← 0.2 final ← price - discount They're surprised to see that final stores the value 0. instead of 0.5. What is the best explanation for that result? Ans- The arithmetic operations on floating-point numbers resulted in a round-off error. The following code snippet processes a list of strings with a loop and conditionals: words ← ["cab", "lab", "cable", "cables", "bales", "bale"] wordScore ← 0 FOR EACH word IN words { IF (LEN(word) ≥ 5) { wordScore ← wordScore + 3 } ELSE { IF (LEN(word) ≥ 4) { wordScore ← wordScore + 2 } ELSE { IF (LEN(word) ≥ 3) { wordScore ← wordScore + 1 } } } } DISPLAY(wordScore) The code relies on one string procedure, LEN(string), which returns the number of characters in the string. What value will this program display? Ans- 13 A digital artist is writing a program to draw a landscape with a randomly generated mountain range. This code draws a single mountain: xPos ← RANDOM(4, 240) height ← RANDOM(70, 120) drawMountain(xPos, 80, height) The code relies on the drawMountain() procedure, which accepts three parameters for the mountain's x position, y position, and height. Here's what's drawn from one run of the program: Which of these describes mountains that might be drawn from this program? ️Note that there may be multiple answers to this question. Ans- A mountain at an x position of 4 and a height of 120 A mountain at an x position of 180 and a height of 110 Marius is writing a program that calculates physics formulas. His procedure calcGravForce should return the gravitational force between two objects at a certain radius from each other, based on this formula: F=G((m1m2)/r^2) 1 PROCEDURE calcGravForce (mass1, mass2, radius) 2 { 3 ,,,,space, space, space, spaceG ← 6.674 * POWER(10, −11) 4 ,,,,space, space, space, spacemasses ← mass1 * mass2 5 ,,,,space, space, space, spaceforce ← G * ( masses / POWER(radius, 2) ) 6 } The procedure is missing a return statement, however. Part 1: Which line of code should the return statement be placed after? Ans- After line 5 RETURN force The following procedure calculates the slope of a line and takes 4 numeric parameters: the x coordinate of the first point, the y coordinate of the first point, the x coordinate of the second point, and the y coordinate of the second point. PROCEDURE lineSlope (x1, y1, x2, y2) { result ← (y2 - y1) / (x2 - x1) DISPLAY (result) } This graph contains a line with unknown slope, going through the points [2, 1] and [4, 3]: Which of these lines of code correctly calls the procedure to calculate the slope of this line? Ans- lineSlope(2, 1, 4, 3) Jace is making a simulation of conversations with his 2-year-old son.

Show more Read less
Institution
Khan
Course
Khan











Whoops! We can’t load your doc right now. Try again or contact support.

Written for

Institution
Khan
Course
Khan

Document information

Uploaded on
April 21, 2024
Number of pages
37
Written in
2023/2024
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
Wiseman NURSING
View profile
Follow You need to be logged in order to follow users or courses
Sold
6644
Member since
4 year
Number of followers
3834
Documents
25821
Last sold
4 hours ago
Testsprint

Updated exams .Actual tests 100% verified.ATI,NURSING,PMHNP,TNCC,USMLE,ACLS,WGU AND ALL EXAMS guaranteed success.Here, you will find everything you need in NURSING EXAMS AND TESTBANKS.Contact us, to fetch it for you in minutes if we do not have it in this shop.BUY WITHOUT DOUBT!!!!Always leave a review after purchasing any document so as to make sure our customers are 100% satisfied. **Ace Your Exams with Confidence!**

3.9

1366 reviews

5
672
4
246
3
210
2
76
1
162

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions