相关试题
【判断题】
定义类时,在一个方法前面使用@classmethod进行修饰,则该方法属于类方法。
【判断题】
定义类时,在一个方法前面使用@staticmethod进行休息,则该方法属于静态方法。
【判断题】
在Python中可以为自定义类的对象动态增加新成员。
【判断题】
属性可以像数据成员一样进行访问,但赋值时具有方法的优点,可以对新值进行检查。
【判断题】
文件对象的tell()方法用来返回文件指针的当前位置。
【判断题】
假设已成功导入os和sys标准库,那么表达式 os.path.dirname(sys.executable) 的值为Python安装目录。
【判断题】
只可以动态为对象增加数据成员,而不能为对象动态增加成员方法。
【判断题】
假设re模块已成功导入,并且有 pattern = re.compile(‘^’+’.’.join([r’\d{1,3}’ for i in range(4)])+’$’),那么表达式 pattern.match(‘192.168.1.103’) 的值为None。
【判断题】
假设random模块已导入,那么表达式 random.sample(range(10), 20) 的作用是生成20个不重复的整数。
【判断题】
假设random模块已导入,那么表达式 random.sample(range(10), 7) 的作用是生成7个不重复的整数。
【判断题】
在Python 3.x中reduce()是内置函数。
【判断题】
以读模式打开文件时,文件指针指向文件开始处。
【判断题】
以追加模式打开文件时,文件指针指向文件尾。
【判断题】
已知x = (1, 2, 3, 4),那么执行x[0] = 5之后,x的值为(5, 2, 3, 4)。
【判断题】
已知x = 3,那么执行x += 6语句前后x的内存地址是不变的。
【判断题】
成员测试运算符in作用于集合时比作用于列表快得多。
【判断题】
在Python 3.x中,使用内置函数input()接收用户输入时,不论用户输入的什么格式,一律按字符串进行返回。
【判断题】
安装Python扩展库时只能使用pip工具在线安装,如果安装不成功就没有别的办法了。
【判断题】
使用random模块的函数randint(1, 100)获取随机数时,有可能会得到100。
【判断题】
如果只需要math模块中的sin()函数,建议使用from math import sin来导入,而不要使用import math导入整个模块。
【判断题】
已知列表x = [1, 2, 3, 4],那么表达式x.find(5)的值应为-1。
【判断题】
列表对象的排序方法sort()只能按元素从小到大排列,不支持别的排序方式。
【判断题】
g = lambda x: 3不是一个合法的赋值表达式。
【判断题】
内置函数len()返回指定序列的元素个数,适用于列表、元组、字符串、字典、集合以及range、zip等迭代对象。
【判断题】
已知x和y是两个等长的整数列表,那么表达式sum((i*j for i, j in zip(x, y)))的作用是计算这两个列表所表示的向量的内积。
【判断题】
已知x和y是两个等长的整数列表,那么表达式[i+j for i,j in zip(x,y)]的作用时计算这两个列表所表示的向量的和。
【判断题】
表达式int(‘1’*64, 2)与sum(2**i for i in range(64))的计算结果是一样的,但是前者更快一些。
【判断题】
已知x = list(range(20)),那么语句del x[::2]可以正常执行。
【判断题】
已知x = list(range(20)),那么语句x[::2] = []可以正常执行。
【判断题】
已知x = list(range(20)),那么语句print(x[100:200])无法正常执行。
【判断题】
已知x是个列表对象,那么执行语句y = x之后,对y所做的任何操作都会同样作用到x上。
【判断题】
已知x是个列表对象,那么执行语句y = x[:]之后,对y所做的任何操作都会同样作用到x上。
【判断题】
在Python中,变量不直接存储值,而是存储值的引用,也就是值在内存中的地址。
推荐试题
【单选题】
He asked the waiter ___ the bill.
A. on
B. of
C. for
D. after
【单选题】
_____ you are leaving tomorrow, we can have dinner together tonight.
A. Since
B. While
C. For
D. Before
【单选题】
I would like to do the job ___ you don't force me to study.
A. in case
B. although
C. though
D. as long as
【单选题】
The reason I did not go abroad was ___ a job in my home town.
A. because
B. due to
C. that I got
D. because of getting
【单选题】
_____ she survived the accident is miracle.
A. What
B. That
C. As
D. Which
【单选题】
I often see ____ the road on his way home.
A. he cross
B. him cross
C. him crossed
D. he crossing
【单选题】
His mother _______ alone since his father died.
A. lived
B. lives
C. has lived
D. is living
【单选题】
The workers are busy _____ models for the exhibition.
A. to make
B. with making
C. being making
D. making
【单选题】
It was well known that Thomas Edison _______ the electric lamp.
A. discovered
B. invented
C. found
D. developed
【单选题】
She wonders ____ will happen to her private life in the future.
A. that
B. it
C. this
D. what
【单选题】
The higher the temperature, _____ the liquid evaporates.
A. the faster
B. the more fast
C. the slower
D. the more slower
【单选题】
Australia is one of the few countries ______ people drive on the left of the road.
A. which
B. that
C. where
D. on which
【单选题】
Sunday is the day ____ people usually don't go to work.
A. when
B. which
C. in which
D. that
【单选题】
____ you know, David has been well lately.
A. Which
B. As
C. What
D. When
【单选题】
The harder you study, _____ you will learn.
A. much
B. many
C. the more
D. much more
【单选题】
They got there an hour _____ than the others.
A. early
B. much early
C. more early
D. earlier
【单选题】
The grey building is the place where the workers live, and the white building is the place where the spare parts ____ .
A. are producing
B. are produced
C. produced
D. being produced
【单选题】
Once environmental damage ______, it takes many years for the system to recover.
A. is to do
B. does
C. had done
D. is done
【单选题】
We worked hard and completed the task ___.
A. in the time
B. on the time
C. ahead of time
D. before time
【单选题】
I didn't expect you to turn _____ at the meeting yesterday.
A. up
B. to
C. out
D. over
【单选题】
I like the teacher _______ classes are very interesting and creative.
A. which
B. who
C. whose
D. what
【单选题】
When Lily came home at 5 p. m. yesterday, her mother ______ dinner in the kitchen.
A. cooked
B. was cooking
C. cooks
D. has cooked
【单选题】
I don’t know the park, but it's _____ to be quite beautiful.
A. said
B. told
C. spoken
D. talked
【单选题】
Mike is better than Peter ____. swimming.
【单选题】
The young lady coming over to us ______ our English teacher; the way she walks tells us that!
A. must be
B. can be
C. would be
D. could be
【单选题】
Eggs, though rich in nourishments, have ______ of fat.
A. a large number
B. the large number
C. a large amount
D. the large amount
【单选题】
Neither John ______his father was able to wake up early enough to catch the morning train.
A. nor
B. or
C. but
D. and
【单选题】
Jane's dress is similar in design ______ her sister's.
A. like
B. with
C. to
D. as
【单选题】
His salary as a driver is much higher than ________.
A. a porter
B. is a porter
C. as a porter
D. that of a porter
【单选题】
_____ these honours he received a sum of money.
A. Except
B. But
C. Besides
D. Outside
【单选题】
Would you let ____ to the park with my classmate, Mum?
A. me go
B. me going
C. I go
D. I going
【单选题】
I have been looking forward to_____ from my parents.
A. hear
B. being heard
C. be heard
D. hearing
【单选题】
The manager will not _____ us to use his car.
A. have
B. let
C. agree
D. allow
【单选题】
_____ her and then try to copy what she does.
A. Mind
B. See
C. Stare at
D. Watch
【单选题】
Will you ___ me a favor, please?
A. do
B. make
C. bring
D. give
【单选题】
It's bad _____ for you to smoke in the public places where smoking is not allowed.
A. behavior
B. action
C. manner
D. movement
【单选题】
The computer system ____ suddenly while he was searching for information on the Internet.
A. broke down
B. broke out
C. broke up
D. broke in
【单选题】
If she wants to keep slim, she must make a ___ in her diet
A. change
B. turn
C. run
D. go
【单选题】
______ the War of Independence, the United States was an English colony.
A.
B. efore B. At
C. In
D. Between
【单选题】
A police officer claimed he had attempted to ____ paying his fare.
A. avoid
B. reject
C. refuse
D. neglect