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

Computer Science Unit 1 and Unit 2 with complete solution

Rating
-
Sold
-
Pages
9
Grade
A
Uploaded on
27-02-2023
Written in
2022/2023

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();

Show more Read less
Institution
Course









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

Written for

Course

Document information

Uploaded on
February 27, 2023
Number of pages
9
Written in
2022/2023
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

Content preview

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++) {

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.
LECTMAGGY Chamberlain College Of Nursing
Follow You need to be logged in order to follow users or courses
Sold
145
Member since
3 year
Number of followers
121
Documents
6310
Last sold
2 months ago
LECTMAGGY

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.

3.2

27 reviews

5
7
4
3
3
11
2
0
1
6

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