MOOC 程序设计基础(李丹程)(东北大学)1461046171 最新慕课完整章节测试答案
万物的抽象
万物的抽象单元测验
1、判断题:
类是一种数据类型,它由属性和方法组成。Class is a data type consisting of attributes and methods.
选项:
A: 正确
B: 错误
答案: 【 正确】
2、判断题:
对象是类的实例。Objects are instances of classes.
选项:
A: 正确
B: 错误
答案: 【 正确】
3、判断题:
要想指明属性Side在类的外部不能被引用,在定义类的时候,需要把关键字public放到Side声明的前面。To specify that the attribute Side cannot be referenced outside the class, you need to put the keyword public in front of the Side declaration when defining the class.
选项:
A: 正确
B: 错误
答案: 【 错误】
4、判断题:
要想指明方法SetSide()在类的外部不能被引用,在定义类的时候,需要把关键字private放到SetSide()声明的前面。To specify that the method SetSide () cannot be referenced outside the class, you need to put the keyword private ahead of the SetSide () declaration when defining the class.
选项:
A: 正确
B: 错误
答案: 【 正确】
5、判断题:
将数据与操作打包成一个单位,这种OOP的特性称为封装。Packaging data and operations into a single unit is a feature of OOP called encapsulation.
选项:
A: 正确
B: 错误
答案: 【 正确】
6、判断题:
允许基于已有类来创建新类的OOP特性称为继承。The OOP feature that allows new classes to be created based on existing classes is called inheritance.
选项:
A: 正确
B: 错误
答案: 【 正确】
7、判断题:
允许不同类的对象使用同一个方法的不同变体的能力,这种OOP的特性称为多态。The ability to allow objects of different classes to use different variants of the same method is called polymorphism.
选项:
A: 正确
B: 错误
答案: 【 正确】
8、判断题:
当基于已有类创建子类的时候,已有类称为子类或派生类,这个新类称为父类或基类。When subclasses are created based on existing classes, existing classes are called subclasses or derived classes, and this new class is called parent or base classes.
选项:
A: 正确
B: 错误
答案: 【 错误】
9、判断题:
当基于已有类创建子类的时候,已有类称为父类或基类,这个新类称为子类或派生类。When subclasses are created based on existing classes, existing classes are called parent classes or base classes, and this new class is called subclasses or derived classes.
选项:
A: 正确
B: 错误
答案: 【 正确】
10、判断题:
与面向对象程序设计相比,自顶向下的模块化程序设计称为面向过程设计。Compared with object-oriented programming, top-down modular programming is called process-oriented design.
选项:
A: 正确
B: 错误
答案: 【 正确】
内存中的数据组织
内存中的数据组织单元测验
1、判断题:
数组中的元素在计算机内存中连续存储。Elements in arrays are stored continuously in computer memory.
选项:
A: 正确
B: 错误
答案: 【 正确】
2、判断题:
用下标变量(数组)的一个好处是,与相同数量的无下标变量相比,它占用的存储空间更少。One advantage of using subscript variables (arrays) is that it takes less storage space than the same number of non-subscript variables.
选项:
A: 正确
B: 错误
答案: 【 错误】
3、判断题:
如果一个声明语句分配100个存储空间给一个数组,那么程序必须给这个数组的100个元素都赋值。If allocates 100 storage spaces to an array, the program must assign 100 elements to the array.
选项:
A: 正确
B: 错误
答案: 【 错误】
4、判断题:
下面的语句:Declare Array1[10], Array2[20] As Integer为200个变量分配了空间。The following statement:Declare Array 1 [10], Array 2 [20] As IntegerStorage space was allocated for 200 variables.
选项:
A: 正确
B: 错误
答案: 【 错误】
5、判断题:
在两个平行数组中,所有对应的元素都必须数据类型相同。In both parallel arrays, all corresponding elements must have the same data type.
选项:
A: 正确
B: 错误
答案: 【 错误】
6、判断题:
冒泡排序方法不能用来把数值数据按照降序排序。 Bubble sorting cannot be used to sort numeric data in descending order.
选项:
A: 正确
B: 错误
答案: 【 错误】
7、判断题:
二分查找法只能用于数值型数据。Binary search method can only be used for numerical data.
选项:
A: 正确
B: 错误
答案: 【 错误】
8、判断题:
在使用二分查找法之前要求数据已经排好序。Before using the binary search method, the data should be ordered.
选项:
A: 正确
B: 错误
答案: 【 正确】
9、判断题:
如下声明的数组Character,它表示的字符串长度为10:Declare Chr[10] As CharacterThe array Character declared below represents a string length of 10:Declare Chr [10] As Character
选项:
A: 正确
B: 错误
答案: 【 错误】
10、判断题:
一维数组和二维数组必须在同一个语句中声明。One-dimensional arrays and two-dimensional arrays must be declared in the same statement.
选项:
A: 正确
B: 错误
答案: 【 错误】
11、判断题:
如果知道100个元素被分配到二维数组A中,则A的两个下标都必须是从0到9,即A必须是10行和10列。If you know that 100 elements are assigned to a two-dimensional array A, the two subscripts of A must be from 0 to 9, that is, A must be 10 rows and 10 columns.
选项:
A: 正确
B: 错误
答案: 【 错误】
12、判断题:
在用冒泡排序对数5、30、25、15进行升序排序的过程中,进行了3次交换。In the bubble sort ascending order of number 5, 30, 25 and 15, three exchanges were made.
选项:
A: 正确
B: 错误
答案: 【 正确】
13、判断题:
因为Score1数组、Score2数组和Score3数组的大小相同,并且相应元素包含相关数据,所以它们叫做平行(parallel)数组。Because Score1, Score2 and Score3 are of the same size and the corresponding elements contain relevant data, they are called parallel arrays.
选项:
A: 正确
B: 错误
答案: 【 正确】
外存中的数据组织
外存中的数据组织单元测验
1、判断题:
数据文件可以被一个以上的程序使用。Data files can be used by more than one program.
选项:
A: 正确
B: 错误
答案: 【 正确】
2、判断题:
数据文件可以保存程序的输出,以备将来使用。Data files can save the output of the program for future use.
选项:
A: 正确
B: 错误
答案: 【 正确】
3、判断题:
文字处理软件被设计成能读入所有的二进制文件。Word processing software is designed to input all binary files.
选项:
A: 正确
B: 错误
答案: 【 错误】
4、判断题:
如果一个文件以Output模式打开,但是该名字的文件已经在硬盘目录中存在,那么后者的所有内容都会被删除。If a file is opened in output mode, but the name of the file already exists in the hard disk directory, then all the contents of the file will be deleted.
选项:
A: 正确
B: 错误
答案: 【 正确】
5、判断题:
当文件以Input模式打开时,数据可以被程序写入到这个文件中。When the file is opened in Input mode, the data can be written to the file by the program.
选项:
A: 正确
B: 错误
答案: 【 错误】
6、判断题:
当文件关闭时,文件内部名和外部名之间的联系就会中止。When the file closes, the connection between the internal and external names of the file stops.
选项:
A: 正确
B: 错误
答案: 【 正确】
7、判断题:
如果要改变顺序文件中的单个记录,那么整个文件都要被改写到一个临时文件中。If you want to change a single record in a sequential file, the entire file will be rewritten to a temporary file.
选项:
A: 正确
B: 错误
答案: 【 正确】
8、判断题:
有些程序设计语言包含可以用于追加文件记录的语句。Some programming languages contain statements that can be used to append file records.
选项:
A: 正确
B: 错误
答案: 【 正确】
9、判断题:
将两个按照升序存放数据的顺序文件合并后,合并出来的结果文件也将是按照升序存放的。After merging two sequential files that store data in ascending order, the merged result files will also be stored in ascending order.
选项:
A: 正确
B: 错误
答案: 【 正确】
10、判断题:
要合并两个顺序文件,则必须先以Output模式打开它们。To merge two sequential files, you must first open them in output mode.
选项:
A: 正确
B: 错误
答案: 【 错误】
如何与计算机对话
如何与计算机对话单元测验
1、判断题:
解决问题的过程是分析问题,设计适当的程序,编写代码,测试代码,这一过程称为软件开发周期。The process of solving a problem by analyzing it, designing an appropriate program, coding the design, and testing the code is known as the software development cycle.
选项:
A: 正确
B: 错误
答案: 【 正确】
2、判断题:
分析问题的时候,我们通常先要确定程序生成的结果,即程序的输入。When analyzing a problem, we usually start by identifying the results we want the program to produce; that is, the program's input.
选项:
A: 正确
B: 错误
答案: 【 错误】
3、判断题:
程序执行开始的模块一般称为子模块。The submodule is the generic name for the module in which program execution begins.
选项:
A: 正确
B: 错误
答案: 【 错误】
4、判断题:
调用模块执行就是使程序执行转移到该模块。To call a module (or subprogram) into action means to cause execution to transfer to that module.
选项:
A: 正确
B: 错误
答案: 【 正确】
5、判断题:
层次结构图是程序模块和模块间的关系的形象化表示。Hierarchical structure diagram is a pictorial representation of a program's modules and the relationships among them.
选项:
A: 正确
B: 错误
答案: 【 正确】
6、判断题:
伪代码用简短的类似英语的短语来描述程序设计。Pseudocode makes use of short, English-like phrases to describe the design of a program.
选项:
A: 正确
B: 错误
答案: 【 正确】
7、判断题:
首部注释给出了程序或程序模块的一般性描述。Header comment provides a general description of a program or program module.
选项:
A: 正确
B: 错误
答案: 【 正确】
8、判断题:
步骤注释给出了代码段的说明。Step comment provides an explanation of a portion of code.
选项:
A: 正确
B: 错误
答案: 【 正确】
9、判断题:
逻辑错误违背了程序设计语言对于语句结构的规定。Logic error is a violation of a programming language’s rules for the structure of statements.
选项:
A: 正确
B: 错误
答案: 【 错误】
10、判断题:
语法错误是因为语句没有正确实现应完成的任务。Syntax error results from statements that do not properly perform their intended task.
选项:
A: 正确
B: 错误
答案: 【 错误】
如何做决定
如何做决定单元测验
1、单选题:
如下哪个表达式同NOT(A>B)是等价的:Which of the following expressions is equivalent to NOT (A > B):
选项:
A: A<B
B: A<=B
C: B<A
D: B<=A
答案: 【 A<=B】
2、单选题:
如下哪个表达式同A>8 AND A<18是等价的?Which of the following expressions is equivalent to A > 8 AND A < 18?
选项:
A: NOT(A<8)AND NOT(A>18)
B: NOT(A<=8)AND NOT(A>=18)
C: NOT(A>8 OR A<18)
D: A<8 OR A>18
答案: 【 NOT(A<=8)AND NOT(A>=18)】
3、单选题:
多选结构不能用下列哪种方法实现:Multiple-choice structure cannot be implemented in which of the following ways:
选项:
A: 单个If结构
B: 多个If结构
C: 多个If-Else结构
D: 单个Switch语句
答案: 【 单个If结构】
4、单选题:
术语防御性编程指的是:The term defensive programming refers to:
选项:
A: 确保输入数据在正确的范围内
B: 确保不发生被0除的情况
C: 确保求平方根操作合法
D: 以上都对
答案: 【 以上都对】
5、判断题:
令X=0,则下列表达式为真。The expression is true or false if X = 0.X>=0
选项:
A: 正确
B: 错误
答案: 【 正确】
6、判断题:
令X=0,则下列表达式为真。The expression is true or false if X = 0.2*X+1 != 1
选项:
A: 正确
B: 错误
答案: 【 错误】
7、判断题:
令First="Ann",则下列表达式为真。The expression is true or false if First="Ann".First=="ann"
选项:
A: 正确
B: 错误
答案: 【 错误】
8、判断题:
令First="Ann",则下列表达式为真。The expression is true or false if First="Ann".First!="Ann"
选项:
A: 正确
B: 错误
答案: 【 错误】
9、判断题:
令First="Ann",则下列表达式为真。The expression is true or false if First="Ann".First<"Nan"
选项:
A: 正确
B: 错误
答案: 【 正确】
10、判断题:
令First="Ann",则下列表达式为真。The expression is true or false if First="Ann".First>="Anne"
选项:
A: 正确
B: 错误
答案: 【 错误】
11、判断题:
令X=1且Y=2,则下列表达式为真。The expression is true or false if X=1 and Y=2.X>=X OR Y>=X
选项:
A: 正确
B: 错误
答案: 【 正确】
12、判断题:
令X=1且Y=2,则下列表达式为真。The expression is true or false if X=1 and Y=2.X>X AND Y>X
选项:
A: 正确
B: 错误
答案: 【 错误】
13、判断题:
令X=1且Y=2,则下列表达式为真。The expression is true or false if X=1 and Y=2.X>Y OR X>0 AND Y<0
选项:
A: 正确
B: 错误
答案: 【 错误】
14、判断题:
令X=1且Y=2,则下列表达式为真。The expression is true or false if X=1 and Y=2.NOT(NOT(X==0)AND NOT(Y==0))
选项:
A: 正确
B: 错误
答案: 【 错误】
15、判断题:
令X=0且Response="Yes",则下列表达式为真。The expression is true or false if X=0 and Response="Yes".(X==1) OR (Response=="Yes")
选项:
A: 正确
B: 错误
答案: 【 正确】
16、判断题:
令X=0且Response="Yes",则下列表达式为真。The expression is true or false if X=0 and Response="Yes".(X==1) AND (Response=="Yes")
选项:
A: 正确
B: 错误
答案: 【 错误】
17、判断题:
令X=0,则下列表达式为真。The expression is true or false if X=0 and Response="Yes".NOT(X==0)
选项:
A: 正确
B: 错误
答案: 【 错误】
18、判断题:
令Num1=1且Num2=2,则下列表达式为真。The expression is true or false if Num1=1 and Num2=2.(Num1==1) OR (Num2==2) AND (Num1==Num2)
选项:
A: 正确
B: 错误
答案: 【 正确】
19、判断题:
令Num1=1且Num2=2,则下列表达式为真。The expression is true or false if Num1=1 and Num2=2.((Num1==1) OR (Num2==2)) AND (Num1==Num2)
选项:
A: 正确
B: 错误
答案: 【 错误】
20、判断题:
令Num1=1且Num2=2,则下列表达式为真。The expression is true or false if Num1=1 and Num2=2.NOT(Num1==1) AND NOT (Num2==2)
选项:
A: 正确
B: 错误
答案: 【 错误】
21、判断题:
令Num1=1且Num2=2,则下列表达式为真。The expression is true or false if Num1=1 and Num2=2.NOT(Num1==1) OR NOT (Num2==2)
选项:
A: 正确
B: 错误
答案: 【 错误】
22、判断题:
ASCII编码模式将每一个小写字母、大写字母和其他字符与数值0到127相对应。The ASCII code corresponds to values 0 to 127 for each lowercase, uppercase, and other character.
选项:
A: 正确
B: 错误
答案: 【 正确】
23、判断题:
如果Char1和Char2是字符,那么当且仅当它们的ASCII编码相等时,Char1== Char2。If Char1 and Char2 are characters, then Char1== Char2 if and only if their ASCII code is equal.
选项:
A: 正确
B: 错误
答案: 【 正确】
24、判断题:
如果Name="John",那么Name>" John"。If Name="John", then Name>" John".
选项:
A: 正确
B: 错误
答案: 【 正确】
25、判断题:
如果Name="John",那么Name>="JOHN"。If Name="John", then Name>="JOHN".
选项:
A: 正确
B: 错误
答案: 【 正确】
26、判断题:
"**?"<"***"为真还是为假。"**?"<"***" is true or false.
选项:
A: 正确
B: 错误
答案: 【 错误】
27、判断题:
"** "<"***"为真还是为假。"** "<"***" is true or false.
选项:
A: 正确
B: 错误
答案: 【 正确】
28、判断题:
Case语句可根据字符变量的值来选择一个候选。The Case statement can select a candidate based on the value of the