100% de satisfacción garantizada Inmediatamente disponible después del pago Tanto en línea como en PDF No estas atado a nada 4.2 TrustPilot
logo-home
Examen

AP Computer Science Principles Programming (Khan Academy) UPDATED ACTUAL Questions and CORRECT Answers

Puntuación
-
Vendido
-
Páginas
53
Grado
A+
Subido en
25-10-2024
Escrito en
2024/2025

AP Computer Science Principles Programming (Khan Academy) UPDATED ACTUAL Questions and CORRECT Answers Which of the following is a benefit of procedures for programmers? - CORRECT ANSWER- Programmers can more easily understand programs with procedures, since procedures give names to complex pieces of code. Aarush is writing a program to help him calculate how much exercise he does at the gym. The procedure calcSwimYards returns the number of yards swum for a given number of laps in a pool of a given length. PROCEDURE calcSwimYards(poolLength, numLaps)

Mostrar más Leer menos
Institución
AP Computer Science Principles Programming
Grado
AP Computer Science Principles Programming











Ups! No podemos cargar tu documento ahora. Inténtalo de nuevo o contacta con soporte.

Escuela, estudio y materia

Institución
AP Computer Science Principles Programming
Grado
AP Computer Science Principles Programming

Información del documento

Subido en
25 de octubre de 2024
Número de páginas
53
Escrito en
2024/2025
Tipo
Examen
Contiene
Preguntas y respuestas

Temas

Vista previa del contenido

AP Computer Science Principles
Programming (Khan Academy) UPDATED
ACTUAL Questions and CORRECT
Answers
Which of the following is a benefit of procedures for programmers? - CORRECT
ANSWER✔✔- Programmers can more easily understand programs with procedures, since
procedures give names to complex pieces of code.


Aarush is writing a program to help him calculate how much exercise he does at the gym.
The procedure calcSwimYards returns the number of yards swum for a given number of laps
in a pool of a given length.
PROCEDURE calcSwimYards(poolLength, numLaps)
{
lapLength ← poolLength * 2
RETURN lapLength * numLaps
}
Aarush then runs this line of code:
yardsSwum ← calcSwimYards(25, 10)

What value is stored in yardsSwum? - CORRECT ANSWER✔✔- 500


At that distance, the code should give the player a 30% chance of making the goal. -
CORRECT ANSWER✔✔- RANDOM(1, 100) <= 30


RANDOM(1, 10) <= 3


discount ← 0


IF (quantity <?> 150)
{
discount ← 10

,} ELSE
{
IF (quantity <?> 75)
{
discount ← 7
}
ELSE {
IF (quantity <?> 10)
{
discount ← 5
}
}
}
Which operator could replace <?> so that the code snippet works as expected? - CORRECT
ANSWER✔✔- ≥


IF (ironLevel < 10)
{
diagnosis ← "anemic"
}
ELSE
{
diagnosis ← "normal"
}
Which of these tables shows the expected values of diagnosis for the given values of
ironLevel?

Choose 1 answer: - CORRECT ANSWER✔✔- 4.5 "anemic"
8.2 "anemic"
9.9 "anemic"
10.0 "normal"
22.5 "normal"

,NOT ( calendar = "user" AND rsvp = "yes" ) - CORRECT ANSWER✔✔- calendar ≠ "user"
OR rsvp ≠ "yes"


This graph contains a line with unknown slope, going through the points [2, 1][2,1]open
bracket, 2, comma, 1, close bracket and [4, 3][4,3]open bracket, 4, comma, 3, close bracket: -
CORRECT ANSWER✔✔- (2, 1, 4, 3)


Program 1:
totalCalories ← 0
loggedMeals ← [700, 800, 600, 300]
FOR EACH loggedMeal IN loggedMeals
{
totalCalories ← totalCalories + loggedMeal
}
IF (totalCalories > 2000) {
excessCalories ← totalCalories - 2000
DISPLAY(excessCalories)
}
Program 2:
totalCalories ← 0
loggedMeals ← [700, 800, 600, 300]
FOR EACH loggedMeal IN loggedMeals
{
totalCalories ← totalCalories + loggedMeal
IF (totalCalories > 2000) {
excessCalories ← totalCalories - 2000
}
}

DISPLAY(excessCalories) - CORRECT ANSWER✔✔- Program 1 and Program 2 display
the same output, but Program 2 requires more computations.

, REPEAT UNTIL ( canTakeCheese() )
{
<MISSING CODE>
}
There are many ways for him to reach the cheese. Of the options below, which will require
the most repetitions of the loop? - CORRECT ANSWER✔✔- IF (facingWall())
{
turnRight()
}
ELSE
{
walkForward(2)
}


sentence ← ""
word1 ← "Hello"
firstLetter1 ← SUBSTRING(word1, 1, 1)
otherLetters1 ← SUBSTRING(word1, 2, LENGTH(word1) - 1)
pigLatin1 ← CONCAT(otherLetters1, firstLetter1, "ay")
sentence ← CONCAT(sentence, pigLatin1, " ")
word2 ← "Mister"
firstLetter2 ← SUBSTRING(word2, 1, 1)
otherLetters2 ← SUBSTRING(word2, 2, LENGTH(word2) - 1)
pigLatin2 ← CONCAT(otherLetters2, firstLetter2, "ay")
sentence ← CONCAT(sentence, pigLatin2, " ")
word3 ← "Rogers"
firstLetter3 ← SUBSTRING(word3, 1, 1)
otherLetters3 ← SUBSTRING(word3, 2, LENGTH(word3) - 1)
pigLatin3 ← CONCAT(otherLetters3, firstLetter3, "ay")
sentence ← CONCAT(sentence, pigLatin3, " ")

Conoce al vendedor

Seller avatar
Los indicadores de reputación están sujetos a la cantidad de artículos vendidos por una tarifa y las reseñas que ha recibido por esos documentos. Hay tres niveles: Bronce, Plata y Oro. Cuanto mayor reputación, más podrás confiar en la calidad del trabajo del vendedor.
MGRADES Stanford University
Ver perfil
Seguir Necesitas iniciar sesión para seguir a otros usuarios o asignaturas
Vendido
1069
Miembro desde
1 año
Número de seguidores
102
Documentos
68976
Última venta
4 horas hace
MGRADES (Stanford Top Brains)

Welcome to MGRADES Exams, practices and Study materials Just think of me as the plug you will refer to your friends Me and my team will always make sure you get the best value from the exams markets. I offer the best study and exam materials for a wide range of courses and units. Make your study sessions more efficient and effective. Dive in and discover all you need to excel in your academic journey!

3.8

169 reseñas

5
73
4
30
3
44
2
8
1
14

Recientemente visto por ti

Por qué los estudiantes eligen Stuvia

Creado por compañeros estudiantes, verificado por reseñas

Calidad en la que puedes confiar: escrito por estudiantes que aprobaron y evaluado por otros que han usado estos resúmenes.

¿No estás satisfecho? Elige otro documento

¡No te preocupes! Puedes elegir directamente otro documento que se ajuste mejor a lo que buscas.

Paga como quieras, empieza a estudiar al instante

Sin suscripción, sin compromisos. Paga como estés acostumbrado con tarjeta de crédito y descarga tu documento PDF inmediatamente.

Student with book image

“Comprado, descargado y aprobado. Así de fácil puede ser.”

Alisha Student

Preguntas frecuentes