• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/436

Click to flip

Use LEFT and RIGHT arrow keys to navigate between flashcards;

Use UP and DOWN arrow keys to flip the card;

H to show hint;

A reads text to speech;

436 Cards in this Set

  • Front
  • Back

Which operation does the symbol ** represent?

A) multiplication

B) division

C) integer division




D) exponentiation

E) modulo (remainder)

D)

Which operation does the symbol "/" represent?



A) multiplication



B) division



C) integer division



D) exponentiation



E) modulo (remainder)

B)

Which operation does the symbol // represent?




A)multiplication




B) exponentiation




C) division




D) modulo (remiander)




E) integer division

D)

Select the word(s) that are Python types.




A) expression




B) int




C) float




D) real

B), C)

When applied to two int operands, which operation always evaluates to type float?




A) multiplication




B) exponentiation




C) division




D) modulo (remainder)




E) integer division

C)

For expression 7 * 3 + 4 / 2, in which order are the operations evaluated?




A) *, +, /




B) +, *, /




C) *, /, +

C)

Select the expression(s) that result in a SyntaxError




A) 8 / (3 / (2 / 3)))




B) 6 + -2




C) 4 **




D) 5 * (3 + 2)

A), C)

Consider this code:




>>> a = 4


>>> b = 3.2


>>> a = 8




Assume that value 4 has memory address x27, value 3.2 has memory address x5, and value 8 has memory address x1. Which of the following is true after this code is executed?




A) a refers to value 4 and b refers to value 3.2




B) a stores x27 and b contains x5




C) a contains memory address x1 and b contains memory adddress x5




D) a refers to the same value as b

C)

Consider this code:




>>> z = 5


>>> y = z + 1


>>> z = 10




After these statements execute, which of the following describes the values that z and y point to?




A) z points to 5 and y points to 6




B) z points to 10 and y points to 6




C) z points to 10 and y points to 11




D) z and y both point to memory addresses

B)

Which of the following is not a legal variable name in Python?




A) TRIANGLEAREA




B) triangle_area




C) triangle's_area




D) triangle_area2

C)

What value does max(3, 4 + 5) produce?




A) 3




B) 4




C) 5




D) 4 + 5




E) 9

E)

Here is the help function ord:

Select the number of arguments that the function ord can take:

A) 0

B) 1

C) 2

D) 3

Here is the help function ord:




Select the number of arguments that the function ord can take:




A) 0




B) 1




C) 2




D) 3

B)

Here is the help function round:

Select the number of arguments that function round can take.

A) 0

B) 1

C) 2

D) 3

Here is the help function round:




Select the number of arguments that function round can take.




A) 0




B) 1




C) 2




D) 3

B), C)

Which of the following is an appropriate definition for the function double that returns two times the number it is passed?




A) def double(x):
return 2 * x

B) double(x) = return 2 * x

C) double(x) = 2 * x

D) def double(x):
2 * x

A)

The Python expression 9 / 3 produces the value 3.0, which has type float. For the expression 9 // 3, what value is produced and what type does it have?




A) 3.0 (type float)




B) 3 (type int)

B)

When the expression 10 / 4 is evaluated, what value is produced and what type does that value have?




A) 2 (type int)




B) 2.0 (type float)




C) 2.5 (type float)

C)

When the expression 10 // 4 is evaluated, what value is produced and what type does that value have?




A) 2 (type int)




B) 2.0 (type float)




C) 2.5 (type float)

A)

When the expression 10 // 3 is evaluated, what value is produced and what type does that value have?




A) 3 (type int)

B) 3.0 (type float)

C) 3.3 (type float)

D) 3.3333333333333335 (type float)

A)

When the expression 10 % 3 is evaluated, what value is produced and what type does that value have?


A) 1 (type int)

B) 0 (type int)

C) 1.0 (type float)

D) 0.3333333333333333 (type float)

A)

What does it mean that computational thinking is about conceptualizing not programming?

Computer science isn't computer programming




Requiring thinking at multiple levels of abstraction

What does it mean that computational thinking is about "a way that humans, not computers, think"?

Computational thinking is a way humans solve problems




It isn't trying to get human to think like computers

In Python Shell, what does the >>> symbol mean?

It is a prompt for typing

What is an int?

Integer, whole number (no decimals)

What is a float?

Floating point




Refers to a decimal point

What is integer division and how do you do it in Python?

Rounds down to nearest integer

Rounds down to nearest integer

What is a module and how do you do it in Python?

Gives remaineder of the divison

Gives remaineder of the divison

Why should a user be aware of negative operands when using integer division?

Python takes the floor of the result of an integer divion

Result is one smaller than you might expect if the result is negative 

Python takes the floor of the result of an integer divion




Result is one smaller than you might expect if the result is negative

Why should a user be aware of negative operands when using modulo division?

The sign of the result matches the sign of the divisor

The sign of the result matches the sign of the divisor

