python选择题题目_PYTHON测试题

s.gifPYTHON测试题

1.what does the following code do(B)def ab, c, d passA.defines a list and initializes itB.defines a function, which does nothingC.defines a function, which passes its parameters throughD.defines an empty class2.what gets printed Assuming python version 2.xAprint type1/2A.type intB.type numberC.type floatD.type doubleE.type tuple3. what is the output of the following code(E)print type1,2A.type tupleB.type intC.type setD.type compl.type list4. what gets printed(C)def f passprint typefA.type functionB.type tupleC.type NoneTypeD.type strE.type type5. what should the below code printAprint type1JA.type complexB.type unicodeC.type intD.type floatE.type dict6. what is the output of the following codeDprint typelambdaNoneA.type NoneTypeB.type tupleC.type typeD.type functionE.type bool7. what is the output of the below programDa 1,2,3,None,print lenaA.syntax errorB.4C.5D.6E.78.what gets printed Assuming python version 3.xCprint type1/2A.type intB.type numberC.type floatD.type doubleE.type tuple9. What gets printedCd lambda p p * 2t lambda p p * 3x 2x dxx txx dxprint xA.7B.12C.24D.36E.4810. What gets printedAx 4.5y 2print xyA.2.0B.2.25C.9.0D.20.25E.2111. What gets printedCnums set1,1,2,3,3,3,4print lennumsA.1B.2C.4D.5E.712. What gets printedAx Truey Falsez Falseif x or y and z print yeselse print noA.yesB.noC.fails to compile13. What gets printedCx Truey Falsez Falseif not x or y print 1elif not x or not y and z print 2elif not x or y or not y and x print 3else print 4A.1B.2C.3D.414. If PYTHONPATH is set in the environment, which directories are searched for modulesDA PYTHONPATH directoryB current directoryC home directoryD installation dependent default pathA.A onlyB.A and DC.A, B, and CD.A, B, and DE.A, B, C, and D15. In python 2.6 or earlier, the code will print error type 1 if accessSecureSystem raises an exception of either AccessError type or SecurityError typeBtry accessSecureSystemexcept AccessError, SecurityError print error type 1continueWorkA.trueB.false16. The following code will successfully print the days and then the monthsBdaysOfWeek Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sundaymonths Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Decprint DAYS s, MONTHS s daysOfWeek, monthsA.trueB.false17. Assuming python 2.6 what gets printedAf Nonefor i in range 5 with opendata.txt, w as f if i 2 breakprint f.closedA.TrueB.FalseC.None18. What gets printedCcounter 1 def doLotsOfStuff global counter for i in 1, 2, 3 counter 1doLotsOfStuffprint counterA.1B.3C.4D.7E.none of the above19. What gets printedCprint rnwoowA.new line then the string woowB.the text exactly like this rnwoowC.the text like exactly like this nwoowD.the letter r and then newline then the text woowE.the letter r then the text like this nwoow20.What gets printedBprint hello worldA.on one line the text hello worldB.on one line the text helloworldC.hello on one line and world on the next lineD.syntax error, this python program will not run21.What gets printedEprint x48x49A.x48x49B.4849C.4849D. 48 49E.HI22. What gets printedDprint 0 xA 0 xaA.0 xA 0 xaB.0 xA 0 xaC.14D.20E.0 x2023. What gets printedEclass parent def initself, param self.v1 paramclass childparent def initself, param self.v2 paramobj child11print d d obj.v1, obj.v2A.None NoneB.None 11C.11 NoneD.11 11E.Error is generated by program24. What gets printedEkvps user,bill, password,hillaryprint kvpspasswordA.userB.billC.passwordD.hillaryE.Nothing. Python syntax error25. What gets pr

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值