当前位置:文档之家› PYTHON测试题

PYTHON测试题

PYTHON测试题A.defines a list and initializes itB.defines a function, which does nothingC.defines a function, which passes its parameters throughD.defines an empty classA.<type 'int'>B.<type 'number'>C.<type 'float'>D.<type 'double'>E.<type 'tuple'>A.<type 'tuple'>B.<type 'int'>C.<type 'set'>D.<type 'complex'>E.<type 'list'>A.<type 'function'>B.<type 'tuple'>C.<type 'NoneType'>D.<type 'str'>E.<type 'type'>A.<type 'complex'>B.<type 'unicode'>C.<type 'int'>D.<type 'float'>E.<type 'dict'>A.<type 'NoneType'>B.<type 'tuple'>C.<type 'type'>D.<type 'function'>E.<type 'bool'>A.syntax errorB.4C.5D.6E.7A.<type 'int'>B.<type 'number'>C.<type 'float'>D.<type 'double'>E.<type 'tuple'>A.7B.12C.24D.36E.48A.2.0B.2.25C.9.0D.20.25E.21A.1B.2C.4D.5E.7A.yesB.noC.fails to compileA.1B.3C.4D.7E.none of the above19. What gets printed?(C)A.new line then the string: woowB.the text exactly like this: r"\nwoow"C.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 printed?(B)A.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 printed?(E)A.\x48\x49!B.4849C.4849!D. 48 49!E.HI!22. What gets printed?(D)A.0xA + 0xaB.0xA 0xaC.14D.20E.0x2023. What gets printed?(E)A.None NoneB.None 11C.11 NoneD.11 11E.Error is generated by program24. What gets printed?(E)erB.billC.passwordD.hillaryE.Nothing. Python syntax error25. What gets printed?(B)A.NoneB.123C.666D.SyntaxError, this program will not run26. What gets printed?(C)A.stB.stoC.toD.torE.Syntax Error27. What gets printed?(D)A.snow stormB.snowXstormC.snow XtormD.ERROR, this code will not run28. Which numbers are printed?(C)A.2, 4, 6B.0, 1, 2, 4, 5, 6C.0, 1, 4, 5D.0, 1, 4, 5, 6, 7, 8, 9E.1, 2, 4, 5, 629. What sequence of numbers is printed?(B)A.1 2 3B.1 2 1 3C.1 2 1 3 1 2 1 3D.1 1 1 1 2 2 3 3E.Syntax Error30. What sequence of numbers is printed?(E)A.2 3 2 4B.4 6 4 8C.1 1.5 1 2D.1 1 1 2E.4 9 4 1631. What numbers get printed(C)A.500 300B.500 500C.600 400D.600 600E.300 50032. What gets printed by the code snippet below?(B)A.5B.5.0C.5.5D.6E.6.033. What gets printed by the code below?(E)A.1B.2C.49D.50E.5134. What gets printed?(E)A.fooB.foo fooC.foo 2D.2E.An exception is thrown35. What gets printed?(E)A.simpleFunctionB.simpleC.funcD.funtionE.cool36. What does the code below do?(C)A.Changes the location that the python executable is run fromB.Changes the current working directoryC.Adds a new directory to seach for python modules that are importedD.Removes all directories for modsE.Changes the location where sub-processes are searched for after they are launched37. What gets printed?(C)A.3B.7C.13D.14E.1538. Which of the following print statements will print all the names in the list ona seperate line(A)A.print "\n".join(names)B.print names.join("\n")C.print names.concatenate("\n")D.print names.append("\n")E.print names.join("%s\n", names)39. True or false? Code indentation must be 4 spaces when creating a code block?(B)A.TrueB.False40. Assuming the filename for the code below is /usr/lib/python/person.pyand the program is run as:python /usr/lib/python/person.pyWhat gets printed?(D)A.PersonB.getAger.lib.python.personD.__main__E.An exception is thrown41. What gets printed(B)B.dictC.listD.tupleE.object42. What gets printed?(C)A.intB.listC.tupleD.dictE.set43. What gets printed?(D)A.0B.1C.2D.3E.444. What gets printed?(D)A.1B.2C.3D.4E.545. What gets printed?(C)A.2B.4C.6D.7E.An exception is thrown46.What gets printed?(E)B.2C.4D.7E.An exception is thrown47. What gets printed?(E)A.8B.12C.24D.30E.3348. What gets printed?(A)A.0B.1C.2D.3E.An exception is thrown49. What gets printed?(B)B.2C.3D.4E.An exception is thrown50. What gets printed?(E)A.AB.rC.AmirD.DaoE.o51. What gets printed?(B)A.11B.12C.21D.22E.3352. What gets printed?(E)A.-1B.0C.4D.EdwardE.An exception is thrown53. What gets printed?(B)A.1B.2C.An exception is thrown54. What gets printed?(C)A.iB.aC.cD.CE.An exception is thrown55. What gets printed?(B)B.5C.8D.12E.An exception is thrown56. Which of the following data structures can be used with the "in" operator to check if an item is in the data structure?(E)A.listB.setC.dictionaryD.None of the aboveE.All of the above57. Wat gets printed?(D)A.2B.4C.5D.8E.An exception is thrown58. What gets printed?(C)A.1B.4C.5D.8E.An exception is thrown59. What gets printed?(E)A.1B.2C.5D.7E.An exception is thrown60. What gets printed?(B)A.1 2B.2 1C.An exception is thrownD.This program has undefined behavior61. What gets printed?(A)A.+++1 some info+++B.+++%s+++C.1D.some info62. What gets printed?(C)A.strB.intC.tupleD.listE.dict63. What gets printed?(E)A.inB.strC.tupleD.listE.dict64. What gets printed?(B)A.1B.3C.6D.10E.An exception is thrown65. How do you create a package so that the following reference will work?(C)A.Declare the myparser package in mytools.pyB.Create an __init__.py in the home dirC.Inside the mytools dir create a __init__.pyD.Create a myparser.py directory inside the mytools directoryE.This can not be done66. What gets printed?(E)A.1B.2C.3D.6E.767. What gets printed?(E)A.2B.4C.6D.8E.An exception is thrown68. What gets printed?(A)A.hiB.hC.Inside the mytools dir create a __init__.py and myparser.pyD.104105E.10469. What gets printed?(A)A.aB.bC.c70. What gets printed?(C)A.2B.3C.4D.6E.An exception is thrown71. What gets printed (with python version 2.X) assuming the user enters the following at the prompt?(D)#: fooA.fB.fooC.#: fooD.An exception is thrown72. What gets printed?(C)A.4B.5C.10D.15E.An exception is thrown73. If the user types '0' at the prompt what gets printed?(B)A.validB.invalidC.An exception is thrown74. What gets printed?(D)A.1B.2C.7D.10E.An exception is thrown75. What gets printed?(C)A.1B.2C.6D.10E.An exception is thrown76. What gets printed(D)A.1B.2C.6D.10E.An exception is thrown77. What gets printed?(C)A.1B.2C.6D.10E.An exception is thrown78. What gets printed?(C)A.1B.2C.6D.10E.An exception is thrown79. What gets printed?(B)A.15B.51C.150D.An exception is thrown80. What gets printed (with python version 3.X) assuming the user enters the following at the prompt?(B)#: fooA.fB.fooC.Not a numberD.An exception is thrown。

相关主题