What is the equation that integer division and modulo comes from?



What does it mean that "negation is an unary operator"?

It applies to one operand 

It applies to one operand

What is an overloaded operator?

If an operator can be applied to more than one type of vlaue

What is the issue with finite precision in python?

The first value ends with 6
     and second with 7

Both should have an infinite
      number of 6s after the decimal

Problem with computer is
      that they have a finite amount of memory and most programming languages
      limit how much ...

The first value ends with 6 and second with 7




Both should have an infinite number of 6s after the decimal




Problem with computer is that they have a finite amount of memory and most programming languages limit how much information can be stored for any single number

What is numerical analysis?

The study of algorithms to approximate continuous mathematics




One of the largest subfields of computer science and mathematics

Choose the correct answer:




Assigninga value to a variable that already exist ___ create a second variable




A) does




B) does not

B)

Explain why and how this code works:

Explain why and how this code works:

First statement: difference is 20 and saved as memory address id1




Second statement: double difference so 40 saved as memory address id2




Third statement: Calls double (id2)




Fourth statement: difference changed to 5 and saved as id3 while variable double stays as id2




Fifth statement: Calls double which remains as id2 as has not yet been changed

What is a syntax error?

Happenswhen you type something that isn't valid

What is a semantic error?

Happenswhen you tell Python to do something that it just cannot do

How do you write comments in Python?

Using the # symbol

Using the # symbol

Does a value have or contain a memory address?

Have

Does a variable have or contain a memory address?

Contain

What does the Python function abs do?

Returns the absolute value of an arguement

What does the ord function do?

Return the integer ordinal of a one-character string

A valid surrogate pair is also accepted

Return the integer ordinal of a one-character string




A valid surrogate pair is also accepted

What does the pow function do?

Equivalent to x**y (with two arguments) or x**y%z (with three arguements)

Some types, such as ints, are able to use a more efficient algorithm when invoked using the three arguments form

Equivalent to x**y (with two arguments) or x**y%z (with three arguements)




Some types, such as ints, are able to use a more efficient algorithm when invoked using the three arguments form

What does the round function do?

Round a number to a given precision in decimal digits (default 0 digits)

This returns an nt when called with one argument, otherwise the same type as number

ndigits may be negative 

Round a number to a given precision in decimal digits (default 0 digits)




This returns an nt when called with one argument, otherwise the same type as number




ndigits may be negative

For which positive integers n does n % 2 produce 0?

A) No positive integers

B) All even positive integers

C) All odd positive integers

D) All positive integers

B)

For which positive integers n does n % 2 produce 1?

A) No positive integers

B) All even positive integers

C) All odd positive integers

D) All positive integers

C)

To indicate the order that operations are executed when the expression 3 + 5 * 2 is evaluated, rewrite the expression using parentheses.




A) ((3 + 5) * 2)




B) (3 + (5 * 2))

B)

To indicate To indicate the order that operations are executed when the expression 4 + 8 / 2 ** 2 / -2 is evaluated, rewrite the expression using parentheses.

A) ((((4 + 8) / 2) ** 2) / -2)




B) (4 + ((8 / 2) ** (2 / -2)))




C) (4 + ((8 / (2 ** 2))) / -2)




D) (4 + (8 / (2 ** (2 / -2))))

C)

What value does max(10.1, 13, 16) produce?




A) 10.1




B) 13




C) 16

C)

What value does abs(-5.2) produce?




A) 5




B) 5.0




C) 5.2

C)

What value does pow(2, 3) produce?




A) 2




B) 3




C) 8




D) 9

C)

What type of value does function round return?




A) int




B) float




C) number (either an int or a float)

C)

What is the lowest number of arguments function round takes?




A) 0




B) 1




C) 2




D) 3

B)

What is the greatest number of arguments function round takes?




A) 0




B) 1




C) 2




D) 3

C)

What value does round(1.6) produce?




A) 1




B) 2




C) 1.0




D) 2.0

B)

What value does round(3.14159, 2) produce?




A) 3




B) 3.0




C) 3.1




D) 3.14

D)

What value does round(1234.5678, -2) produce?




A) 1235




B) 1200




C) 1200.0




D) 1235.0

C)

What value does round(2.5) produce?




A) 2




B) 2.0




C) 3




D) 3.0

A)

Consider this code: k = 5. Select the assignment statement(s) that create a new variable j that refers to three times k’s value.




A) j = k * 3




B) k * 3 = j




C) j = k + k + k




D) k + k + k = j

A), C)

Consider this code:




x = 4


y = 5x = 2




After the code above is executed, to which values do x and y refer?




A) x refers to 4 and y refers to 5




B) x refers to 2 and y refers to 5

B)

Consider this code:




x = 4


y = x + 2


x = y + 1




After the code above is executed, to which values do x and y refer?




A) x refers to 4 and y refers to 6




B) x refers to 7 and y refers to 6




C) x refers to 7 and y refers to 9

