Anda di halaman 1dari 19

Question 1

3 out of 3 points

The ______________ coding scheme is a worldwide standard for representing the characters of many of the world's languages. Answer Selected Answer: Unicode Correct Answer: Unicode

Question 2
3 out of 3 points

Which computer language uses short words known as mnemonics for writing programs? Answer Selected Answer: Assembly Correct Answer: Assembly

Question 3
3 out of 3 points

Which of the following is not an example of operating system software? Answer Selected Answer: Microsoft Word Correct Answer: Microsoft Word

Question 4
3 out of 3 points

Programs that make a computer useful for everyday tasks are known as ___________. Answer Selected Answer:

Application Software Correct Answer: Application Software

Question 5
3 out of 3 points

What is the encoding technique called that is used to store negative numbers in the computers memory? Answer Selected Answer: Twos complement Correct Answer: Twos complement

Question 6
3 out of 3 points

The following is an example of an instruction written in which computer language? 10100001 Answer Selected Answer: Machine language Correct Answer: Machine language

Question 7
3 out of 3 points

A(n) ___________ is a set of instructions that a computer follows to perform a task. Answer Selected Answer: program Correct Answer: program

Question 8
3 out of 3 points

The process known as the ___________ cycle is used by the CPU to execute instructions in a program. Answer Selected Answer: Fetch-decode-execute Correct Answer: Fetch-decode-execute

Question 9
3 out of 3 points

Real numbers are encoded using the ________ technique. Answer Selected Answer: floating point Correct Answer: floating point

Question 10
3 out of 3 points

What is the largest value that can be stored in one byte? Answer Selected Answer: 255 Correct Answer: 255

Question 11
3 out of 3 points

Use what you've learned about the binary numbering system in this chapter to convert the binary number (1101) to decimal. Answer Selected Answer: 13

Correct Answer: 13

Question 12
3 out of 3 points

While a program is running, the computer stores the program as well as the data that the program is working with in what part of the computer? Answer Selected Answer: main memory Correct Answer: main memory
Sunday, May 27, 2012 2:41:52 PM EDT

Question 1
2 out of 2 points

Which of the following is not a variable data type in Python? Answer Selected Answer: Number Correct Answer: Number

Question 2
2 out of 2 points

What type of symbol can be used in Python to mark the beginning and end of a string? Answer Selected Answer: Quotation Correct Answer: Quotation

Question 3
0 out of 2 points

In the Celsius to Fahrenheit Temperature Converter project, what is the correct method to compute the equivalent fahrenheit temperature? Assume that the variable celsius contains the original input temperature in degrees Celsius. Answer Selected Answer: # Compute the equivalent temperature in Fahrenheit fahrenheit = 1.8 celsius + 32

Correct Answer: # Compute the equivalent temperature in Fahrenheit fahrenheit = 9.0 / 5.0 * celsius + 32

Question 4
2 out of 2 points

True/False: The expressions (a + b) / c and a + b / c will always yield identical results. Answer Selected Answer: Correct Answer: False False

Question 5
2 out of 2 points

True/False: In most computer languages, the first character of a variable name cannot be a numeric digit (that is, 0, 1, 2, 9). Answer Selected Answer: Correct Answer: True True

Question 6
2 out of 2 points

In the Total of items in a shopping cart project, what is the correct method to compute the sales tax? Assume that the variable subtotal contains the correct sum for the five purchased items. Answer Selected Answer:

# compute the sales tax SALES_TAX_RATE = 0.06 tax = subtotal * SALES_TAX_RATE Correct Answer: # compute the sales tax SALES_TAX_RATE = 0.06 tax = subtotal * SALES_TAX_RATE

Question 7
2 out of 2 points

The value of the expression 12 4 * 3 / 2 + 9 is _________. Answer Selected Answer: 15 Correct Answer: 15

Question 8
2 out of 2 points

What is the informal language that programmers use to create models of programs that have no syntax rules and are not meant to be compiled or executed? Answer Selected Answer: Pseudocode Correct Answer: Pseudocode

Question 9
2 out of 2 points

The following is an example of what type of statement: Set rate = 5.75 Answer Selected Answer:

Assignment Correct Answer: Assignment

Question 10
2 out of 2 points

A(n) _______________ variable is one that has been declared, but has not been initialized or assigned a value. Answer Selected Answer: uninitialized Correct Answer: uninitialized

Question 1
2 out of 2 points

What is the term used for the variable that receives an argument that passed into a module? Answer Selected Answer: Parameter Correct Answer: Parameter

Question 2
2 out of 2 points

Passing an argument by ________ means that only a copy of the argument's value is passed into the parameter variable. Answer Selected Answer: Value Correct Answer: Value

Question 3
2 out of 2 points

In the Paint Job Estimator project, identify an acceptable header for the definition of a Python module used to compute and show the estimate of the painting work. Answer Selected Answer: def showPaintingEstimate(wall_area, paint_cost_per_gallon):

