• ¿Documento equivocado? Cámbialo gratis
  • Escrito por estudiantes que aprobaron
  • Inmediatamente disponible después del pago
  • Leer en línea o como PDF
Vender
¿Dónde estudias?
Tu idioma
Document preview thumbnail
Vista previa 2 fuera de 9 páginas
Examen

Computer Science Unit 1 and Unit 2 with complete solution

Document preview thumbnail
Vista previa 2 fuera de 9 páginas

Computer Science Unit 1 and Unit 2 with complete solution Which of the following commands is a valid Karel command? move(); What makes the following command an invalid Karel command? turnleft(); The l should be a capital L Which of the following is the correct way to define a turnRight function in Karel? function turnRight() { turnLeft(); turnLeft(); turnLeft(); } Why do we use functions in Karel programs? Break down our program into smaller parts Avoid repeating code Make our program more readable All of the above If Karel starts at Street 1 and Avenue 1, facing East, where will Karel be, and what direction will Karel be facing after running the following code? (Assume the world is 10x10 in size) move(); turnLeft(); putBall(); turnLeft(); turnLeft(); turnLeft(); move(); turnLeft(); Street 1, Avenue 3, Facing North Karel starts at Street 1 and Avenue 1, facing East. After calling the stairStep function twice, where will Karel be and what direction will Karel be facing? (assume this is a SuperKarel program and the world is 10x10 in size) function stairStep() { move(); turnLeft(); move();

Vista previa del contenido

Computer Science Unit 1 and Unit 2 with complete solution
Which of the following commands is a valid Karel command?
move();
What makes the following command an invalid Karel command?
turnleft();
The l should be a capital L
Which of the following is the correct way to define a turnRight function in Karel?
function turnRight() {
turnLeft();
turnLeft();
turnLeft();
}
Why do we use functions in Karel programs?
Break down our program into smaller parts


Avoid repeating code


Make our program more readable


All of the above
If Karel starts at Street 1 and Avenue 1, facing East, where will Karel be, and what
direction will Karel be facing after running the following code? (Assume the world
is 10x10 in size)

move();
turnLeft();
putBall();
turnLeft();
turnLeft();
turnLeft();
move();
turnLeft();
Street 1, Avenue 3, Facing North
Karel starts at Street 1 and Avenue 1, facing East. After calling the stairStep
function twice, where will Karel be and what direction will Karel be facing?
(assume this is a SuperKarel program and the world is 10x10 in size)

function stairStep() {
move();
turnLeft();
move();

, turnRight();
}
Street 3, Avenue 3, Facing East
In this code, how many times is the dance function called and how many times is
it defined?

function start() {
move();
dance();
move();
move();
turnLeft();
dance();
dance();
}

function dance() {
turnLeft();
move();
turnLeft();
turnLeft();
move();
turnLeft();
}
Called 3 times, defined 1 time
What's wrong with this code?
function start() {
move();
go();
go();
}

function go() {
move();
move();
}

function go() {
move();
move();
}
The go function has been defined twice
How many total times will Karel move in this program?
function start() {
move();
for (var i = 0; i < 5; i++) {

Información del documento

Subido en
27 de febrero de 2023
Número de páginas
9
Escrito en
2022/2023
Tipo
Examen
Contiene
Preguntas y respuestas
$12.99

¿Documento equivocado? Cámbialo gratis Dentro de los 14 días posteriores a la compra y antes de descargarlo, puedes elegir otro documento. Puedes gastar el importe de nuevo.
Escrito por estudiantes que aprobaron
Inmediatamente disponible después del pago
Leer en línea o como PDF

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.
LECTMAGGY
3.3
(29)
Vendido
149
Seguidores
121
Artículos
6316
Última venta
2 meses hace



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