B)

Consider this code:




x = 8 / 4




What value does x refer to?




A) 2




B) 2.0




C) 0.5




D) 1

B)

Consider this code:



x = 8 // 4



What value does x refer to?



A) 2.0



B) 4.0



C) 2



D) 1

C)

Consider this code:




x = 12 / 3




What value does x refer to?




A) 4




B) 4.0




C) 2




D) 1.0

B)

Consider this code:




x = 9 / 4




What value does x refer to?




A) 2.25




B) 2.2




C) 2.3




D) 2

A)

What type of value does built-in function id return? 

Determine the answer using the description given by help(id)

A) int

B) float

What type of value does built-in function id return?




Determine the answer using the description given by help(id)




A) int




B) float

A)

Select the function call(s) that run without error. Determine the answer using the description given by help(round), not by running the code.

A) round(45)

B) round()

C) round(45.8)

D) round(45.345, 2, 5)

E) round(45.345, 2)

Select the function call(s) that run without error. Determine the answer using the description given by help(round), not by running the code.




A) round(45)




B) round()




C) round(45.8)




D) round(45.345, 2, 5)




E) round(45.345, 2)

A), C), E)

Consider this code:




round(45.342)




What value does the expression above produce?




A) 45.342




B) 45.34




C) 45.3




D) 45

D)

Consider this code:




x = 3


y = 5


x = y




After the code above has executed, what value does x refer?




A) 3




B) 3.0




C) 5




D) 5.0

C)

Consider this code:




x = 3


y = 5


x = y




After the code above has executed, what value does x refer?




A) 3




B) 3.0




C) 5




D) 5.0

C)

Consider this code:




8 = x




When the code above is executed, what type of error occurs?




A) SyntaxError




B) NameError

A)

Consider this code:




apple = banana




When the code above is executed, what type of error occurs?




A) SyntaxError




B) NameError

B)

Consider this code:

Select the phrase that describes two.

A) an argument

B) a function name

C) a parameter

Consider this code:




Select the phrase that describes two.




A) an argument




B) a function name




C) a parameter

C)

Consider this code:

Select the phrase that describes two.

A) An argument

B) A function name

C) A parameter

Consider this code:




Select the phrase that describes two.




A) An argument




B) A function name




C) A parameter

C)

Consider the code:

How many parameters does function g have?

A) 0

B) 1

C) 2

D) 3

Consider the code:




How many parameters does function g have?




A) 0




B) 1




C) 2




D) 3

C)

Consider the code:

Select the phrase that describes value in the second line.

A) An argument

B) A parameter

C) A function name

Consider the code:




Select the phrase that describes value in the second line.




A) An argument




B) A parameter




C) A function name

A)

Select the statement(s) that will result in a SyntaxError.




A) earthquake_greeting = "I'm feeling a bit shaky"




B) earthquake_greeting = 'I'm feeling a bit shaky'




C) earthquake_greeting = "I\'m feeling a bit shaky"




D) earthquake_greeting = 'I\'m feeling a bit shaky'

B)

Consider this code:




print("ba" + "na" * 2 + "muffin")




What is printed?




A) bana2muffin




B) bananamuffin




C) banana muffin




D) banabanamuffin

B)

Consider this code:

What is the outcome of executing the code above?

A) new_result refers to the value 5

B) TypeError

Consider this code:




What is the outcome of executing the code above?




A) new_result refers to the value 5




B) TypeError

B)

Consider this code:

What is the outcome of executing the code above?

A) new_result refers to the value 5

B) TypeError

Consider this code:




What is the outcome of executing the code above?




A) new_result refers to the value 5




B) TypeError

A)

When a return statement executes, it passes a value back to the caller and exits the function. Consider this code:



What is printed by the code above?

A) hello

B) Nothing. The function exits when the return statement is executed, so the p...

When a return statement executes, it passes a value back to the caller and exits the function. Consider this code:




What is printed by the code above?




A) hello




B) Nothing. The function exits when the return statement is executed, so the print function call is never reached.

B)

What does the input function do in Python?

Gets a string from the user




The argument to input is called a prompt




The function puases until the user types a newline




The return value is the string the user typed

TRUE or FALSE




All return values from an input will be type string

TRUE

Consider this code:




age = input("How old are you? ")




After the code above has been executed and the user types 12 followed by Enter/Return, what type of value does variable age refer to?




A) bool




B) int




C) float




D) str

D)

Why would you use triple quote strings in Python?

Triple-quoted strings can span multiple lines

How would you print a newline in Python?

Using the escape sequence \n

How would you print a horizontal tab in Python?

Using escape sequence \t

How would you print a backslash in Python?

Using escape sequence \\

How would you print a single quote (') in Python?

\'

How would you print a double quote (") in Python?

\"

Consider this function call:




print("Strings are fun!", "Don't you think?")What is printed by this function call?




A) "Strings are fun! Don't you think?"




B) Strings are fun! Don't you think?




