Unit 4 #5

Unit 4 #5

12th Grade

10 Qs

quiz-placeholder

Similar activities

Test 4 P1

Test 4 P1

12th Grade

15 Qs

MUỐI AMONI

MUỐI AMONI

12th Grade

15 Qs

AMINO AXIT - ĐỒNG PHÂN

AMINO AXIT - ĐỒNG PHÂN

12th Grade

14 Qs

PEPTIT_PROTEIN

PEPTIT_PROTEIN

12th Grade

12 Qs

[2k6] Lý thuyết amino axit

[2k6] Lý thuyết amino axit

12th Grade

8 Qs

HÓA 12 - PEPTIT VÀ PROTEIN

HÓA 12 - PEPTIT VÀ PROTEIN

12th Grade

12 Qs

PEPTIT - PROTEIN

PEPTIT - PROTEIN

12th Grade

11 Qs

PEPTIT - PROTEIN

PEPTIT - PROTEIN

KG - 12th Grade

14 Qs

Unit 4 #5

Unit 4 #5

Assessment

Quiz

Chemistry

12th Grade

Easy

Created by

Clifford Buckles

Used 6+ times

FREE Resource

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

Consider the following procedures, which are used to control a device that draws lines on paper.

Consider the goal of using the device to produce the following drawing, where each line shown has a length of 10 units and the horizontal lines are 10 units apart.

The device is positioned at the upper-left corner of a sheet of paper and is facing right. Which of the following code segments will produce the drawing shown?

penDown()

goForward(10)

turnRight(90)

goForward(10)

turnRight(90)

goForward(10)

penDown()

goForward(10)

penUp()

turnRight(90)

turnRight(90)

penDown()

goForward(10)

penDown()

goForward(10)

turnRight(90)

penUp()

goForward(10)

turnRight(90)

penDown()

penDown()

goForward(10)

penUp()

turnRight(90)

goForward(10)

turnRight(90)

penDown()

goForward(10)

2.

MULTIPLE SELECT QUESTION

45 sec • 1 pt

Which of the following are ways in which a programmer can use abstraction to manage the complexity of a program?

Select two answers.

response - correct

Responses


Replacing each instance of repeated code with a call to a procedure

Replacing longer variable names with shorter variable names to reduce typing errors


Replacing several lines of documentation with a single line of documentation

Replacing several lines of documentation with a single line of documentation name1,  name2, name3, and name4 with a list of strings
called names

3.

MULTIPLE SELECT QUESTION

45 sec • 1 pt

Which of the following are benefits of procedural abstraction?

Select two answers.

Procedural abstraction prevents programmers from accidentally using the intellectual property of other programmers.

Procedural abstraction eliminates the need for programmers to document their code.

Procedural abstraction makes it easier for people to read computer programs.

Procedural abstraction provides an opportunity to give a name to a block of code that describes the purpose of the code block.

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Consider the following procedure.

PROCEDURE doSomething(num1, num2)

{

DISPLAY(num1)

RETURN(num1)

DISPLAY(num2)

}

Consider the following statement.

DISPLAY(doSomething(10, 20))

What is displayed as a result of executing the statement above?

Responses


10 10

10 20

10 10 20

10 20 10

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

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.

Which of the following code segments can be used to draw the figure?

Responses


xVal ← 1

yVal ← 0

len ← 1

REPEAT 5 TIMES

{

drawLine(xVal, yVal, xVal, yVal + len)

xVal ← xVal + 1

len ← len + 1

}

xVal ← 1

yVal ← 0

len ← 1

REPEAT 5 TIMES

{

drawLine(xVal, yVal, xVal + len, yVal)

yVal ← yVal + 1

len ← len + 1

}

xVal ← 5

yVal ← 0

len ← 5

REPEAT 5 TIMES

{

drawLine(xVal, yVal, xVal, yVal + len)

xVal ← xVal - 1

}

xVal ← 5

yVal ← 0

len ← 5

REPEAT 5 TIMES

{

drawLine(xVal, yVal, xVal + len, yVal)

yVal ← yVal - 1

len ← len - 1

}

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 right.

Consider the following procedure.

Which of the following code segments will move the robot to the gray square along the path indicated by the arrows?

Media Image
Media Image
Media Image
Media Image

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

A student is developing a program that allows users to look up the definitions of words that appear in a book.

The student plans to perform a large number of searches through a dictionary containing words and their definitions. The student will use a procedure written by a computer scientist to quickly search the dictionary (and knows that the procedure will return a definition if one is available). The student cannot modify the search procedure written by the computer scientist but can call the procedure by supplying a word.

Which of the following is a true statement about the student’s use of the computer scientist’s search procedure?

The student is changing the search procedure’s internal abstractions.

The student is modifying the search procedure to take a definition as an argument and return the corresponding word.

The student is reusing the computer scientist’s procedural abstraction by knowing what the procedure does without knowing how it does it.

The student is reusing the computer scientist’s procedural abstraction by using duplicate code each time a search needs to occur.

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?