Correct Answer:

def showPaintingEstimate(wall_area, paint_cost_per_gallon):

Question 4
2 out of 2 points

The following is an example from Python of a module _________________. showSalesTaxDue( 110932.0 ) Answer Selected Answer: Call (or execution) Correct Answer: Call (or execution)

Question 5
2 out of 2 points

Function is another name for _____________. Answer Selected Answer: Module Correct Answer: Module

Question 6
2 out of 2 points

In the Monthly Sales Tax project, identify acceptable Python

code that interactively inputs the monthly sales and passes it as an argument by calling a "sales tax" module. Answer Selected Answer: sales = input("Please enter the monthly sales (eg, 25000): ") showSalesTaxReport(sales)

Correct Answer:

sales = input("Please enter the monthly sales (eg, 25000): ") showSalesTaxReport(sales)

Question 7
2 out of 2 points

According to the BMI information at the cdc.gov web page http://www.cdc.gov/healthyweight/assessing/bmi/adult_bmi/index.html the BMI is calculated by dividing weight in pounds by height in inches squared and multiplying by a conversion factor of 703. Choose the Python code at the COMPLETE THE COMPUTATION comment below that gets this correct. # define a function to compute and display Body Mass Index # citation: # http://www.cdc.gov/healthyweight/assessing/bmi/adult_bm i/index.html # Parameters: # weight is in lbs # height_ft is the WHOLE part of height in feet # height_in is the FRACTIONAL part of height in remaining inches # def showBodyMassIndex(weight, height_ft, height_in): # define named constants used by the BMI calculation BMI_EN = 703.0 # needed to convert from English units to metric INCHES_PER_FOOT = 12.0

# COMPLETE THE COMPUTATION Answer Selected Answer: # COMPLETE THE COMPUTATION height = height_ft * INCHES_PER_FOOT + height_in bmi = weight * BMI_EN / (height * height)

Correct Answer:

# COMPLETE THE COMPUTATION height = height_ft * INCHES_PER_FOOT + height_in bmi = weight * BMI_EN / (height * height)

Question 8
2 out of 2 points

A pass by _________ argument means that the argument is passed into a parameter that will reference (as an alias) the content of the argument in the module. Answer Selected Answer: Reference Correct Answer: Reference

Question 9
2 out of 2 points

Which type of variable is not recommended to be used in programs because they make programs hard to understand and debug? Answer Selected Answer: Global Correct Answer: Global

Question 10
2 out of 2 points

Which type of variable is visible to every module and the entire program? Answer Selected Answer: Global Correct Answer: Global
Saturday, June 23, 2012 2:21:52 AM EDT

What type of operator is used in Python to determine whether a specific relationship exists between two values? (for example, greater than, less than, equality, etc.) Answer Selected Answer: Relational Correct Answer: Relational

Question 2
2 out of 2 points

Which operator is best to determine whether a variable x contains a value in the range of 10 through 57? Answer Selected Answer: and Correct Answer: and

Question 3
0 out of 2 points

In the Color Mixer project, if the user enters anything other than a primary color (for example, the color purple), then the program should display an error message. Of the following Python code fragments, identify the correct implementation to detect an invalid color input. Answer

Selected Answer:

c1 = raw_input("Enter a primary color (eg, red, blue or yellow): ") # check that c1 is a primary color, and if not, display an error msg if not( c1 == red or c1 == blue or c1 == yellow ): print "Sorry, but", c1, "is not a primary color."

Correct Answer:

c1 = raw_input("Enter a primary color (eg, red, blue or yellow): ") # check that c1 is a primary color, and if not, display an error msg if not( c1 == "red" or c1 == "blue" or c1 == "yellow" ): print "Sorry, but", c1, "is not a primary color."

Question 4
2 out of 2 points

Which of the following is a logical (boolean) operator in Python? Answer Selected Answer: and Correct Answer: and

Question 5
2 out of 2 points

In the Shipping Charges project, identify acceptable Python code to handle the third row of the shipping charges table, shown here: Weight of Package Rate per Pound 2 pounds or less $1.10 Over 2 pounds, but not more than 6 pounds $2.20 Over 6 pounds, but not more than 10 pounds $3.70 Over 10 pounds $3.80 Answer

Selected Answer: elif weight > 6 and weight <= 10: rate_per_lb = 3.7 Correct Answer: elif weight > 6 and weight <= 10: rate_per_lb = 3.7

Question 6
2 out of 2 points

Which operator is used in Python to determine that the operands are not of the same exact value? Answer Selected Answer: != Correct Answer: !=

Question 7
0 out of 2 points

The _________ operator in Python is a unary operator as it works with only one operand. Answer Selected Answer: or Correct Answer: not

Question 8
2 out of 2 points

Problem #10 (page 161), the enhanced Body Mass Index (BMI) program, states that a sedentary person's weight is considered to be optimal if his or her BMI is between 18.5 and 25. If the BMI is less than 18.5, the person is considered to be underweight.