C) "Strings are fun!Don't you think?"




D) Strings are fun!Don't you think?

B)

Consider this function call:




print("\\n is the newline character in Python")




What is printed by this function call?




A) \\n is the newline character in Python




B) \


is the newline character in Python




C) \n is the newline character in Python

C)

Consider this function call:




print("this \n is the newline character in Python")




What is printed by this function call?




A) "this \n is the newline character in Python"




B) this \n is the newline character in Python




C) "this


is the newline character in Python"




D) this


is the newline character in Python

D)

The function count_vowels returns the number of vowels in a given word (a str). For example:



The Type Contract is the line of a docstring that describes the types of the parameters and return value. Select the correct Type Contract for t...

The function count_vowels returns the number of vowels in a given word (a str). For example:




The Type Contract is the line of a docstring that describes the types of the parameters and return value. Select the correct Type Contract for this function.




A) (str) -> int




B) (int) -> str




C) (string) -> integer




D) (integer) -> string

A)

Here are two example calls for the function count_vowels:




Which of the following would be the best name for the count_vowels parameter?




A) vowels




B) word




C) input




D) int

B)

Here is an incomplete docstring for function count_vowels:




Identify the problem(s) with the Description in the docstring above.




A) It doesn't say what the function returns.




B) It's too short.




C) It doesn't mention the type of the parameter




D) It doesn't mention the parameter by name.

A), D)

What is the receipe for designing functions in Python?



Recall function convert_to_celsius from the Design Recipe lecture. That function has one parameter representing a temperature in Fahrenheit and returns that temperature in Celsius. In the same file, we define another function:




Which of the following is the best choice for the function body?




A) temp2_celsius = convert_to_celsius(temp2)


return min(temp1, temp2_celsius)




B) temp2_celsius = (temp2 - 32) * 5 / 9


return min(temp1, temp2_celsius)

A)

The red arrow indicates the line that is about to be executed. What value does hours_asleep refer to at the current stage of execution?

A) 5

B) 0

C) 300

D) It's a trick question: hours_asleep has not yet been created.History

The red arrow indicates the line that is about to be executed. What value does hours_asleep refer to at the current stage of execution?




A) 5




B) 0




C) 300




D) It's a trick question: hours_asleep has not yet been created.History

D)

The red arrow indicates the line that is about to be executed. What value does hours_asleep refer to at the current stage of execution?

A) 5

B) 0

C) 300

D) result is not defined

The red arrow indicates the line that is about to be executed. What value does hours_asleep refer to at the current stage of execution?




A) 5




B) 0




C) 300




D) result is not defined

D)

The red arrow indicates the line that is about to be executed. What value does hours_asleep refer to at the current stage of execution?

A) 5

B) 0

C) 300

D) result is not defined

The red arrow indicates the line that is about to be executed. What value does hours_asleep refer to at the current stage of execution?




A) 5




B) 0




C) 300




D) result is not defined

D)





Function max_of_min takes four numbers, num1, num2, value1, and value2, determines the minimum of num1 and num2 and the minimum of value1 and value2, and returns the maximum of those two minimums.




What value does max_of_min(4, 3.7, 6, 3.5) produce?




A) 4




B) 3.7




C) 6




D) 3.5

B)

Function max_of_min takes four numbers, num1, num2, value1, and value2, determines the minimum of num1 and num2 and the minimum of value1 and value2, and returns the maximum of those two minimums.




What value does max_of_min(1, 1.7, 4.5, 3) produce?




A) 1




B) 1.7




C) 4.5




D) 3

D)



Write a code for a python function that takes an word and repeat a number of times:







The line with the red arrow (line 15) is about to be executed. After stepping through to the end of the code above (we can do this by pressing the Last button), how many variables (excluding those that refer to functions) will be on the stack? R...

The line with the red arrow (line 15) is about to be executed. After stepping through to the end of the code above (we can do this by pressing the Last button), how many variables (excluding those that refer to functions) will be on the stack? Recall that the stack is represented by the images on the right-hand side of the model. (If the image is too small, right-click on it and open it in a new browser tab. Then you can zoom in.)




A) 1




B) 2




C) 3




D) 4




E) 5

B)

A new module equilateral.py contains functions for equilateral triangles (triangles where all the sides have the same length). To use the functions from triangle.py in equilateral.py, which import statement should we use?




A) import triangle




B) import(triangle)




C) import triangle.py




D) import('triangle.py')

A)

Recall that triangle.py defines a function named area_hero. The code below results in an error:




NameError: global name 'area_hero' is not defined.




From the options below, select the return statement that calls area_hero correctly.




A) return triangle.area_hero(sidelength, sidelength, sidelength)




B) return area.area_hero(sidelength, sidelength, sidelength)




C) return triangle.py.area_hero(sidelength, sidelength, sidelength)

A)

Select the expression(s) that produce True.




A) 5.73 == 9.23




