2022 第五届大学生计算机技能应用大赛(python科目初赛题库答案) |
您所在的位置:网站首页 › 大学生写作技能大赛题库及答案 › 2022 第五届大学生计算机技能应用大赛(python科目初赛题库答案) |
仅供参考学习,侵权可删。 1、下列代码运行结果是? 1 a = map(lambda x: x**3, [1, 2, 3]) 2 list(a) 正确答案: C A. [1, 6, 9] B. [1, 12, 27] C. [1, 8, 27] D. (1, 6, 9) 2、在 Python3 中,下列程序运行结果为: 1 print('\n'.join(['a', 'b', 'c'])) 正确答案: B A. 'abc' B. a C. b D. c E. 报错 F. None 3、以下哪个代码是正确的读取一个文件? 正确答案: C A. f = open("test.txt", "read") B. f = open("r","test.txt") C. f = open("test.txt", "r") D. f = open("read","test.txt") 4、在 python3 中,下列程序运行结果为: 1 strs = ['a', 'ab', 'abc', 'abcd'] 2 dicts ={} 3 for i in range(len(strs)): 4 dicts[i] = strs[i] 5 print(dicts) 正确答案: C A. [0: 'a', 1: 'ab', 2: 'abc', 3: 'abcd'] B. {1: 'a', 2: 'ab', 3: 'abc', 4: 'abcd'} C. {0: 'a', 1: 'ab', 2: 'abc', 3: 'abcd'} D. [1: 'a', 2: 'ab', 3: 'abc', 4: 'abcd'] 5、在 python3 中,关于元组的计算如下: 1 one = (1, 2, 3) 2 one[2] = 4 3 print(one[2]) 正确答案: B None 报错:元组中的元素值不支持修改 4 (4) 6、以下程序输出为: 1 # -*- coding:utf-8 -*- 2 def test(a, b, *args): 3 print(a) 4 print(b) 5 print(args) 6 7 test(11, 22, 33, 44, 55, 66, 77, 88, 99) 正确答案: A 11 22 (33, 44, 55, 66, 77, 88, 99) 编译错误 运行错误 11 22 (11,22,33, 44, 55, 66, 77, 88, 99) 7、在 Python3 环境中,下列程序运行结果为: 1 2 3 4 5 6 trupls = [(1, 2), (2, 3, 4), (4, 5)] lists = [] for tru in trupls: for num in tru: lists.append(num) print(lists) 正确答案: C [1, 2, 3, 4, 5] (1, 2, 2, 3, 4, 4, 5) [1, 2, 2, 3, 4, 4, 5] (1, 2, 3, 4, 5) 8、Which numbers are printed?()微信公众号:竞赛资料库 领全网资料 1 for i in range(2): 2 print i 3 for i in range(4,6): 4 print i 正确答案: C 2, 4, 6 0, 1, 2, 4, 5, 6 0, 1, 4, 5 0, 1, 4, 5, 6, 7, 8, 9 1, 2, 4, 5, 6 9、当一个嵌套函数在其外部区域引用了一个值时,该嵌套函数就是 一个闭包,以下代码输出值为: 1 def adder(x): 2 def wrapper(y): 3 return x + y 4 return wrapper 5 adder5 = adder(5) 6 print(adder5(adder5(6))) 正确答案: D 10 12 14 16 10、在 Python3 中,有关字符串的运算结果为: 1 strs = 'I like python and java' 2 one = strs.find('n') 3 print(one) 4 two = strs.rfind('n') 5 print(two) 正确答案: C 12,12 15,15 12,15 None,None 略,,,, 具体请查看 🍞正在为您运送作品详情 https://mianbaoduo.com/o/bread/YpubmZhr |
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |