2023年5月二级计算机等级考试《Python语言程序设计》职考真题试卷(全国)
一 、 单项 选择 题 ( 共 40 分 , 每 题 2 分 ) 1 . Python 中 , 以下 哪个 语句 可以 正确 输出 “ Hello , World A . ` print ( " Hello , World ! " ) ` B . ` print ( ' Hello , World ! ' ) ` C . ` print ( Hello , World ! ) ` D . ` print ( " Hello , World ! " ) ` 答案 : A2 . 以下 哪个 选项 不是 Python 的 基本 数据 类型 ? A . intB . floatC . listD . str 答案 : C3 . Python 中 , 以下 哪个 函数 用于 获取 用户 输入 ? A . ` input ( ) ` B . ` print ( ) ` C . ` read ( ) ` D . ` write ( ) ` 答案 : A4 . 以下 代码 的 输出 结果 是 什么 ? ` ` ` pythonx = 5 y = 2 print ( x / / y ) ` ` ` A . 2B . 2 . 5C . 3D . 2 . 0 答案 : A5 . 以下 哪个 选项 是 Python 中 的 关键 字 ? A . ` class ` B . ` function ` C . ` variable ` D . ` method ` 答案 : A6 . 以下 代码 的 输出 结果 是 什么 ? ` ` ` pythonmy _ list = [ 1 , 2 , 3 , 4 , 5 ] print ( my _ list [ 2 : 4 ] ) ` ` ` A . ` [ 1 , 2 ] ` B . ` [ 2 , 3 ] ` C . ` [ 3 , 4 ] ` D . ` [ 4 , 5 ] ` 答案 : C7 . 以下 代码 的 输出 结果 是 什么 ? ` ` ` pythonx = 10 ifx > 5 : print ( " Greaterthan 5 " ) else : print ( " Lessthanorequalto 5 " ) ` ` ` A . ` Greaterthan 5 ` B . ` Lessthanorequalto 5 ` 答案 : A8 . 以下 代码 的 输出 结果 是 什么 ? ` ` ` pythonmy _ dict = { ' a ' : 1 , ' b ' : 2 , ' c ' : 3 } print ( my _ dict [ ' b ' ] ) ` ` ` A . ` 1 ` B . ` 2 ` C . ` 3 ` D . ` None ` 答案 : B9 . 以下 代码 的 输出 结果 是 什么 ? ` ` ` pythondefadd ( x , y ) : returnx + yprint ( add ( 3 , 4 ) ) ` ` ` A . ` 7 ` B . ` 3 ` C . ` 4 ` D . ` None ` 答案 : A10 . 以下 代码 的 输出 结果 是 什么 ? ` ` ` pythonforiinrange ( 3 ) : print ( i , end = ' ' ) ` ` ` A . ` 012 ` B . ` 123 ` C . ` 0123 ` D . ` 12 ` 答案 : A11 . 以下 代码 的 输出 结果 是 什么 ? ` ` ` pythonx = 5 y = " 5 " print ( x = = y ) ` ` ` A . ` True ` B . ` False ` 答案 : B12 . 以下 代码 的 输出 结果 是 什么 ? ` ` ` pythonmy _ set = { 1 , 2 , 3 , 4 , 5 } my _ set . add ( 6 ) print ( my _ set ) ` ` ` A . ` { 1 , 2 , 3 , 4 , 5 } ` B . ` { 1 , 2 , 3 , 4 , 5 , 6 } ` 答案 : B13 . 以下 代码 的 输出 结果 是 什么 ? ` ` ` pythonx = " Hello " y = " World " print ( x + " " + y ) ` ` ` A . ` HelloWorld ` B . ` HelloWorld ` 答案 : B14 . 以下 代码 的 输出 结果 是 什么 ? ` ` ` pythonmy _ tuple = ( 1 , 2 , 3 ) print ( my _ tuple [ 1 ] ) ` ` ` A . ` 1 ` B . ` 2 ` C . ` 3 ` 答案 : B15 . 以下 代码 的 输出 结果 是 什么 ? ` ` ` pythonx = 10 y = 5 print ( x % y ) ` ` ` A . ` 0 ` B . ` 1 ` C . ` 2 ` D . ` 5 ` 答案 : A16 . 以下 代码 的 输出 结果 是 什么 ? ` ` ` pythonmy _ list = [ 1 , 2 , 3 ] my _ list . append ( 4 ) print ( my _ list ) ` ` ` A . ` [ 1 , 2 , 3 ] ` B . ` [ 1 , 2 , 3 , 4 ] ` 答案 : B17 . 以下 代码 的 输出 结果 是 什么 ? ` ` ` pythonx = 5 y = 10 print ( xy ) ` ` ` A . ` 50 ` B . ` 15