B) 5 >= 3




C) 6.0 != 6




D) 4 < 9

B), D)

When variables first and last refer to the same int value, select the expression(s) that produce True.




A) first != last




B) first >= last


C) first == last




D) last > first

B), C)

The minimum passing grade is 50. Variable grade refers to the grade for a student. Select the expression(s) that correspond with the English sentence:




"The student passed."




A) grade >= 50




B) not (grade < 50)




C) 50 >= grade




D) not not (grade >= 50)

A), B), D)

Consider this code:




>>> math_grade = 50


>>> history_grade = 85




After the code above is executed, which expression(s) produce True?




A) history_grade == math_grade




B) (math_grade >= 50) and (history_grade >= 50)




C) (math_grade > 50) and (history_grade > 50)




D) (math_grade > 50) or (history_grade > 50)

B), D)

The minimum passing grade is 50 and variables math_grade, bio_grade, and cs_grade represent a student's final grades in three courses. Here is a Boolean expression:




math_grade >= 50 or bio_grade >= 50 or cs_grade >= 50




Below are some English statements. Each may be true or may be false. Which English sentence is true exactly when the Boolean expression evaluates to True?




A) The student passed none of the courses.




B) The student passed at least one of the courses.




C) The student passed all of the courses.




D) The student passed some but not all of the courses.

B)

The minimum passing grade is 50, the minimum grade for "A" is 80 and variables math_grade, bio_grade, and cs_grade represent a student's final grades in three courses. Select the expression(s) that correspond with the English sentence:




"The student passed all their courses and earned at least one A".




A) ((math_grade >= 50 and bio_grade >= 50 and cs_grade >= 50) and (math_grade >= 80 or bio_grade >=80 or cs_grade >= 80))




B) math_grade >= 50 or math_grade >= 80) and (bio_grade >= 50 or bio_grade >= 80) and (cs_grade >= 50 or cs_grade >= 80)

A)

What value does the expression float(str(45)) produce?




A) 45




B) 45.0




C) '45.0'




D) An error occurs.

B)

What value does the expression str(int('99')) == '99' produce?




A) '99'




B) False




C) True




D) An error occurs.

C)

Consider this code:




Assuming the code above has been executed, choose the statement below that prints this: 6 siblings!




A) print((bro + sis) + sibs)




B) print(str(int(bro) + int(sis)) + sibs)




C) print(str(int(bro + sis)) + sibs)

B)

Hamming distance measures the similarity of two strings of the same length. It counts the number of positions at which the strings differ (e.g. "cat" and "bat" have hamming distance 1 because their first letters are different). Which of the follo...

Hamming distance measures the similarity of two strings of the same length. It counts the number of positions at which the strings differ (e.g. "cat" and "bat" have hamming distance 1 because their first letters are different). Which of the following is a good precondition for this function?


A) string1 and string2 are of type str.




B) string1 and string2 are not the same.




C) string1 and string2 have different lengths.




D) string1 and string2 have the same length.

D)

How many else statements can you have in a def?

0 or 1




Must be last clause

Consider this code:

When the code above is executed, what is printed?

A) It's pretty big.

B) It's not so big.

C) It's pretty big. 
It's not so big.  

Consider this code:




When the code above is executed, what is printed?




A) It's pretty big.




B) It's not so big.




C) It's pretty big.


It's not so big.

B)

Select the syntactically correct if statement(s).




A) if 18 < temp and temp < 26:


print("A comfortable temperature")


print("Let's go for a swim")




B) if 18 < temp and temp < 26:


print("A comfortable temperature")


else:


print("Be prepared for anything")


elif temp < 18:


print("Better bring a sweater")




C) if 18 < temp and temp < 26:


print("A comfortable temperature")


elif temp > 26:


print("It's quite warm in here")




D) if temp < 0:


print("It's toque weather!")

A), C), D)

Consider this code:

return temp == 22.5

Select the code fragment(s) that are equivalent to the one above.

Consider this code:




return temp == 22.5




Select the code fragment(s) that are equivalent to the one above.


B), C), D)

























None

'bonjour'

'hello'









None



grade1 and grade2 represent two grades (floats) between 0.0 and 100.0, inclusive. A passing grade is greater than or equal to 50.




Write the code fragment(s) that prints the average of the passing grade(s).




The printed value should be 0.0 if neither grade is a passing grade, the grade that passes if exactly one grade is a passing grade, and the average of the two grades if both are passing grades.

white_queen.lower().count("jam")









2











What does the Python command (isalnum) do?





What does str.isalpha() do in Python?



9

00112233445566778899





How would you create the following Python function?

Here is some additional information on the overall program:

"Most post-secondary institutions use some kind of computer system to help manage admissions. Often, these programs are used to hand...

How would you create the following Python function?




Here is some additional information on the overall program:




