Week 1. Introduction

Unit Test-Week 1

1、单选题:
​The way to directly enter and execute Python code at the prompt of the Python console is called ______.​
选项:
A: Interactive mode
B: Script mode
C: Code mode
D: Immediate mode
答案: 【 Interactive mode

2、单选题:
‏Among the following functions, ______ is to receive standard input data (that is, input from the keyboard) and return a string.‏
选项:
A: eval
B: input
C: print
D: get
答案: 【 input

3、单选题:
‍Among the following functions, ______ is to output various types of data (string, integer, floating point, list, dictionary, etc.) to the screen.‏
选项:
A: eval
B: input
C: print
D: get
答案: 【 print

4、多选题:
‎The options that belong to the high-level programming language include ______.​
选项:
A: Python language
B: Assembly language
C: Machine language
D: C++ language
答案: 【 Python language;
C++ language

5、多选题:
​Python is the ______ programming language.‌
选项:
A: compiled
B: interpretive
C: high-level
D: low-level
答案: 【 interpretive;
high-level

6、多选题:
‍The statements that don't report error include ______.‍
选项:
A: eval('3+5')
B: eval('3.5*5+6')
C: eval('3.5*/5+6')
D: eval('3a')
答案: 【 eval('3+5');
eval('3.5*5+6')

7、判断题:
​The prompt for the Python console is >>>.‌
选项:
A: 正确
B: 错误
答案: 【 正确

8、判断题:
‍The statement in Python ends with a semicolon.‎
选项:
A: 正确
B: 错误
答案: 【 错误

9、判断题:
‏The comments are to enhance the readability of the program, instead of actually running.‏
选项:
A: 正确
B: 错误
答案: 【 正确

10、判断题:
‌Debugging is to solve syntax errors.‎
选项:
A: 正确
B: 错误
答案: 【 错误

Week 10. Private Attributes and Built-in Methods

Unit Test-Week 10

1、单选题:
‏There is an attribute __id in the Student class, and stu is an object of the Student class. When using stu to access the __id attribute, the correct way is (    ).‍
选项:
A: stu.__id
B: stu._stu__id
C: stu._Student__id
D: stu._Student.__id
答案: 【 stu._Student__id

2、单选题:
‏The method name of the constructor is (    ).‏
选项:
A: __construct__
B: __init__
C: __begin__
D: __start__
答案: 【 __init__

3、多选题:
‌In the following options, the built-in methods that are automatically executed when comparing objects include (    ).‌
选项:
A: __str__
B: __eq__
C: __ne__
D: __nq__
答案: 【 __eq__;
__ne__

4、判断题:
‌The destructor may have no parameters.‎
选项:
A: 正确
B: 错误
答案: 【 错误

5、判断题:
​The __str__ method may return an integer.‏
选项:
A: 正确
B: 错误
答案: 【 错误

Week 11. Inheritance and Polymorphism

Unit Test-Week 11

1、单选题:
‎If a class C1 is created by inheriting the existing class C, then C1 is called (    ) in the inheritance.​
选项:
A: subclass
B: base class
C: parent class
D: super class
答案: 【 subclass

2、单选题:
‌To determine whether a class is a subclass of another class, we should use the built-in function (    ).‏
选项:
A: isinstance
B: issubclass
C: type
D: isclass
答案: 【 issubclass

3、多选题:
‍There is a method fa in class A, there is an attribute b in class B, and there are the method fc and the attribute c in class C. If A is the parent class of B and B is the parent class of C, then the members in class B include (    ).‌
选项:
A: fa
B: b
C: fc
D: c
答案: 【 fa;
b

4、判断题:
‎If a subclass has two or more parent classes, this inheritance relationship is called multiple inheritance.​
选项:
A: 正确
B: 错误
答案: 【 正确

5、判断题:
‌Polymorphism in Python is implemented with the duck types.‏
选项:
A: 正确
B: 错误
答案: 【 正确

Week 12. More for List and Tuple

Unit Test-Week 12

1、单选题:
‌After executing‏‌a=list((1,2))+list((2,3))the value of a is (    ).‏
选项:
A: [1,2,3]
B: [1,2,2,3]
C: (1,2,3)
D: (1,2,2,3)
答案: 【 [1,2,2,3]

2、单选题:
‌After executing the following code‍‌a=[1,2,3]
b=a
a[1]=10the value of b is (    ).‍‌‍
选项:
A: [10,2,3]
B: [1,10,3]
C: [1,2,10]
D: [1,2,3]
答案: 【 [1,10,3]

3、单选题:
‏By using the (    ) method of the list, we can obtain the position of the first matching element according to the specified value.‌
选项:
A: index
B: find
C: search
D: at
答案: 【 index

4、单选题:
‏To calculate the number of elements in the list ls, we should use (    ).​
选项:
A: ls.count()
B: count(ls)
C: ls.len()
D: len(ls)
答案: 【 len(ls)

5、多选题:
‌Among the following options, mutable types include (    ).‌
选项:
A: tuple
B: list
C: string
D: dictionary
答案: 【 list;
dictionary

6、多选题:
‎To add a new element at the end of the list, the methods that can be used include (    ).‎
选项:
A: insert
B: append
C: add
D: push
答案: 【 insert;
append

7、判断题:
‏If the list a contains elements of mutable types, then when assigning a to b, the deepcopy function of the copy module should be used to make the values of the elements in a and b completely independent.‎
选项:
A: 正确
B: 错误
答案: 【 正确

8、判断题:
‏The value of the largest element in the list ls can be obtained through "ls.max()".​
选项:
A: 正确
B: 错误
答案: 【 错误

9、判断题:
‎For the key parameter in the sort method of the list, it must receive a function that has the return value.‍
选项:
A: 正确
B: 错误
答案: 【 正确

10、判断题:
‎Given "t=(True)", t is a tuple.‌
选项:
A: 正确
B: 错误
答案: 【 错误

Week 13. More for Set and Dictionary

Unit Test-Week 13

1、单选题:
‏For the update method of the set, the argument passed in must be (    ).‏
选项:
A: tuple
B: list
C: hashable object
D: iterable object
答案: 【 iterable object

2、单选题:
​To calculate the intersection of two sets, we should use the (    ) method of the set.‍
选项:
A: intersection
B: union
C: difference
D: symmetric_difference
答案: 【 intersection

3、单选题:
​After executing‎​d1={'age':19}
d1.fromkeys(['sno','name'])the number of elements in d1 is (    ).‎
选项:
A: 0
B: 1
C: 2
D: 3
答案: 【 1

4、单选题:
‍After executing‏‍a=dict(x=1,y=2)
b=a
a['y']=10
print(b)the output is (    ).‏
选项:
A: {x=1,y=10}
B: {x=1,y=2}
C: {'x':1,'y':10}
D: {'x':1,'y':2}
答案: 【 {'x':1,'y':10}

5、多选题:
‍Assuming s1 and s2 are two sets, the following options that definitely return True include (    ).‏

剩余75%内容付费后可查看

发表评论

电子邮件地址不会被公开。 必填项已用*标注