Search Header Logo

Unit 4 #4

Authored by Clifford Buckles

Chemistry

12th Grade

Used 5+ times

Unit 4 #4
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Consider the following procedure.

Procedure CallExplanationdrawLine(x1, y1, x2, y2)Draws a line segment on a coordinate grid with endpoints at coordinates (x1, y1) and (x2, y2)

The drawLine procedure is to be used to draw the following figure on a coordinate grid.

Let the value of the variable xVal be 6 and the value of the variable yVal be 5. Which of the following code segments can be used to draw the figure?

drawLine(1, 5, xVal, yVal)

drawline(1, 5, xVal, yVal + 2)

drawline(1, 5, xVal, yVal + 2)

drawLine(1, 5, xVal, yVal)

drawline(1, 5, xVal, yVal + 2)

drawline(1, 5, xVal, yVal - 2)

drawLine(1, 5, xVal, yVal)

drawline(1, 5, xVal + 2, yVal + 2)

drawline(1, 5, xVal + 2, yVal - 2)

drawLine(1, 5, xVal, yVal)

drawline(1, 5, xVal + 2, yVal + 2)

drawline(1, 5, xVal - 2, yVal - 2)

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

The procedure Draw (length, direction) is used to draw a line segment length units long in a given direction (left, right, up, or down), starting at the current cursor position. The cursor is then repositioned at the end of the line segment that was drawn. Consider the following program, where the cursor starts in the upper left corner of a grid of dots. The dots are spaced one unit apart.

Draw (1, right)

Draw (2, down)

Draw (1, left)

Draw (1, right)

Draw (1, up)

Draw (1, left)

Which of the following represents the figure that is drawn by the program?

Media Image
Media Image
Media Image
Media Image

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

A photographer has a collection of digital pictures, each using the same file-naming format: a date tag, followed by a description, followed by the file extension ".jpg". The photographer wants to write a code segment to extract the description from each file name, as shown in the following table.

Original File NameExtracted Description2016-05-22-Andrews-Graduation.jpgAndrews-Graduation2016-07-04-Fireworks.jpgFireworks​2017-10-18-Grandmas-Birthday.jpgGrandmas-Birthday

The photographer has the following procedures available.

Procedure CallExplanation​TrimLeft (str, n)Returns a copy of the string str with the n leftmost characters removed. For example, TrimLeft ("keyboard", 3) returns "board".TrimRight (str, n)Returns a copy of the string str with the n rightmost characters removed. For example, TrimRight ("keyboard", 3) returns "keybo".

Let an original file name be stored in the string variable original. Which of the following statements will correctly extract the description and store it in the string variable descr ?

  1. -descr ← TrimLeft (TrimRight (original, 4), 11)

  2. -descr ← TrimLeft (TrimRight (original, 11), 4)

  3. -descr ← TrimRight (TrimLeft (original, 11), 4)

I only

II only

I and III

II and III

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

A student’s overall course grade in a certain class is based on the student’s scores on individual assignments. The course grade is calculated by dropping the student’s lowest individual assignment score and averaging the remaining scores.

For example, if a particular student has individual assignment scores of 85, 75, 90, and 95, the lowest score (75) is dropped. The calculated course grade is (85+90+95)/3=90.

A programmer is writing a program to calculate a student’s course grade using the process described. The programmer has the following procedures available.

Procedure CallExplanationMin (numList)Returns the minimum value in the list numListSum (numList)Returns the sum of the values in the list numList

The student’s individual assignment scores are stored in the list scores. Which of the following can be used to calculate a student’s course grade and store the result in the variable finalGrade?

finalGrade ← Sum (scores) / LENGTH (scores)

finalGrade ← finalGrade - Min (scores)

finalGrade ← Sum (scores) / (LENGTH (scores) - 1)

finalGrade ← finalGrade - Min (scores)

finalGrade ← Sum (scores) - Min (scores)

finalGrade ← finalGrade / LENGTH (scores)

finalGrade ← Sum (scores) - Min (scores)

finalGrade ← finalGrade / (LENGTH (scores) - 1)

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

The figure below shows a robot in a grid of squares. The robot is represented as a triangle, which is initially facing upward. The robot can move into a white or gray square but cannot move into a black region.

Media Image
Media Image
Media Image
Media Image

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

The following question uses a robot in a grid of squares. The robot is represented by a triangle, which is initially facing toward the top of the grid.

Media Image
Media Image
Media Image
Media Image

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Consider the following procedure.

Procedure CallExplanationdrawCircle(xPos, yPos, rad)Draws a circle on a coordinate grid with center (xPos, yPos) and radius rad

The drawCircle procedure is to be used to draw the following figure on a coordinate grid.

Let the value of the variable x be 2, the value of the variable y be 2, and the value of the variable r be 1. Which of the following code segments can be used to draw the figure?

drawCircle(x, y, r)

drawCircle(x, y + 2, r)

drawCircle(x + 2, y, r)

drawCircle(x + 2, y + 2, r)

drawCircle(x, y, r)

drawCircle(x, y + 3, r)

drawCircle(x + 3, y, r)

drawCircle(x + 3, y + 3, r)

drawCircle(x, y, r + 2)

drawCircle(x, y + 2, r + 2)

drawCircle(x + 2, y, r + 2)

drawCircle(x + 2, y + 2, r + 2)

drawCircle(x, y, r + 3)

drawCircle(x, y + 3, r + 3)

drawCircle(x + 3, y, r + 3)

drawCircle(x + 3, y + 3, r + 3)

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?