"Most post-secondary institutions use some kind of computer system to help manage admissions. Often, these programs are used to handle straightforward admissions cases, freeing up human time to work on the more complex ones. The purpose of the system you are working on is to determine if students meet cutoffs for admission to degree programs and for consideration for scholarships.




Admission to degrees is based on marks in high school courses a student has taken. In our admission program, we are given two marks for every course in a student's application. The first mark is their grade on coursework, and the second is their grade on the final exam. Their final mark in the course is the average of those two marks.




In the 2016-2017 academic year, post-secondary institutions in Alberta needed to update their admissions systems to handle a special group of incoming students. In May 2016, out-of-control wildfires forced the evacuation of about 90000 people from Fort McMurray, a city in northern Alberta. This included students who were in their final year of high school, preparing to write final exams. Due to the evacuation, most students were not able to write their exams.




To accommodate students in this special situation, post-secondary institutions in Alberta changed the admission criteria for these students; they would be admitted based on their coursework marks up to the evacuation, and not on the coursework plus exam mark typically used. These special criteria were only applied to students who came from particular schools in the affected year.




Each degree has its own cutoff for admission. Additionally, students whose average is 5% or more above the admission cutoff receive a scholarship. For example, if a degree has an admission cutoff of 80% then students with averages of 85% or more receive a scholarship."



How would you create the following Python function?

Here is some additional information on the overall program:

"Most post-secondary institutions use some kind of computer system to help manage admissions. Often, these programs are used to hand...

How would you create the following Python function?




Here is some additional information on the overall program:




"Most post-secondary institutions use some kind of computer system to help manage admissions. Often, these programs are used to handle straightforward admissions cases, freeing up human time to work on the more complex ones. The purpose of the system you are working on is to determine if students meet cutoffs for admission to degree programs and for consideration for scholarships.




Admission to degrees is based on marks in high school courses a student has taken. In our admission program, we are given two marks for every course in a student's application. The first mark is their grade on coursework, and the second is their grade on the final exam. Their final mark in the course is the average of those two marks.




In the 2016-2017 academic year, post-secondary institutions in Alberta needed to update their admissions systems to handle a special group of incoming students. In May 2016, out-of-control wildfires forced the evacuation of about 90000 people from Fort McMurray, a city in northern Alberta. This included students who were in their final year of high school, preparing to write final exams. Due to the evacuation, most students were not able to write their exams.




To accommodate students in this special situation, post-secondary institutions in Alberta changed the admission criteria for these students; they would be admitted based on their coursework marks up to the evacuation, and not on the coursework plus exam mark typically used. These special criteria were only applied to students who came from particular schools in the affected year.




Each degree has its own cutoff for admission. Additionally, students whose average is 5% or more above the admission cutoff receive a scholarship. For example, if a degree has an admission cutoff of 80% then students with averages of 85% or more receive a scholarship."



How would you create the following Python function?

Here is some additional information on the overall program:

"Most post-secondary institutions use some kind of computer system to help manage admissions. Often, these programs are used to hand...

How would you create the following Python function?




Here is some additional information on the overall program:




"Most post-secondary institutions use some kind of computer system to help manage admissions. Often, these programs are used to handle straightforward admissions cases, freeing up human time to work on the more complex ones. The purpose of the system you are working on is to determine if students meet cutoffs for admission to degree programs and for consideration for scholarships




.Admission to degrees is based on marks in high school courses a student has taken. In our admission program, we are given two marks for every course in a student's application. The first mark is their grade on coursework, and the second is their grade on the final exam. Their final mark in the course is the average of those two marks.




In the 2016-2017 academic year, post-secondary institutions in Alberta needed to update their admissions systems to handle a special group of incoming students. In May 2016, out-of-control wildfires forced the evacuation of about 90000 people from Fort McMurray, a city in northern Alberta. This included students who were in their final year of high school, preparing to write final exams. Due to the evacuation, most students were not able to write their exams.




To accommodate students in this special situation, post-secondary institutions in Alberta changed the admission criteria for these students; they would be admitted based on their coursework marks up to the evacuation, and not on the coursework plus exam mark typically used. These special criteria were only applied to students who came from particular schools in the affected year.




Each degree has its own cutoff for admission. Additionally, students whose average is 5% or more above the admission cutoff receive a scholarship. For example, if a degree has an admission cutoff of 80% then students with averages of 85% or more receive a scholarship."



How would you create the following Python function?

Here is some additional information on the overall program:

"Most post-secondary institutions use some kind of computer system to help manage admissions. Often, these programs are used to hand...

How would you create the following Python function?




Here is some additional information on the overall program:




"Most post-secondary institutions use some kind of computer system to help manage admissions. Often, these programs are used to handle straightforward admissions cases, freeing up human time to work on the more complex ones. The purpose of the system you are working on is to determine if students meet cutoffs for admission to degree programs and for consideration for scholarships.




Admission to degrees is based on marks in high school courses a student has taken. In our admission program, we are given two marks for every course in a student's application. The first mark is their grade on coursework, and the second is their grade on the final exam. Their final mark in the course is the average of those two marks.




