Unit 4 #2

Unit 4 #2

12th Grade

10 Qs

quiz-placeholder

Similar activities

Unit 4 #3

Unit 4 #3

12th Grade

10 Qs

Safety Question

Safety Question

12th Grade

10 Qs

Acid Safety

Acid Safety

9th - 12th Grade

5 Qs

Properties of Materials

Properties of Materials

10th - 12th Grade

12 Qs

Molar Mass and Stoichiometry Introduction

Molar Mass and Stoichiometry Introduction

10th - 12th Grade

12 Qs

Scientific Investigation

Scientific Investigation

11th - 12th Grade

8 Qs

Ionization Energy

Ionization Energy

9th - 12th Grade

10 Qs

Average Atomic mass of colonialium Prelab quiz

Average Atomic mass of colonialium Prelab quiz

6th Grade - University

13 Qs

Unit 4 #2

Unit 4 #2

Assessment

Quiz

Chemistry

12th Grade

Easy

NGSS
K-2-ETS1-1, 3-ESS2-1, HS-ETS1-2

Standards-aligned

Created by

Clifford Buckles

Used 7+ times

FREE Resource

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

Consider two lists of numbers called list1 and list2. A programmer wants to determine how many different values appear in both lists. For example, if list1 contains [10, 10, 20, 30, 40, 50, 60] and list2 contains [20, 20, 40, 60, 80], then there are three different values that appear in both lists (20, 40, and 60).

The programmer has the following procedures available.

Which of the following can be used to assign the intended value to count ?

bothList ← Combine (list1, list2)

uniqueList ← RemoveAllDups (bothList)

count ← LENGTH (bothList) - LENGTH (uniqueList)

newList1 ← RemoveAllDups (list1)

newList2 ← RemoveAllDups (list2)

bothList ← Combine (newList1, newList2)

count ← LENGTH (list1) + LENGTH (list2) - LENGTH (bothList)

newList1 ← RemoveAllDups (list1)

newList2 ← RemoveAllDups (list2)

bothList ← Combine (newList1, newList2)

count ← LENGTH (newList1) + LENGTH (newList2) - LENGTH (bothList)

newList1 ← RemoveAllDups (list1)

newList2 ← RemoveAllDups (list2)

bothList ← Combine (newList1, newList2)

uniqueList ← RemoveAllDups (bothList)

count ← LENGTH (bothList) - LENGTH (uniqueList)

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

A computer program contains code in several places that asks a user to enter an integer within a specified range of values. The code repeats the input request if the value that the user enters is not within the specified range. A programmer would like to create a procedure that will generalize this functionality and can be used throughout the program. The correct use of the procedure is shown below, where min is the least acceptable value, max is the greatest acceptable value, and promptString is the string that should be printed to prompt the user enter a value.

inputVal ← getRange(min, max, promptString)

Which of the following is a correct implementation of the getRange procedure?

PROCEDURE getRange(min, max, promptString)

{

DISPLAY(promptString)

RETURN(INPUT())

}

PROCEDURE getRange(min, max, promptString)

{

DISPLAY(promptString)

x ← INPUT()

RETURN(x)

}

PROCEDURE getRange(min, max, promptString)

{

DISPLAY(promptString)

x ← INPUT()

REPEAT UNTIL(x ≥ min AND x ≤ max)

{

DISPLAY(promptString)

x ← INPUT()

}

}

PROCEDURE getRange(min, max, promptString)

{

DISPLAY(promptString)

x ← INPUT()

REPEAT UNTIL(x ≥ min AND x ≤ max)

{

DISPLAY(promptString)

x ← INPUT()

}

RETURN(x)

}

3.

MULTIPLE SELECT QUESTION

45 sec • 1 pt

A program is created to perform arithmetic operations on positive and negative integers. The program contains the following incorrect procedure, which is intended to return the product of the integers  and .

A programmer suspects that an error in the program is caused by this procedure. Under which of the following conditions will the procedure NOT return the correct product?

Select two answers.

When the values of x and y are both positive.

When the values of x is positive and the value of y is negative.

When the values of x is negative and the value of y is positive.

When the values of x and y are both negative.

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

The following procedure is intended to return the number of times the value val appears in the list myList. The procedure does not work as intended.

Line 01: PROCEDURE countNumOccurences(myList, val)

Line 02: {

Line 03:    FOR EACH item IN myList

Line 04:    {

Line 05:          count ← 0

Line 06:          IF(item = val)

Line 07:          {

Line 08:               count ← count + 1

Line 09:          }

Line 10:   }

Line 11:   RETURN(count)

Line 12: }

Which of the following changes can be made so that the procedure will work as intended?

Changing line 6 to IF(item = count)

Changing line 6 to IF(myList[item] = val)

Moving the statement in line 5 so that it appears between lines 2 and 3

Moving the statement in line 11 so that it appears between lines 9 and 10

Tags

NGSS.K-2-ETS1-1

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

A student is creating a procedure to determine whether the weather for a particular month was considered very hot. The procedure takes as input a list containing daily high temperatures for a particular month. The procedure is intended to return true if the daily high temperature was at least 90 degrees for a majority of days in the month and return false otherwise.

Which of the following can be used to replace <Missing Code> so that the procedure works as intended?

Media Image
Media Image
Media Image
Media Image

Tags

NGSS.3-ESS2-1

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

The following procedure is intended to return true if at least two of the three parameters are equal in value and is intended to return false otherwise.

PROCEDURE AnyPairs (x, y, z)

{

IF (x = y)

{

RETURN (true)

}

ELSE

{

RETURN (y = z)

}

}

For which of the following procedure calls does the procedure NOT return the intended value?

AnyPairs ("bat", "cat", "rat")

AnyPairs ("bat", "bat", "rat")

AnyPairs ("bat", "cat", "bat")

AnyPairs ("bat", "cat", "cat")

7.

MULTIPLE SELECT QUESTION

45 sec • 1 pt

Media Image

The procedure NumOccurrences is intended to count and return the number of times targetWord appears in the list wordList. The procedure does not work as intended.

For which of the following code segments will the call to NumOccurrences NOT return the intended value?

Select two answers.

Media Image
Media Image
Media Image
Media Image

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?