Code.org Unit 7 Assessment Day

Code.org Unit 7 Assessment Day

Assessment

Quiz

Computers

9th - 12th Grade

Medium

Created by

D W

Used 700+ times

FREE Resource

Student preview

quiz-placeholder

8 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

Which code segment will guarantee that the robot makes it to the grey square without hitting a wall or a barrier (black square)?


Here is the API for a robot library.

// moves the robot forward

function moveForward();


// turns the robot to the left

function rotateLeft();


// turns the robot to the right

function rotateRight();


// checks if a robot can move in any direction

// direction {string} - the direction to be checked

// return {Boolean} - true if the robot can move in that direction, otherwise returns false

function canMove(direction);

Media Image
Media Image
Media Image
Media Image

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

You have imported a library with the birthMonth() function. Based on the API, how many strings are inputed to calculate the birth month?

1

4

0

3

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which term refers to a solution to a large problem that is based on the solutions of smaller subproblems.

procedural abstraction

API

modularity

library

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

This function finds the minimum number in a list. What should <MISSING CODE SEGMENT> be replaced with in order for this function to operate as expected?

numList[i] = min;

min = numList[i];

min = numList;

numList = min;

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is one of the benefits of using a library in a program?

simplifies creating a complex program

increases development time

removes all testing

reduces abstractions in the program

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Barry is making a program to process user birthdays.

The program uses the following procedure for string slicing:


NameDescriptionSUBSTRING (string, startPos, numChars)Returns a substring of string starting at startPos of length numChars. The first character in the string is at position 1.


His program starts with this line of code:

userBday ← "03/31/84"


Which of these lines of code displays the day of the month ("31")?


Choose 1 answer:

display (substring (userBday, 3, 1)

display (substring (userBday, 3, 3)

display (substring (userBday, 4, 1)

display (substring (userBday, 4, 2)

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Marlon is programming a simulation of a vegetable garden. Here's the start of his code:

temperature ← 65

moisture ← 30

acidity ← 3

DISPLAY (acidity)

DISPLAY (temperature)

DISPLAY (moisture)

65 30 3

3 30 65

3 65 30

8.

FILL IN THE BLANK QUESTION

1 min • 1 pt

Landry is writing a program to help her calculate how long it will take to read the books she received for Christmas.

The procedure calcReadingHours returns the number of hours it will take her to read a given number of pages, if each page takes a given number of minutes to read.

PROCEDURE calcReadingHours(numPages, minPerPage)

{

totalMin ← numPages * minPerPage

RETURN totalMin / 60

}

Landry then runs this line of code:

hoursNeeded ← calcReadingHours(180, 2)

What value is stored in hoursNeeded?