In the 2016-2017 academic year, post-secondary institutions in Alberta needed to update their admissions systems to handle a special group of incoming students. In May 2016, out-of-control wildfires forced the evacuation of about 90000 people from Fort McMurray, a city in northern Alberta. This included students who were in their final year of high school, preparing to write final exams. Due to the evacuation, most students were not able to write their exams.




To accommodate students in this special situation, post-secondary institutions in Alberta changed the admission criteria for these students; they would be admitted based on their coursework marks up to the evacuation, and not on the coursework plus exam mark typically used. These special criteria were only applied to students who came from particular schools in the affected year.




Each degree has its own cutoff for admission. Additionally, students whose average is 5% or more above the admission cutoff receive a scholarship. For example, if a degree has an admission cutoff of 80% then students with averages of 85% or more receive a scholarship."



How would you create the following Python function?

Here is some additional information on the overall program:

"Most post-secondary institutions use some kind of computer system to help manage admissions. Often, these programs are used to hand...

How would you create the following Python function?




Here is some additional information on the overall program:




"Most post-secondary institutions use some kind of computer system to help manage admissions. Often, these programs are used to handle straightforward admissions cases, freeing up human time to work on the more complex ones. The purpose of the system you are working on is to determine if students meet cutoffs for admission to degree programs and for consideration for scholarships.




Admission to degrees is based on marks in high school courses a student has taken. In our admission program, we are given two marks for every course in a student's application. The first mark is their grade on coursework, and the second is their grade on the final exam. Their final mark in the course is the average of those two marks.




In the 2016-2017 academic year, post-secondary institutions in Alberta needed to update their admissions systems to handle a special group of incoming students. In May 2016, out-of-control wildfires forced the evacuation of about 90000 people from Fort McMurray, a city in northern Alberta. This included students who were in their final year of high school, preparing to write final exams. Due to the evacuation, most students were not able to write their exams.




To accommodate students in this special situation, post-secondary institutions in Alberta changed the admission criteria for these students; they would be admitted based on their coursework marks up to the evacuation, and not on the coursework plus exam mark typically used. These special criteria were only applied to students who came from particular schools in the affected year.




Each degree has its own cutoff for admission. Additionally, students whose average is 5% or more above the admission cutoff receive a scholarship. For example, if a degree has an admission cutoff of 80% then students with averages of 85% or more receive a scholarship."



How would you create the following Python function?

Here is some additional information on the overall program:

"Most post-secondary institutions use some kind of computer system to help manage admissions. Often, these programs are used to hand...

How would you create the following Python function?




Here is some additional information on the overall program:




"Most post-secondary institutions use some kind of computer system to help manage admissions. Often, these programs are used to handle straightforward admissions cases, freeing up human time to work on the more complex ones. The purpose of the system you are working on is to determine if students meet cutoffs for admission to degree programs and for consideration for scholarships.




Admission to degrees is based on marks in high school courses a student has taken. In our admission program, we are given two marks for every course in a student's application. The first mark is their grade on coursework, and the second is their grade on the final exam. Their final mark in the course is the average of those two marks.




In the 2016-2017 academic year, post-secondary institutions in Alberta needed to update their admissions systems to handle a special group of incoming students. In May 2016, out-of-control wildfires forced the evacuation of about 90000 people from Fort McMurray, a city in northern Alberta. This included students who were in their final year of high school, preparing to write final exams. Due to the evacuation, most students were not able to write their exams.




To accommodate students in this special situation, post-secondary institutions in Alberta changed the admission criteria for these students; they would be admitted based on their coursework marks up to the evacuation, and not on the coursework plus exam mark typically used. These special criteria were only applied to students who came from particular schools in the affected year.




Each degree has its own cutoff for admission. Additionally, students whose average is 5% or more above the admission cutoff receive a scholarship. For example, if a degree has an admission cutoff of 80% then students with averages of 85% or more receive a scholarship."






















20

temperatures[-1]



"AliceBobCarol"

In Python, what does list.append(object) do?

Append object to end of the list

In Python, what does list.extend(list) do?

Append the items in the list parameter to the list

In Python, what does list.pop() do?

Remove and return item at the end of the list




Optional index to remove from anywhere

In Python, what does list.remove(object) do?

Remove the first occurrence of the object




Error if not there

In Python, what does list.reverse() do?

Reverse the list

In Python, what does list.sort() do?

Sort the list from smallest to largest

In Python, does what list.insert(int, object) do?

Insert object at the given index, moving items to make room

In Python, what does list.count(object) do?

Return the number of times object occurs in the list

In Python, what does list.index(object) do?

Return the index of the first occurence of object




Error if not there





[60, 95, 70, 80, 90]

In Python, what is aliasing?

When two or more variables refer to the same object

4

20

Python raises an error

range(2, 11, 2)



