PythonMTA (1).pdf
Document Details
2018
Microsoft
Tags
Full Transcript
全国大学生计算机应用能力与信息素养大赛 第4部分 大数据技术与应用赛项工具 Python 模拟题(英文版) Introduction to Programming Using Python © 2018 Microsoft Corporation. All rights reserved. Welcome Welcome to this Microsoft Certification exam. The following information is provided to help you use y...
全国大学生计算机应用能力与信息素养大赛 第4部分 大数据技术与应用赛项工具 Python 模拟题(英文版) Introduction to Programming Using Python © 2018 Microsoft Corporation. All rights reserved. Welcome Welcome to this Microsoft Certification exam. The following information is provided to help you use your exam time most efficiently. Exam Format and Question Formats This exam session includes multiple sections. You will see introductory sections, the exam content, and post-exam sections. This exam might contain several question formats. The Help button located at the bottom of each question screen provides information on the question format shown. Case Studies This exam might contain case studies. If there are case studies, the number of cases is provided in the “Get ready to take the exam!” screen. We no longer time each case study separately. In other words, the amount of time you are given to complete this exam can be used at your discretion. You can spend as much time as you like on any given case or question; manage your time to ensure that you are able to complete all questions included on this exam in the time provided. · 188 · 官方网站:www.51ds-2016.org 院校赛各比赛项目介绍、选拔考试说明及模拟练习题 1. Question 01 Evaluate the following Python arithmetic expression: (3*(1+2)**2 - (2**2)*3) What is the result? Answer Area A. 3 B. 13 C. 15 D. 69 2. Question 02 Northwind Traders has hired you as an intern on the coding team that creates e- commerce applications. You must write a script that asks the user for a value. The value must be used as a whole number in a calculation, even if the user enters a decimal value. You need to write the code to meet the requirements. Which code segment should you use? Answer Area A. totalltems = int(input(”How many items would you like?”)) B. totalltems = str(input(”How many items would you like?”)) C. totalltems = float(input(”How many items would you like?”)) D. totalltems = input(”How many items would you like?”) 3. Question 03 You are creating a Python program that shows a congratulation message to employees on their service anniversary. You need to calculate the number of years of service and print a congratulatory message. You have written the following code. Line numbers are included for reference only. 01 start = input(”How old were you on your start date?) 02 end = input(’How old are you today?”) 03 You need to complete the program. Which code should you use at line 03? Answer Area A. print(“congratulations on “ + int(end - start) + “ years of service!”) B. print(“congratulations on “ + (int(end) - int(start)) + “ years of service!”) C. print(“congratulations on “ + str(end - start) + “ years of service!”) D. print(”congratulations on “ + str(int(end) - int(start)) + “ years of service!”) 公众微信号:DS_51ds · 189 · 全国大学生计算机应用能力与信息素养大赛 4. Question 04 You develop a Python application for your company. You want to add notes to your code so other team members will understand it What should you do? Answer Area A. Place the notes after the last line of code separated by a blank line. B. Place the notes inside of parentheses on any line. C. Place the notes after the # sign on any line. D. Place the notes before the first line of code separated by a blank line. 5. Question 05 You are writing an application that uses the sqrt function. The program must reference the function using the name squareRoot. You need to import the function. Which code segment should you use? Answer Area A. from math import sqrt as squareRoot B. from math.sqrt as squareRoot C. import math.sqrt as squareRoot D. import sqrt from math as squareRoot 6. Question 06 This question requires that you evaluate the underlined text to determine if it is correct. You write the following code: import sys try: file_in = open(”in.txt”, ‘r’) file_out = open(”out.txt”, ‘w+’) except lOError: print(’cannot open’, file_name) else: i = 1 for line in file_in: print(line. rstrip()) file_out.write(”line “ + str(i) + “: “ + line) i = i + 1 file_in.close() file_out.close () The out.txt file does not exist. You run the code. The code will execute without error. Review the underlined text. If it makes the statement correct, select “No change is needed.” If the statement is incorrect, select the answer choice that makes the statement correct. · 190 · 官方网站:www.51ds-2016.org 院校赛各比赛项目介绍、选拔考试说明及模拟练习题 Answer Area A. No change is needed. B. The code runs, but generates a logic error. C. The code will generate a runtime error. D. The code will generate a syntax error. 7. Question 07 You are writing a Python program to automate inventory. Your first task is to read a file of inventory transactions. The file contains sales from the previous day, including the item id, price, and quantity. The following shows a sample of data from the file: 10, 200, 5 20, 100, 1 The code must meet the following requirements:. Each line of the file must be read and printed. If a blank line is encountered, it must be ignored. When all lines have been read, the file must be closed You create the following code. Line numbers are included for reference only. 01 inventory = open(”inventory.txt”, ‘r’) 02 eof = False 03 while eof == False: 04 line = inventory.readline() 05 06 07 print(line) 08 else: 09 print (“End of file”) 10 eof = True 11 inventory,close() Which code should you write for line O5 and line 06? Answer Area A. 05 if line != ‘‘: 06 if line !=””: B. 05 if line != ‘\n’: 06 if line != None: C. 05 if line != ‘\n’: 06 if line != “”: D. 05 if line != ‘‘: 06 if line != “\n”: 公众微信号:DS_51ds · 191 · 全国大学生计算机应用能力与信息素养大赛 8. Question 08 Tailspin Toys uses Python to control its new toy Happy Clown. The program has errors that cause the clown to run around in an infinite circle. You have been hired to help debug the following Happy Clown code. Line numbers are included for reference only. 01 import math 02 #default motion for happy clown 03 power = True 04 move = 0 05 while(power): 06 if move == 0: 07 turnValue = math.pi/move 08 move+=5 09 else: 10 turnValue = 0 11 move = 0 Which error exists in the code? Answer Area A. Line 05 has a syntax error because it should read (power == True). B. Line 08 has a syntax error because + = is an invalid statement. C. Line 07 causes a runtime error due to division by zero. D. Line 05 causes a runtime error because the expression is incomplete. 9. Question 09 Woodgrove Bank is migrating their legacy bank transaction code to Python. You have been hired to document the migrated code. Which documentation syntax is correct? Answer Area A. Returns the current balance of the bank account def get_balance(): return balance B. def get_balance(): return balance C. //Returns the current balance of the bank account def get_balance(): return balance D. def get_balance(): #Returns the current balance of the bank account return balance · 192 · 官方网站:www.51ds-2016.org 院校赛各比赛项目介绍、选拔考试说明及模拟练习题 10. Question 10 You develop a Python application for your company. You need to accept input from the user and print that information to the user screen. You have started with the following code. Line numbers are included for reference only. 01 print(“What is your name?”) 02 03 print(name) Which code should you write at line 02? Answer Area A. name = input B. input(name) C. name = input() D. input(”name”) 11. Question 11 You develop a Python application for your school. You need to read and write data to a text file. If the file does not exist it must be created. If the file has content the content must be removed. Which code should you use? Answer Area A. open(“local_data”, “r+”) B. open(“local_data”, “w+”) C. open(“local_data”, “r”) D. open(“local_data”, “w”) 12. Question 12 You evaluate the following code: numList = [0,1,2,3,4] print(5 in numList) What is the output of the print statement? Answer Area A. 4 B. False C. True D. 5 公众微信号:DS_51ds · 193 · 全国大学生计算机应用能力与信息素养大赛 13. Question 13 A classmate has asked you to debug the following code: x = 4 while x >= 1: if x % 4 == 0: print (“party”) elif x - 2 < 0: print(”cake”) elif x / 3 == 0: print(”greeting”) else: print(”birthday”) x = x - 1 What is the output that is printed to the screen? Answer Area A. birthday party greeting cake B. party birthday birthday cake C. party greeting birthday cake D. birthday greeting party cake 14. Question 14 You write the following code: list_1 = [1, 2] list_2 = [3, 4] list_3 = list_1 + list_2 list_4 = list_3 * 3 print(list_4) You run the code. What is the output value? · 194 · 官方网站:www.51ds-2016.org 院校赛各比赛项目介绍、选拔考试说明及模拟练习题 Answer Area A. [3, 6, 9, 12] B. [1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4] C. [[1, 2], [3, 4], [1, 2], [3, 4], [1, 2], [3, 4]] D. [[1, 2, 3, 4], [1, 2, 3, 4], [1, 2, 3, 4]] 15. Question 15 You are writing a Python application for a dance studio. The studio wants to encourage youth and seniors to sign up. Minors and seniors must receive a 10% discount. You write the following code. Line numbers are included for reference only. 01 def get_discount(minor, senior): 02 discount =.1 03 04 discount = 0 05 return discount You need to complete the code. Which code should you add on line 03? Answer Area A. if not (minor and senior): B. if not (minor or senior): C. if (not minor) and senior: D. if (not minor) or senior: 16. Question 16 You develop a Python application for your school. A list named colors contains 200 colors. You need to slice the list to display every other color starting with the second color. Which code should you use? Answer Area A. colors[1:2] B. colors [::2] C. colors[2:2] D. colors [1::2] 公众微信号:DS_51ds · 195 · 全国大学生计算机应用能力与信息素养大赛 17. Question 17 You write the following code: import datetime d = datetime.datetime(2017, 4, 7) print(’{:%B-%d-%y}’.format(d)) num=1234567.890 print(‘{:,.4f}’.format(num)) You run the program. What is the output? Answer Area A. 2017--April--07 1,234,567.890 Press any key to continue... B. Apr--07--2017 1,234,567,8900 Press any key to continue... C. April--07--17 1,234,567.8900 Press any key to continue... D. April--07--17 1234567.89 Press any key to continue... 18. Question 18 You develop a Python application for your company. You have the following code. Line numbers are ¡included for reference only. 01 def main(a,b,c,d): 02 value = a+b*c-d 03 return value Use the drop-down menus to select the answer choice that answers each question based on the information presented in the code segment. Answer Area Which part of the expression will be evaluated first?. Which operation will be evaluated second?. Which expression is equivalent to the expression in the function?. A. a+b B. b*c C. c-d A. addition B. subtraction A. (a+b) * (c-d) B. (a + (b*c)) – d C. a + ((b*c) – d) · 196 · 官方网站:www.51ds-2016.org 院校赛各比赛项目介绍、选拔考试说明及模拟练习题 19. Question 19 You create the following program to locate a conference room and display the room name. Line numbers are included for reference only. 01 rooms = {1: ‘Foyer’, 2: ‘conference Room’} 02 room = input(’Enter the room number: ‘) 03 if not room in rooms: 04 print(’Room does not exist.’) 05 else: 06 print(”The room name is “ + rooms[room]) Colleagues report that the program sometimes produces incorrect results. You need to troubleshoot the program. Use the drop-down menus to select the answer choice mat answers each question based on the information presented in the code segment. Answer Area Which two data types are stored in the rooms list at line 01?. What is the data type of room at line 02?. Why does line 03 fail to find the rooms?. A. bool and string B. float and bool C. int and string D. float and int A. bool B. float C. int D. string A. Invalid syntax B. Mismatched data type(s) C. Misnamed variable(s) 20. Question 20 You find errors while evaluating the following code. Line numbers are included for reference only. 01 numbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9) 02 index = 0 03 while (index < 10) 04 print(numbers[index]) 05 06 if numbers(index) = 6 07 break 08 else : 09 index += 1 You need to correct the code at line 03 and line 06. How should you correct the code? Use the drop-down menus to select the answer choice that answers each question based on the information presented in the code segment. Answer Area Which code segment should you use at line 03?. Which code segment should you use at line 06?. A. while(index < 10): B. while[index < 10] C. while(index < 5): D. while[index < 5] A. if numbers[index] == 6 B. if numbers[index] == 6: C. if numbers(index) == 6 D. if numbers(index) == 6: 公众微信号:DS_51ds · 197 · 全国大学生计算机应用能力与信息素养大赛 21. Question 21 You are writing a program that calculates a user’s year of birth. The program asks users for their age and the current year, then outputs the user’s year of birth. You write the following code. Line numbers are included for reference only. 01 age = input(”Enter your age: “) 02 year = input(“Enter the four digit year: ”) 03 born = eval(year) - eval(age) 04 message = “You were born in “ + str(born) 05 print(message) You need to ensure that the program uses the appropriate data types. What data types are used? Use the drop-down menus to select the answer choice that answers each question based on the information presented in ¡ne code segment. NOTE: Each correct selection is worth one point. Answer Area What data type is age in line 01?. What data type is born in line 03?. What data type is message in line 04?. A. int B. str C. float D. bool A. int B. str C. float D. bool A. int B. str C. float D. bool 22. Question 22 You write the following code: a = ‘Config’ print(a) b = a a += ‘config2’ print(a) print(b) Use the drop-down menus to select the answer choice that answers each question based on the information presented in the code segment. Answer Area What is displayed after the first print?. What is displayed after the second print?. What is displayed after the third print?. A. Config1 B. Config1Config2 C. Config2 A. Config1 B. Config1Config2 C. Config2 A. Config1 B. Config1Config2 C. Config2 · 198 · 官方网站:www.51ds-2016.org 院校赛各比赛项目介绍、选拔考试说明及模拟练习题 23. Question 23 You are writing a function that returns the data type of the value that is passed in. You write the following code. Line numbers are included for reference only. 01 def checkType(value): 02 dataType = type(value) 03 return dataType 04 print(checkType(True)) 05 print(checkType(1.0)) 06 print(checkType(1)) 07 print(checkType(”True”)) Use the drop-down menus to select the answer choice that answers each question based on the information presented in the code segment. Answer Area What is printed at line 04?. What is printed at line 05?. What is printed at line 06?. What is printed at line 07?. A. B. C. D. A. B. C. D. A. B. C. D. A. B. C. D. 24. Question 24 You need to write code that generates a random float with a minimum value of 0.0 and a maximum value of 1.0. Which statement should you use? Answer Area A. random.randrange() B. random.randrange(0.0, 1.0) C. random.random() D. random.randint(0, 1) 25. Question 25 You write a function that reads a data file and prints each line of the file. You write the following code. Line numbers are included for reference only. 01 def read_file(file): 02 line = None 03 if os.path.isfile(file): 04 data = open(file,’r’) 05 for line in data: 06 print(line) When you run the program, you receive an error on line 03. What is causing the error? 公众微信号:DS_51ds · 199 · 全国大学生计算机应用能力与信息素养大赛 Answer Area A. The path method does not exist in the os object. B. The isfile method does not exist in the path object. C. You need to import the os library. D. The isfile method does not accept one parameter. 26. Question 26 You develop a Python application for your company. A list named employees contains 200 employee names, the last five being company management. You need to slice the list to display all employees excluding management. Which two code segments should you use? Each correct answer presents a complete solution. Choose two. Answer Area A. employees[0:-4] B. employees [1:-5] C. employees [:-5] D. employees [0:-5] E. employees [1:-4] 27. Question 27 Adventure Works Cycles is creating a program that allows customers to log the number of miles biked. The program will send messages based on how many miles the customer logs. You create the following Python code. Line numbers are included for reference only. 01 02 name = input(”What is your name? “) 03 return name 04 05 calories = miles * calories_per_mile 07 return calories 08 distance = int(input(”How many miles did you bike this week? “)) 09 burn_rate = 50 10 biker = get_name() 11 calories_burned = calc_calories(distance, burn_rate) 12 print(biker, “, you burned about” ,calories_burned, “calories.”) You need to define the two required functions. Which code segments should you use for line 01 and line 04? Each correct answer presents part of the solution. Choose two. Answer Area A. 01 def get_name(): B. 01 def get_name(biker): C. 01 def get_name(name): D. 04 def calc_calories(): · 200 · 官方网站:www.51ds-2016.org 院校赛各比赛项目介绍、选拔考试说明及模拟练习题 E. 04 def calc_calories(miles, burn_rate): F. 04 def calc_calories(miles, calories_per_mile): 28. Question 28 You are writing code that generates a random integer with a minimum value of 5 and a maximum value of 11. Which two functions should you use? Each correct answer presents a complete solution. Choose two. Answer Area A. random.randint(5, 11) B. random.randrange(5, 12, 1) C. random.randint(5, 12) D. random.randrange(5, 11, 1) 29. Question 29 You are creating a function that manipulates a number. The function has the following requirements:. A float is passed into the function. The function must take the absolute value of the float. Any decimal points after the integer must be removed Which two math functions should you use? Each correct answer is part of the solution. Choose two. Answer Area A. math.ceil(x) B. math.fmod(x) C. math.floor(x) D. math.frexp(x) E. math.fabs(x) 30. Question 30 Woodgrove Bank must generate a report that shows the average balance for all customers each day. The report must truncate the decimal portion of the balance. Which two code segments should you use? Each correct answer presents a complete solution. Choose two. Answer Area A. average_balance = total_deposits**number_of_customers B. average_balance = total_deposits//number_of_customers C. average_balance = int(total_deposits/number_of_customers) D. average_balance = float(total_deposits//number_of_customers) 公众微信号:DS_51ds · 201 · 全国大学生计算机应用能力与信息素养大赛 31. Question 31 You work on a team that is developing a game for AdventureWorks. You need to write code that generates a random number that meets the following requirements:. The number is a multiple of 5.. The lowest number is 5.. The highest number is 100. Which two code segments will meet the requirements? Each correct answer presents a complete solution. Choose two. Answer Area A. from random import randrange print(randrange(5, 100, 5)) B. from random import randint print(randint(1, 20) * 5) C. from random import randint print(randint(0, 20) * 5) D. from random import randrange print(randrange(0, 100, 5)) 32. Question 32 You are creating a function that reads a data file and prints each line of the file. You write the following code. Line numbers are included for reference only. 01 import os 02 def read_file(file): 03 line = None 04 if os.path.isfile(file): 05 data = open(file,’r’) 06 while line != ‘‘: 07 line = data.readline() 08 print(line) The code attempts to read the file even if the file does not exist. You need to correct the code. Which three lines have indentation problems? Each correct answer presents part of the solution. Choose three. Answer Area A. Line 01 B. Line 02 C. Line 03 D. Line 04 E. Line 05 F. Line 06 G. Line 07 H. Line 08 · 202 · 官方网站:www.51ds-2016.org 院校赛各比赛项目介绍、选拔考试说明及模拟练习题 33. Question 33 You are creating an ecommerce script that accepts input from the user and outputs the data in a comma delimited format. You write the following lines of code to accept input item = input(”Enter the item name: ”) sales = input(“Enter the quantity: ”) The output must meet the following requirements:. Strings must be enclosed inside of double-quotes. Numbers must not be enclosed in quotes or other characters. Each item must be separated with a comma You need to complete the code to meet the requirements. Which three code segments should you use? Each correct answer presents a complete solution. Choose three. Answer Area A. print(’”{0}”,{1}’.format(item, sales)) B. print(item + ‘,’ + sales) C. print(’”’ + item + ‘”,‘ + sales) D. print(”{0},{1}”.format(item, sales)) E. print(’”%s”, %s’ % (item, sales)) 34. Question 34 You are building a Python program that displays all of the prime numbers from 2 to 100. How should you complete the code? To answer, drag the appropriate code segments to the correct location. Each code segment may be used once, more than once, or not at all. You may need to drag the split bar between panes or scroll to view content. NOTE: Each correct selection is worth one point. Code Segments [A] p=2 while p = 90: A. if grade > 80: B. if grade >= 80: C. elif grade > 80: D. elif grade >= 80: A. if grade > 70: B. if grade >= 70: C. elif grade > 70: D. elif grade >= 70: A. if grade > 65: B. if grade >= 65: C. elif grade > 65: D. elif grade >= 65: 公众微信号:DS_51ds · 213 · 全国大学生计算机应用能力与信息素养大赛 54. Question 54 You are writing a Python program to validate employee numbers. The employee number must have the format ddd-dd-dddd and consist only of numbers and dashes. The program must print True if the format is correct and print False if the format is incorrect. How should you complete the code? To answer, select the appropriate code segments in the answer area. Answer Area. baab parts = “”.. employee_number = input(’Enter employee number (ddd-dd-dddd): “) parts = employee_number. split(‘ -‘) if len(parts) == 3: if len(parts) == 3 and len(parts) == 2 and len(parts) == 4: if parts.isdigit() and parts.isdigit() and parts.isdigit():. print(valid) A. Employee_number = “” B. Employee_number = “sentinel” A. while employee_number != “”: B. while employee_number != “sentinel”: A. valid = False B. valid = True A. valid = False B. valid = True 55. Question 55 You are coding a math utility by using Python. You are writing a function to compute roots. The function must meet the following requirements: If a is non-negative, return a**(1/b) If a is negative and even, return “Result is an imaginary number” If a is negative and odd, return -(-a)**(1/b) How should you complete the code? To answer, select the appropriate code segments in the answer area. Answer Area def safe_root(a, b): acbc. answer = a**(1/b).. answer = “Result is an imaginary number”. answer = -(-a)**(1/b) return answer · 214 · 官方网站:www.51ds-2016.org 院校赛各比赛项目介绍、选拔考试说明及模拟练习题 A. if a >= 0: B. if a % 2 == 0: C. else: D. elif: A. if a >= 0: B. if a % 2 == 0: C. else: D. elif: A. if a >= 0: B. if a % 2 == 0: C. else: D. elif: A. if a >= 0: B. if a % 2 == 0: C. else: D. elif: 56. Question 56 You work for a company that distributes media for all ages. You are writing a function that assigns a rating based on a user’s age. The function must meet the following requirements:. Anyone 18 years old or older receives a rating of “A”.. Anyone 13 or older, but younger than 18, receives a rating of “T’.. Anyone 12 years old or younger receives a rating of “C”.. If the age is unknown, the rating is set to “C’. You need to complete the code to meet the requirements. How should you complete the code? To answer, select the appropriate code segments in the answer area. Answer Area def get_rating(age): rating = “” dabc if. elif. elif. else. return rating A. age < 13: rating = “C” B. age < 18: rating = ”T" C. : rating = “A” D. age == None: rating = "C" A. age < 13: rating = “C” B. age < 18: rating = ”T" C. : rating = “A” D. age == None: rating = "C" A. age < 13: rating = “C” B. age < 18: rating = ”T" C. : rating = “A” D. age == None: rating = "C" A. age < 13: rating = “C” B. age < 18: rating = ”T" C. : rating = “A” D. age == None: rating = "C" 57. Question 57 You are developing a Python application for an online product distribution company. You need the program to iterate through a list of products and escape when a target product ID is found. How should you complete the code? To answer, select the appropriate code segments in the answer area. NOTE: Each correct selection is worth one point. Answer Area productldList = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] index = 0. (index < 10) : 公众微信号:DS_51ds · 215 · 全国大学生计算机应用能力与信息素养大赛 print(productldList[index]) adc if productldList[index) == 6 :. else :. A. while B. for C. if D. break A. while B. for C. if D. break A. continue B. break C. index += 1 D. index = 1 58. Question 58 Lucerne Publishing Company needs a way to find the count of particular letters in their publications to ensure that there is a good balance. It seems that there have been complaints about overuse of the letter e. You need to create a function to meet the requirements. How should you complete the code? To answer, select the appropriate code segments in the answer area. NOTE: Each correct selection is worth one point. Answer Area #Function accepts list of words from a file, #and letter to search for. #Returns count of a particular letter in that list. def count_letter(letter, word_list): count=0 bd for. if. count += 1 return count word_list =[] #word_list is populated a from file, code not shown. letter = input(”which letter would you like to count”) letter_count= count_letter(letter, word_list) print(”There are: “ letter_count, “ instances of “ + letter) A. word_list in word: B. word in word_list: C. word == word_list: D. word is word_list: A. word is letter: B. letter is word: C. word in letter: D. letter in word: · 216 · 官方网站:www.51ds-2016.org 院校赛各比赛项目介绍、选拔考试说明及模拟练习题 59. Question 59 You are an intern for Northwind Electric Cars. You must create a function that calculates the average velocity of their vehicles on a 1320 foot (1/4 mile) track. The output must be as precise as possible. How should you complete the code? To answer, select the appropriate code segments in the answer area. Answer Area #Speed calculator distance =. (input(”Enter the distance traveled in feet”)) distance_miles = distance/5280 #convert to miles time =. (input(”Enter the time elapsed in seconds”)) time_hours = time/3600 #convert to hours velocity = distance_miles/time_hours print(”The average velocity is : “, velocity, “ miles/hour”) A. int B. float C. str A. int B. str C. float 60. Question 60 Southridge Video needs a way to determine the cost that a customer will pay for renting a DVD. The cost is dependent on the time of day the DVD is returned. However, there are also special rates on Thursdays and Sundays. The fee structure is shown in the following list:. The cost is $1.59 per night.. If the DVD is returned after 8 PM, the customer will be charged an extra day.. If the video is rented on a Sunday, the customer gets 30% off for as long as they keep the video.. If the video is rented on a Thursday, the customer gets 50% off for as long as they keep the video. You need to write code to meet the requirements. How should you complete the code? To answer, select the appropriate code segments in the answer area. NOTE: Each correct selection is worth one point. Answer Area #Southridge Video, DVD Rental calculator ontime = input(”Was video returned before 8 pm? y or n”).lower() days_rented = int(input(”How many days was video rented?”)) day_rented = input(”What day was the video rented?”).capitalize() cost_per_day = 1.59 if ontime. days_rented +=1 if day_rented. total = (days_rented * cost_per_day) *.7 elif day_rented. total = (days_rented * cost_per_day) *.5 公众微信号:DS_51ds · 217 · 全国大学生计算机应用能力与信息素养大赛 else: total = days_rented * cost_per_day print(”Cost of the END rental is : $’, total) A. != “n”: B. == “n”: C. == ”y”: A. == “Sunday”: B. >= “Sunday”: C. is “Sunday”: A. == “Thursday”: B. 2” print(digits + “ digits.”) A. if num > -10 and num < 10: B. if num > -100 and num < 100: A. if num > -100 and num < 100: B. elif num > -100 and num < 100: C. if num > -10 and num < 10: D. elif num > -10 and num < 10: A. else: B. elif: 70. Question 70 Wingtip Toys is creating an interactive Times Table Helper program intended for elementary school children. You need to complete a function that computes and displays all multiplication table combinations from 2 to 12. How should you complete the code? To answer, select the appropriate code segments in the answer area. Answer Area #Displays times tables 2 - 12 def times_tables():.. print( row*col, end=” “) print() #main times_tables( ) A. for col in range(13): B. for col in range(2, 13): C. for col in range(2, 12, 1): D. for col in range(12): A. for row in range(13): B. for row in range(2, 13): C. for row in range(2, 12, 1): D. for row in range(12): 71. Question 71 Adventure Works Cycles sales are so exceptional that they decide to give a bonus to all employees who do not make more than S150,000. The following formula applies to each employee based on their base salary and a flat bonus: New salary = current salary x 3% + a $500 bonus. You write code that reads the employee salaries into a variable named salary_list. 公众微信号:DS_51ds · 223 · 全国大学生计算机应用能力与信息素养大赛 You need to complete the code that applies an increase to each eligible employee’s salary. How should you complete the code? To answer, select the appropriate code segments in the answer area. Answer Area #Each salary in the list is updated based on increase. Employees making. #$150,000 or more will not get a raise. #Salary list is populated from employee database, code not shown.. if salary_list[index] >= 150000:. salary_list[index] = (salary_list[index] * 1.03) + 500 A. for index in range(len(salary_list)+1): B. for index in range(len(salary_list)-1): C. for index in range(len(salary_list)): D. for index in salary_list: A. exit() B. continue C. break D. end 72. Question 72 You are creating a function to calculate admission fees by using Python. Admission fees are calculated based on the following rules:. Anyone under age S = free admission. Anyone age S or older who is in school = 10 USD. Anyone age S to 17 who is not in school = 20 USD. Anyone older than age 17 who is not in school = SO USD How should you complete the code? To answer, select the appropriate code segments in the answer area. Answer Area def admission_fee(age, school): rate = 0. rate = 10.. rate = 20 else: rate = 50 return rate A. if age >= 5 and school == True: B. if age >= 5 and age = 5 and school == False: A. elif age >= 5 and school == False: B. else age >= 5 and school == False: C. elif age >= 5 and school == True: A. if age >= 5 and school == True: B. if age >= 5 and school == False: C. if age