If the BMI value is greater than 25, the person is considered to be overweight. Identify the correct Python code fragment for the interpretation of the BMI value: Answer Selected Answer: # display the proper message based on the BMI print "BMI interpretation: ", if (bmi < 18.5): print "underweight." elif (bmi <= 25): print "optimal." else: print "overweight." Correct Answer: # display the proper message based on the BMI print "BMI interpretation: ", if (bmi < 18.5): print "underweight." elif (bmi <= 25): print "optimal." else: print "overweight."

Question 9
2 out of 2 points

What type of operators are the following in Python? > Answer Selected Answer: Relational Correct Answer: Relational

<

>=

<=

==

!=

Question 10
2 out of 2 points

In the Python example program paycheck_with_if.py, the paycheck is computed using an if else statement. Conditional logic code using if else

statements can be replaced with a single if statement, using a strategy sometimes called act first, check later. Here that can be applied by first computing the paycheck while assuming either overtime (or no overtime), and then to check the overtime assumption and, if necessary, change the computed paycheck. Which of the following Python code fragments is a correct implementation of this coding strategy: Answer Selected Answer: # ------- "act first, check later": an if else replacement ----------# compute the paycheck, assuming no overtime work paycheck = wage * hours if hours > 40: # overtime paycheck calculation, assumming time-and-a-half for over # 40 hours of labor paycheck = 40.0 * wage + (hours - 40) * wage * 1.5 print "Overtime added"

Correct Answer:

# ------- "act first, check later": an if else replacement ----------# compute the paycheck, assuming no overtime work paycheck = wage * hours if hours > 40: # overtime paycheck calculation, assumming time-and-a-half for over # 40 hours of labor paycheck = 40.0 * wage + (hours - 40) * wage * 1.5 print "Overtime added"

Instructions
false

Question 1
2 out of 2 points

What is the term used for the variable that is defined in the header of a module DEFINITION and that receives a value from a module call?

Answer Selected Answer: Parameter Correct Answer: Parameter

Question 2
2 out of 2 points

In pseudocode, the following is an example of what type of statement: Set rate = 5.75 Answer Selected Answer: Assignment Correct Answer: Assignment

Question 3
2 out of 2 points

The following is an example of an instruction written in which computer language? 10110000 Answer Selected Answer: Machine language Correct Answer: Machine language

Question 4
2 out of 2 points

Programs that make a computer useful for everyday tasks are known as ___________. Answer Selected Answer: Application Software

Correct Answer: Application Software

Question 5
2 out of 2 points

First of all, re-download the chapter ZIP notes for chapter 4. Examine the solution to the Magic Dates project (#4, page 160). The code shows that it's possible to write selection logic for a true/false alternative with either a simple if else statement or by using a programming strategy that I refer to as Act first, check later. In the following, identify the Python code fragment that correctly implements an Act first, check later strategy to compute the area of a geometric figure. Assume that the variable figure is either the string "rectangle" or the string "triangle", and that the dimensions of the figure are stored in the variables height and base. Answer Selected Answer: # assume that the figure is a rectangle area = height * base if (figure == "triangle"): area = 0.5 * height * base print figure, "has area of", area Correct Answer: # assume that the figure is a rectangle area = height * base if (figure == "triangle"): area = 0.5 * height * base print figure, "has area of", area

Question 6
2 out of 2 points

In Python, a good statement to use for writing the letter grade example from your textbook on page 141, Program 4-7, is: Answer Selected Answer: if elif

Correct Answer: if elif

Question 7
2 out of 2 points

In the following partial Python program, there is a variable scope mistake that prevents the sales tax calculations from being done. What is the mistake? def showSalesTaxReport(monthly_sales): # define named constants used by the tax calculation COUNTY_TAX_RATE = 0.02 STATE_TAX_RATE = 0.04 # do the computations county_sales_tax = COUNTY_TAX_RATE * sales state_sales_tax = STATE_TAX_RATE * sales total_sales_tax = county_sales_tax + state_sales_tax # display the results # define the main function showing the use of the showPropertyTax function def main(): sales = input("Please enter the monthly sales (eg, 25000): ") showSalesTaxReport(sales) Answer Selected Answer: The variable sales is local in scope to the main() module, so it cannot be used as shown in the showSalesTaxReport() module.

Correct Answer:

The variable sales is local in scope to the main() module, so it cannot be used as shown in the showSalesTaxReport() module.

Question 8
2 out of 2 points

In a module call, passing an argument by ________ means that only a COPY of

the argument's value is passed into the parameter variable. Answer Selected Answer: Value Correct Answer: Value

Question 9
2 out of 2 points

What category of programming statements can be considered a logical design that controls the order in which a set of statements executes? Answer Selected Answer: Decision Correct Answer: Decision

Question 10
2 out of 2 points

Which error produces incorrect results but does not prevent the program from running? Answer Selected Answer: logic Correct Answer: logic