Create this function:

Create this function:



The last iteration will cause an error because i + 1 is an illegal index.

range(1, len(s))

['y', 'y', 'x', 'w']

[7]

[3, 6]

It will raise an error as a result of an illegal index.

None of the above.



['carrot', 'celery', 'broccoli', 'potato', 'asparagus']

letters.sort()

Return a list containing every third item from L starting at index 0.







3

numbers[2][0]



35

50

values[1][1]

treats[-3][-1]

15









a == [0, 1, 8]



What does the python id built-in function do?













data[1][0]



len(teams) - 1



What would this statement print?

What would this statement print?

When should you use the readline approach when reading a file?

When you want to process only part of a file

Give an example code of how to use the readline approach when reading a file?



Whens hould you use the "for line in file" approach to reading files?

When you want to process every line in the file at one time

Give an example code of how to use the "for line in file" approach when reading a file?



When should you use the read approach when reading a file?

When you want to read the whole file at once and use it as a single string

Give an example of how to use the read approach:



When should you use the readlines approach when reading a file?

When you want to examine each line of a file by index

Give an example of how to use the readlines approach:





































30

prints all lines

prints every line except the first

prints every second line

prints only the first line

Seed: $10/monthCage: $50







No

Yes



Yes

No

No

No

No

No

No

Yes

The express checkout is for grocery orders with 8 or fewer items

The express checkout is for grocery orders with 8 or fewer items







[['a', 'b'], ['d', 'e', 'f', 'g'], ['h']]

list of str





The file has been opened for reading, not writing









(file open for reading, int, int) -> str







2

4.0

str





animals

math.sqrt(math.pi)









def is_not_zero():

In Python, what is self?

self refers to the object that the method is being called on

Write the equivalent unittest for this doctest function divisors.py :

Write the equivalent unittest for this doctest function divisors.py :





5



age refers to 18





test_can_afford











Boundaries, because each of the three units should be tested at the freezing point of water







The number of steps grows linearly with respect to len(s).

The number of steps is constant.

The number of steps grows linearly with respect to len(L).

1



50,000





Binary search requires the list to be sorted.

6

math.log(1024, 2) produces 10.0. What does math.log(2048, 2) produce?

11.0

What does it mean to profile something in Python?

To measure the code for speed and/or memory use

append

gather_every_kth

[2, 2, 3, 1, 4, 5, 7]

3 passes

[3, 4, 5, 6, 8, 10, 7]

2

[1, 2, 4, 5, 3, 1]

Consider this list: [3, 6, 7, 4, 9, 5]




What is the maximum number of passes of insertion sort that could have been completed?

3

m + n

m * n

[7, 6, 5, 4, 3, 2]

The largest item

The smallest item will be at index 0.

They are sorted relative to each other.

k

k

k

k/2

4

k^2

k^2

10k

selection sort

bubble sort

insertion sort







2

Four times

10

What is an assignment statement in Python?

An assignment statement evaluates the expression list (remember that this can be a single expression or a comma-separated list, the latter yielding a tuple) and assigns the single resulting object to each of the target lists, from left to right




(Where you would find an = in the code)

i times

2i + 2

Linear

len(L) - 1

For the call insertion_sort(L), in the worst case, write a formula expressing how many comparisons are made during all the calls to insert. Let len(L) be represented by n.

n^2

n - i - 1

No

In terms of the number of items in the unsorted section, does get_index_of_smallest have constant running time, linear running time, quadratic running time, or some other running time?

In terms of the number of items in the unsorted section, does get_index_of_smallest have constant running time, linear running time, quadratic running time, or some other running time?

Linear

len(L) - 1







50 dollars

15 dollars





A dictionary of {str: int}: each key represents a denomination and each value represents how many of that denomination are in the cash register.

__floor__

__floordiv__







The Grand Optimist





apply(max, lst)

[10, 12]

22



The value 5 will be printed.





Write a class called Widget with an __init__ method. Each Widget should have an instance variable called name and an instance variable called cost that represents a cost in dollars; those values are passed in when a Widget is created. Also write a method in class Widget called is_cheap, which returns True if the cost is less than $10, and False otherwise.



5, 4, 3, 2, 1blast off!

letter_opening('Santa', title='Mr.')



yes-and-no!!!yes-and-no!!!















You are analyzing the results of the admissions process and you have two parallel lists of information about each student. The first list indicates whether or not the student was eligible for admission under the special case rules (stored as a string, either "SC" or "non-SC" and the second list has their average final mark (stored as an int). The lists are in the same order. In other words, a particular student occurs at the same index in both lists.




The group you want to analyze is the students admitted (average final mark at least 65) under the special case rules. The first step is to count how many students fit these criteria, to see if there are enough to run statistical tests.




Write a function count_admitted_sc that returns the number of students admitted under the special case rules. Your function should take the special case / non-special case list as the first parameter and the admissions status list as the second.




Write your own docstring.