版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
Python语言程序设计(全英)知到智慧树章节测试课后答案2024年秋华南理工大学第一章单元测试
WhichisNOTthemainpartofcomputer()
A:I/Oequipment
B:CPU
C:memory
D:Cache
答案:Cache
WhichsymbolcanbeusedforcommentsinPython()
A:#
B:!
C:“
D://
答案:#
;“
TheintegrateddevelopmenttoolbuiltintoPythonis().
A:Vscode
B:Pycharm
C:Jupyter
D:IDLE
答案:IDLE
Whichisthecorrectoperatorforpower(Xy)?()
A:X^y
B:X**y
C:X^^y
D:Noneofthementioned
答案:X**y
Whichofthefollowingisincorrect?()
A:float("3")
B:float(3)
C:float("3+5")
D:float(4.2)
答案:float("3+5")
第二章单元测试
Whichofthefollowingisaninvalidvariable?()
A:foo
B:1st_string
C:my_string_1
D:_
答案:1st_string
WhatwillbetheoutputofthefollowingPythoncode?
not(10<20)andnot(10>30)()
A:Nooutput
B:True
C:Error
D:False
答案:False
Whichonewillreturnerrorwhenaccessingthelist‘l’with10elements.()
A:l[-10]
B:l[10]
C:l[0]
D:l[-1]
答案:l[10]
WhatwillbetheoutputofthefollowingPythoncode?
lst=[3,4,6,1,2]
lst[1:2]=[7,8]
print(lst)()
A:[3,7,8,6,1,2]
B:[3,4,6,7,8]
C:Syntaxerror
D:[3,[7,8],6,1,2]
答案:[3,7,8,6,1,2]
Whichofthefollowingoperationswillrightlymodifythevalueoftheelement?()
A:
t={'h','e','l','l','o'}
t[0]='H'
B:
s='hello'
s[0]='H'
C:
t=('h','e','l','l','o')
t[0]='H'
D:
t=['h','e','l','l','o']
t[0]='H'
答案:
t=['h','e','l','l','o']
t[0]='H'
Thefollowingprograminputdata:95,theoutputresultis?
(
)
A:noneofthementioned
B:
Pleaseenteryourscore:95
Awesome!
Yourabilityexceeds85%ofpeople!
C:
Pleaseenteryourscore:95
Awesome!
D:
Pleaseenteryourscore:95
Yourabilityexceeds85%ofpeople!
答案:
Pleaseenteryourscore:95
Awesome!
Yourabilityexceeds85%ofpeople!
第三章单元测试
Whichonedescriptionofconditioninthefollowingsiscorrect?()
A:Thecondition35<=45<75islegal,andtheoutputisFalse
B:Thecondition24<=28<25islegal,andtheoutputisTrue
C:Thecondition24<=28<25isillegal
D:Thecondition24<=28<25islegal,andtheoutputisFalse
答案:Thecondition24<=28<25islegal,andtheoutputisFalse
Theoutputofthefollowingprogramis?(
)
A:None
B:t
C:Python
D:python
答案:None
forvarin___:(
)
A:range(0,10)
B:"Hello"
C:[1,2,3]
D:13.5
答案:13.5
Afterthefollowingprogramisexecuted,thevalueofsis?(
)
A:46
B:19
C:47
D:9
答案:9
Whichistheoutputofthefollowingcode?a=30
b=1
ifa>=10:
a=20
elifa>=20:
a=30
elifa>=30:
b=a
else:
b=0
print("a=",a,"b=",b)()
A:a=20,b=1B:a=20,b=20C:a=30,b=1D:a=30,b=30
答案:a=20,b=1
第四章单元测试
WhichkeywordisusedtodefineafunctioninPython?()
A:def
B:fun
C:define
D:function
答案:def
WhatwillbetheoutputofthefollowingPythoncode?
(
)
A:
xis50
Changedlocalxto2
xisnow2
B:
xis50
Changedlocalxto2
xisnow100
C:
xis50
Changedlocalxto2
xisnow50
D:Noneofthementioned
答案:
xis50
Changedlocalxto2
xisnow50
WhicharetheadvantagesoffunctionsinPython?()
A:Reducingduplicationofcode
B:Improvingclarityofthecode
C:Decomposingcomplexproblemsintosimplerpieces
D:Easiertomanagethecode
答案:Reducingduplicationofcode
;Improvingclarityofthecode
;Decomposingcomplexproblemsintosimplerpieces
;Easiertomanagethecode
Howdoesthevariablelengthargumentspecifiedinthefunctionheading?()
A:oneunderscorefollowedbyavalididentifier
B:onestarfollowedbyavalididentifier
C:twounderscoresfollowedbyavalididentifier
D:twostarsfollowedbyavalididentifier
答案:onestarfollowedbyavalididentifier
WhatwillbetheoutputofthefollowingPythoncode?
list(map((lambdax:x**2),filter((lambdax:x%2==0),range(10))))()
A:Error
B:[0,4,16,36,64]
C:Nooutput
D:[0,1,2,3,4,5,6,7,8,9]
答案:[0,4,16,36,64]
第五章单元测试
Whichofthefollowingstatementscannotcreateademo.txtfile?()
A:f=open("demo.txt","r")
B:f=open("demo.txt","w")
C:f=open("demo.txt","x")
D:f=open("demo.txt","a")
答案:f=open("demo.txt","r")
Afterexecutingthefollowingprocedure,whatcontentwillbesavedinthefile?
file=open('test.txt','wt+')
file.write('helloSCUT')
file.close()
file=open('test.txt','at+')
file.write('helloworld')
file.close()()
A:helloSCUThelloworld
B:helloSCUThelloworld
C:helloSCUTworld
D:helloworld
答案:helloSCUThelloworld
WhichfunctionisnotthewayPythonreadsfiles.()
A:readline()
B:readtext()
C:read()
D:readlines()
答案:readtext()
HowtorenameafileinPython?()
A:os.set_name(existing_name,new_name)
B:os.rename(existing_name,new_name)
C:=‘new_name.txt’
D:os.rename(fp,new_name)
答案:os.rename(existing_name,new_name)
Whatistheusageoftell()functioninPython?()
A:tellsyouthefileisopenedornot
B:tellsyouthecurrentpositionwithinthefile
C:noneofthementioned
D:tellsyoutheendpositionwithinthefile
答案:tellsyouthecurrentpositionwithinthefile
第六章单元测试
WhatwillbetheoutputofthefollowingPythoncode?(
)
A:Runsnormally,doesn’tdisplayanything
B:Reportserrorasdisplayfunctionrequiresadditionalargument
C:Displays0,whichistheautomaticdefaultvalue
D:Reportserrorasoneargumentisrequiredwhilecreatingtheobject
答案:Reportserrorasoneargumentisrequiredwhilecreatingtheobject
WhatwillbetheoutputofthefollowingPythoncode?
(
)
A:Nothingisprinted
B:‘New’
C:Error
D:‘Old’
答案:‘Old’
WhatwillbetheoutputofthefollowingPythoncode?
(
)
A:Demo
B:__main__
C:Exceptionisthrown
D:test
答案:__main__
WhichoneofthefollowingsisnotcorrectaboutClasshierarchy?()
A:Subclasscannotaddmorebehavior/methods
B:Subclasscanoverridethemethodsinheritedfromsuperclass
C:Subclasscaninheritallattributesfromsuperclass
D:Subclasscanhavemethodswithsamenameassuperclass
答案:Subclasscannotaddmorebehavior/methods
WhatwillbetheoutputofthefollowingPythoncode?
(
)
A:00
B:01
C:ErrorbecauseclassBinheritsAbutvariablexisn’tinherited
D:Error,thesyntaxoftheinvokingmethodiswrong
答案:01
第七章单元测试
Numpyisathirdpartypackagefor____inPython?()
A:Lambdafunction
B:Typecasting
C:Array
D:Function
答案:Array
HowtoconvertaNumpyarraytoalistinPython?()
A:list.append(array)
B:list.array
C:list(array)
D:array.list
答案:list(array)
WhichkeywordisusedtoaccesstheNumpypackageinPython?()
A:from
B:fetch
C:load
D:import
答案:import
Whichoneiscorrectsyntaxforthe‘reshape()’functioninNumpy?()
A:reshape(shape,array)
B:array.reshape(shape)
C:reshape(array,shape)
D:reshape(shape)
答案:reshape(array,shape)
Whatwillbetheoutputforthefollowingcode?
importnumpyasnp
a=np.array([1,2,3],dtype=complex)
print(a)()
A:Error
B:[1.+0.j,2.+0.j,3.+0.
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 演练方案汇编10篇
- 智慧城市解决方案数据整合
- 2024年信阳市息县一中八年级下学期中考一模地理试卷
- 环卫工程维修保养室外施工合同
- 科研仪器招投标流程详解
- 奶站加盟协议
- 矿产行业会计岗位招聘协议
- 电影院墙纸更新服务
- 药品采购药师租赁协议
- 宿舍公共财产维修流程
- 机械制图之平面投影
- 2023年杨家小学音体美测查方案范文
- 《食品包装学(第三版)》教学PPT课件整套电子讲义
- MISSILE-DATCOM使用教程课件
- 高校毕业生就业推荐表模板
- 网络搭建综合知识试题与答案
- Differences-between-Chinese-and-British-Tea-Culture中英茶文化差异论文
- (完整版)office办公软件上机操作练习题
- 天然气长输管道安全事故应急演练脚本
- 电机端盖的机械加工工艺工装设计毕业论文
- 2023年1月内蒙古自治区普通高中学业水平考试数学试题
评论
0/150
提交评论