提示:内容已经过期谨慎付费,点击上方查看最新答案
Python程序设计(英语)
- Which of the following matches type(1+2*3.14) ? ( )
- The term applied to hiding details inside class definitions is ( )
- Which of the following statements is true ( )
- The method that allows us to access information from the instance variables of object is called ( ).
- The items dictionary method returns a(n) ( )
- Li Hua forgot his QQ password, but he still remembered that the password was the ASCII code corresponding to his name “Li Hua”. Which of the following is the correct one? ( )
- Which of the following is NOT a guideline for OOD? ( )
- The output of the following function is ( )
- In top-down design, the subcomponents of the design are ( )
- The value of math.sqrt(9) is ( )
- (According to graphics.py) Which of the following method is provided to make a copy of a graphics object? ( )
- A multiple choice question is most similar to ( )
- A loop pattern that continues until a special value is input is called a(n) ( )
- Which of the following is NOT a dictionary method? ( )
- (According to graphics.py) Which of the following returns the string of text that is currently in the entry box? ( )
- The output of the following statements is ( )
from math import sqrt
print (sqrt(16) * 3 + 1 ==13) - Which string method converts all the characters of a string to lower case? ( )
- Which of the following statement output 5.0? ( )
- Where mathematicians use subscripting, computer programmers use ( )
- (According to graphics.py) What color is color_rgb (255, 0, 0)? ( )
- Which of the following is NOT one of the fundamental characteristics of object-oriented design/programming? ( )
- How many times of loops does the following statement being executed? ( )
- Which expression is true approximately 66% of the time? ( )
- From a design standpoint, encapsulation separates the concerns of ( )
- Which of the following information is included in a function’s interface? ( )
- The following pseudocode demonstrates a(n) ( )
- Instance variables go away once a method terminates. ( )
- The result of statement round(21.6) % 6 is 3.0. ( )
- (According to graphics.py) Circle(Point(3,4), 10) constructs a circle with (3,4) as the center and 10 as the diameter. ( )
- Python passes parameters by value. ( )
- A top-down design is best implemented from the top down. ( )
- Computers can generate truly random numbers. ( )
- If the value being passed is a mutable object, then changes made to the object may be visible to the caller. ( )
Typically, the design process involves considerable trial and error. ( )
- An object may have only one instance variable. ( )
- (According to graphics.py) Oval(a,b) Constructs an oval in the bounding box determined by a and b. ( )
- The condition x <= y <= z is allowed in Python. ( )
- Modifying the list while looping through it can produce strange anomalies. ( )
- In Python, 5.0 * 2 produces the same result as 5*2. ( )
- Top-down design is also called stepwise refinement. ( )
- The parameters appearing in the function definition are called formal parameters, and the expressions appearing in a function call are known as actual parameters. ( )
- There is usually only one correct solution to a problem involving decision structures. ( )
- Python automatically converts numbers from one data type to another in certain situations. ( )
- A developer should use either top-down or spiral design, but not both. ( )
- Unicode uses the same codes as ASCII for the 125 characters originally defined. ( )
- In a Python class, the constructor is called __init__. ( )
- Functions that don't explicitly return a value return the special object Null. ( )
- There is no difference between two string methods s.capitalize() and s.title(). ( )
- The easiest way to iterate through the lines of a file in Python is to use a while loop. ( )
- A Python dictionary is a kind of sequence. ( )
A:
AI参考:选项C,
A:subclassing B:encapsulation C:obscuring D:documentation
答案:John DonneAI参考:正确答案是 B:encapsulation。在类定义中隐藏细节的术语是封装,因此选项B“encapsulation”是正确答案。A选项“subclassing”是指子类化,表示类之间的继承关系;C选项“obscuring”是指隐藏、混淆;D选项“documentation”是指文档,与题意不符。'
A:After the function is executed, the value of c is 210 B:After the function is executed, the value of c is 300 C:The function cannot be executed successfully D:After the function is executed, the value of a is 100
答案:They perform rituals and get momentary relief from the anxiety.
A:mutator B:constructor C:stator D:accessor
答案:Both of the aboveAI参考:答案D:Accessor。在这个问题中,选项A和B是与对象的属性设置和构造函数相关的方法,不符合问题的描述;选项C“stator”在此处并没有具体的意义或定义,不适用;选项D“accessor”是一种用于访问对象实例变量的方法,也就是用来获取或设置对象的属性值的方法,与问题的描述相符合。因此,答案为D,即accessor。'
A:sequence of tuples B:dictionary C:bool D:int
AI参考:在Python中,items()方法返回一个字典中所有项的键值对列表,因此它返回的是一个元组的序列(sequence of tuples)。所以,正确答案是A:sequence of tuples。'
A:77106327311898 B:74103277011595 C:75104277111696 D:76105327211797
AI参考:正确答案是D:76105327211797。根据题干中的描述,Li Hua忘记了QQ密码,但记得密码是ASCII码对应他的名字“Li Hua”,因此选项中只有D选项的ASCII码与“Li Hua”对应,所以D选项是正确答案。'
A:All of the manipulation of the object’s data should be done through the methods. B:At each step in the design, try to find the simplest approach that will solve the problem. C:Candidate objects can be found by looking at the verbs in a problem description. D:Use top-down design to refine the nontrivial methods.
AI参考:正确选项是C: Candidate objects can be found by looking at the verbs in a problem description。这个选项不符合OOD的指导原则,因为它的关注点是在问题描述中的动词,而不是面向对象的设计原则和对象之间的关系。其他选项A、B和D都是OOD的指导原则,A选项要求通过方法来对对象的数据进行所有的操作,B选项要求在设计过程中的每个步骤都尝试找到最简单的解决方案,D选项要求使用自顶向下的设计来改进非平凡的方法。C选项与OOD无关,因此是唯一不符合OOD指导原则的选项。'
A:2 B:3 C:-1 D:1
AI参考:正确答案是D:1。根据图像,该函数的输出为1。图像中的曲线表示函数图像,横坐标表示输入值,纵坐标表示输出值。图像中可以看出,当输入值为0时,输出值为1。因此,答案为D。'
A:functions B:programs C:loops D:objects
AI参考:在顶层设计中,设计的子组件是:D: 对象。在顶层设计中,设计是由多个子组件组成的,这些子组件通常被称为“对象”。这些对象可以是任何东西,例如一个按钮、一个图像、一个文本框等。这些对象可以被视为设计中的基本组成部分,并且可以在设计过程中进行操作和修改。其他选项如功能、程序和循环都不是顶层设计中的子组件。'
A:3 B:-3 C:9 D:3.0
AI参考:答案为C:9。数学中,sqrt表示求平方根,所以9的平方根是3,所以答案是C。'
A:copy B:clone C:duplicate D:getMouse
AI参考:正确答案是B:clone。在graphics.py中,提供了clone方法用于复制图形对象。A选项copy可能是另一个库或模块中的方法,而duplicate通常用于复制数据结构,如列表或字典。getMouse不是图形对象的方法。因此,B选项clone是正确的答案。'
A:an exception handler B:two-way decision C:simple decision D:multi-way decisions
AI参考:单选题最类似于( )的选项是:B:two-way decision。因为单选题通常是一个简单的决策问题,只有一个正确答案,而two-way decision则表示有两个或多个可能的答案,这与单选题的特性相符。而其他选项A、C、D都不符合单选题的特性。A选项的exception handler通常用于处理异常情况,C选项的simple decision通常用于描述简单的决策过程,D选项的multi-way decisions通常用于描述多路径决策过程。因此,B选项two-way decision是最符合单选题特性的选项。'
A:end-of-file loop B:infinite loop C:interactive loop D:sentinel loop
AI参考:选项D“sentinel loop”是正确答案。一个持续运行直到特殊值输入的循环模式被称为“sentinel loop”,这里的“sentinel”是一个标志或标记,用于指示循环的结束。在许多编程语言中,sentinel通常是一个特殊的输入值,当该值被输入时,循环就会停止。因此,选项D“sentinel loop”是符合题目要求的正确答案。选项A“end-of-file loop”指的是文件结束时的循环,选项B“infinite loop”指的是无限循环,选项C“interactive loop”指的是交互式循环,这些选项都不符合题目要求。'
A:keys B:get C:sort D:clear
答案:b97AI参考:选项A:keys不是字典方法。在Python中,字典是一种数据结构,用于存储键值对。keys()方法返回一个包含字典中所有键的迭代器。get()方法用于从字典中获取指定键对应的值。sort()方法用于对字典中的键或值进行排序。clear()方法用于清空字典中的所有键值对。因此,只有A选项不是字典方法。'
A:setText () B:setFace() C:getText () D:getAnchor ()
AI参考:在graphics.py这个文件中,要返回当前在entry box中的字符串文本,应该使用getText()方法。所以,正确答案是C。setText()方法用于设置文本框中的文本内容。setFace()方法通常用于设置文本框中的字体样式。getAnchor()方法通常用于获取锚点信息,与文本框无关。因此,选项A、B和D都不符合题意。'
A:sqrt(16) * 3 + 1 ==13 B:True C:False D:13
答案:They perform rituals and get momentary relief from the anxiety.AI参考:正确选项是 C:False。给出的代码片段是一个简单的比较语句,使用了Python的运算符和条件判断。语句“import math”导入了math模块,并使用了sqrt函数来计算16的平方根。然后,使用print语句输出结果并与13进行比较。由于sqrt(16) * 3的结果为4.8923,而4.8923 + 1的结果为5.8923,不等于13,因此输出结果为False。所以,选项C是正确的答案。'
A:upper B:capitalize C:small D:lower
AI参考:正确答案是D:lower。lower方法是用来将字符串中的所有字符转换为小写字母的。其他选项中,upper是将字符串中的所有字符转换为大写字母的方法,capitalize是将字符串的第一个字符转换为大写字母,而small并不是一个标准的字符串方法。因此,答案为D。'
A:round(4.6) B:float(4.6) C:int(4.9) D:float(5.2)
AI参考:输出5.0的选项是A:round(4.6)。解释:* A: round(4.6) 会将4.6四舍五入为5.0。* B: float(4.6) 会将4.6转换为浮点数,输出结果为4.6。* C: int(4.9) 会将4.9转换为整数,输出结果为4。* D: float(5.2) 会将5.2转换为浮点数,输出结果为5.2。因此,只有A选项的输出为5.0。'
A:slicing B:Python C:indexing D:caffeine
AI参考:正确答案是C:indexing。在数学中使用下标的方法,程序员使用的是计算机编程语言中的索引功能,选项C中的“indexing”表示的就是索引的功能,因此选C。A选项的“slicing”是指切片,主要用于Python语言中,但也不是程序员使用的方式;B选项的“Python”是编程语言的一种,程序员并不会用它来进行下标操作;D选项的“caffeine”显然不是一种编程语言或技术,与问题无关。'
A:magenta B:Yellow C:Blue D:Bright red
AI参考:答案:A推理过程:红色(255, 0, 0)对应的颜色为Magenta,所以选A。'
A:polymorphism B:inheritance C:encapsulation D:generality
A:4 B:5 C:7 D:6
A:random() >= 66 B:random() < 66 C:random() >= 0.66 D:random() < 0.66
A:“who” vs. “why” B:“who” vs. “how” C:“what” vs. “how” D:“what” vs. “why”
AI参考:从设计的角度来看,封装是将“谁”和“为什么”的功能分离,正确答案是A。在面向对象的设计中,封装是一种重要概念,它将数据(变量)和操作数据的方法捆绑在一起,形成一个整体。这种封装方式将数据的访问和修改控制在一个特定的范围内,保护数据不被外界直接访问和修改,而是通过提供的方法来实现对数据的操作和控制。因此,“谁”指的是对象的实例或对象自身,“为什么”则指的是操作对象的原因或目的。从封装的角度来看,这两种功能的分离可以提高代码的可维护性和可复用性。因此,选项A“who” vs. “why” 是正确的答案。'
A:expected return values B:implementation details C:name D:parameters
A:event loop B:infinite loop C:loop and a half D:sentinel loop
A:错 B:对
A:对 B:错
AI参考:答案是B:错。 round(21.6) % 6的结果应该是5.0,而不是3.0。在数学中,对一个浮点数执行模运算(%)通常返回一个整数结果。如果要对一个浮点数进行取整,可以使用round()函数或其他适当的取整函数。因此,这个判断题是错误的。"
A:对 B:错
AI参考:答案:A。根据图形,Circle(Point(3,4),10)表示创建一个以(3,4)为中心,直径为10的圆。因此,这个判断题是正确的。"
A:错 B:对
AI参考:答案是B:对。在Python中,参数是通过值传递的。这意味着当函数接收一个参数时,实际上是接收了该参数的值,而不是该参数本身。所以Python是按照值传递的,这就是答案B:对。"
A:对 B:错
A:对 B:错
A:错 B:对
AI参考:正确答案是【B:对】。 传递的值如果是可变对象,那么对对象进行的修改可能会被调用者看到。因此,这个判断题是正确的。"
A:错 B:对
A:错 B:对
AI参考:正确答案是B:对。 在面向对象编程中,一个对象可以有多个实例变量,它们是对象的状态属性。因此,这个判断题的答案是B,即一个对象可以有多个实例变量。"
A:错 B:对
AI参考:正确答案是B:对。 根据图形库graphics.py中的Oval(a, b)函数,它会在由参数a和b确定的边界框中创建一个椭圆形。因此,这个判断题的答案是B,即“对”。"
A:错 B:对
AI参考:答案是B:对。在Python中,条件表达式允许使用小于等于(<=)和大于等于(>=)等符号,因此选项B是正确的。"
A:错 B:对
A:错 B:对
A:对 B:错
A:错 B:对
A:对 B:错
AI参考:答案是B:错。在涉及决策结构的问题中,通常存在多个正确的解决方案。决策结构通常涉及到多个因素和变量,因此对于同一问题可能有多种不同的解决方案。因此,这个判断题是错误的。"
A:错 B:对
AI参考:正确答案是【对】。Python会在特定情况下自动将数字从一种数据类型转换为另一种数据类型。例如,整数可以自动转换为浮点数,反之亦然。Python还支持不同数据类型之间的其他转换,如将字符串转换为数字等。因此,这个陈述是正确的。"
A:错 B:对
AI参考:答案是“错”。开发人员应该根据项目的具体需求和团队的能力来选择适合的设计方法,而不是只使用其中一种设计方法。因此,选项A“错”是正确的答案。"
A:错 B:对
A:错 B:对
A:对 B:错
AI参考:答案:B:错。 这个判断题的意思是:没有明确返回值的函数会返回特殊的对象Null。这是错误的。在许多编程语言中,没有明确返回值的函数通常会返回一个默认值或者引发一个异常,而不是Null。因此,这个陈述是不准确的。"
A:错 B:对
A:错 B:对
AI参考:答案是B:对。在Python中,迭代文件中的每一行最简单的方法是使用while循环。这是一种正确的答案。"
A:对 B:错
AI参考:答案是B:错。Python中的字典(dictionary)不是一种序列(sequence),而是一种映射(mapping)。字典是一种存储键值对的数据结构,它不遵循序列的顺序规则。因此,这个判断题是错误的。"