Python练习之基本数据类型(二)
1. 下面代码的输出结果是
>>> oct(–255)
A.'–0o377'
B.'0o–377'
C.'0d–377'
D.'–0d377'
2.下面代码的输出结果是
>>> bin(10)
A.'0x1010'
B.'0b1010'
C.'0d1010'
D.'0o1010'
3.给出如下代码 以下选项中描述正确的是
for i in range(6): print(chr(ord(9801)+i),end="")
A.chr ("a")返回"a"字符对应的Unicode编码
B. ord(x)函数返回x的Unicode编码对应的字符
C. 输出结果为♈♉♊♋♌♍
D.系统报错
4.给出如下代码:如下描述错误的是
for i in range(10): print(chr(ord("!")+i),end="")
A.系统报错
B.ord("!")返回"!"字符对应的Unicode编码
C.输出结果为!"#$%&'()*
D.chr(x)函数返回Unicode编码对应的字符
5.下列选项中输出结果是True的是
A.>>> chr(10).isnumeric()
B.>>> chr(13).isprintable()
C.>>> isinstance(255,int)
D.>>> "Python".islower()
6.下面代码的输出结果是
s1 = "The python language is a scripting language." s1.replace('scripting','general') print(s1)
A.The python language is a scripting language.
B.The python language is a general language.
C.['The', 'python', 'language', 'is', 'a', 'scripting', 'language.']
D.系统报错
7.下面代码的输出结果是
s1 = "The python language is a scripting language." s2 = s1.replace('scripting','general') print(s2)
A.The python language is a general language.
B.The python language is a scripting language.
C.系统报错
D.['The', 'python', 'language', 'is', 'a', 'scripting', 'language.']
8.下面代码的输出结果是
s = "The python language is a cross platform language." print(s.find('language',30))
A.11
B.系统报错
C.10
D.40
9.下面代码的输出结果是
s = "The python language is a multimodel language." print(s.split(' '))
A.['The', 'python', 'language', 'is', 'a', 'multimodel', 'language.']
B.Thepythonlanguageisamultimodellanguage.
C.The python language is a multimodel language.
D.系统报错
10.下面代码的输出结果是
a ="Python" b = "A Superlanguage" print("{:->10}:{:-<19}".format(a,b))
A.----Python:A Superlanguage----
B.The python language is a multimodel language.
C.Python----:----A Superlanguage
D.----Python:----A Superlanguage
11.以下选项中,输出结果为False的是
A.>>> 5 != 4
B.>>> 5 is not 4
C.>>> 5 is 5
D.>>> False !=0
12.下面代码的输出结果是
>>> True - False
A.-1
B.1
C.True
D.0
13.下面代码的输出结果是
a = 2 b = 2 c = 2.0 print(a == b, a is b, a is c)
A.True False False
B.True True False
C.True False True
D.False False True
14.以下选项中,输出结果为False的是
A.>>> 'ABCD' == 'abcd'.upper()
B.>>> <'a'
C.>>> 'python' < 'pypi'
D.>>> 'python123' > 'python'
15.下面代码的输出结果是
>>> a,b,c,d,e,f = 'Python' >>> b
A.出错
B.1
C.0
D.‘y’
16.下面代码的输出结果是
>>> a = b = c =123 >>> print(a,b,c)
A.123 123 123
B.出错
C.1 1 123
D.0 0 123
17.下面代码的输出结果是
>>> True / False
A.-1
B.0
C.系统报错
D.True
18.下面代码的输出结果是
x = 1 x *= 3+5**2 print(x)
A.14
B.13
C.28
D.29
19.下面代码的输出结果是
a = 5/3+5//3 print(a)
A.14
B.2.666666666666667
C.3.333333
D.5.4
20.下面代码的输出结果是
a = "alex" b = a.capitalize() print(a,end=",") print(b)
A.alex,Alex
B.ALEX,alex
C.alex,ALEX
D.Alex,Alex
21.下面代码的输出结果是
a = 20 b = a | 3 a &= 7 print(b ,end=",") print(a)
A.6.66667,4
B.23,4
C.4,6.66667
D.4,23
22.下面代码的输出结果是
a = "ac" b = "bd" c = a + b print(c)
A.bdac
B.acbd
C.dbac
D.abcd
23.下面代码的输出结果是
str1 = "mysqlsqlserverPostgresQL" str2 = "sql" ncount = str1.count(str2) print(ncount)
A.4
B.2
C.3
D.5
24.下面代码的输出结果是
>>> True / False
A.出错
B.1
C.False
D.True
25.下面代码的输出结果是
str1 = "mysqlsqlserverPostgresQL" str2 = "sql" ncount = str1.count(str2,10) print(ncount)
A.3
B.2
C.0
D.4