#642. 模拟2

模拟2


选择题

  1. 下列哪个不是Python常见的编程环境? {{ select(1) }}
  • IDLE
  • Visual Studio Code
  • Jupyter Notebook
  • Microsoft Word
  1. 在IDLE中,要新建一个Python文件进行编写,应该选择哪个菜单项? {{ select(2) }}
  • File -> New File
  • File -> Open
  • Run -> Run Module
  • Shell -> Restart Shell
  1. Python程序最基本的结构是“输入、处理、输出”。在以下代码中,哪一行代表了“处理”?

    a = int(input("请输入数字a: ")) # 第1行
    b = int(input("请输入数字b: ")) # 第2行
    c = a + b                        # 第3行
    print("结果是:", c)              # 第4行
    

    {{ select(3) }}

  • 第1行
  • 第2行
  • 第3行
  • 第4行
  1. 下列变量命名中,符合Python规则的是? {{ select(4) }}
  • 2name
  • my-name
  • _score
  • for
  1. 执行 print(type(100)) 的结果是? {{ select(5) }}
  • <class 'str'>
  • <class 'int'>
  • <class 'float'>
  • 100
  1. 要将用户输入的字符串 "78" 转换为整数,应使用哪个函数? {{ select(6) }}
  • str(78)
  • int("78")
  • float("78")
  • bool("78")
  1. 下列哪个表达式的结果是 False? {{ select(7) }}
  • 5 > 3
  • 10 == 10.0
  • 7 != 7
  • 2 <= 5
  1. 已知 x = True, y = False,则 x and y 的值为? {{ select(8) }}
  • True
  • False
  • 1
  • 0
  1. 执行 print(15 // 4) 的输出结果是? {{ select(9) }}
  • 3.75
  • 3
  • 4
  • 12
  1. 在Python中,用于单行注释的符号是? {{ select(10) }}
  • //
  • /* ... */
  • #
  • <!-- ... -->
  1. 下列关于IDLE的说法,正确的是? {{ select(11) }}
  • IDLE只有脚本模式,没有交互模式。
  • 在交互模式下,输入代码后必须按F5才能看到结果。
  • 默认打开IDLE时,进入的是带有 >>> 提示符的交互模式。
  • 在脚本模式中编写的代码无法保存。
  1. 执行以下代码后,变量 result 的值是多少?

    a = 5
    result = a * 2 + 3
    

    {{ select(12) }}

  • 10
  • 13
  • 16
  • 25
  1. 要导入turtle库,正确的语句是? {{ select(13) }}
  • get turtle
  • use turtle
  • import turtle
  • include turtle
  1. 在turtle库中,执行 turtle.forward(100) 后,画笔会如何移动? {{ select(14) }}
  • 向左移动100像素
  • 向右移动100像素
  • 向上移动100像素
  • 向下移动100像素
  1. 如果想让画笔向右转90度,应使用哪个命令? {{ select(15) }}
  • turtle.left(90)
  • turtle.right(90)
  • turtle.turn(90)
  • turtle.rotate(90)
  1. 执行 turtle.penup() 后再执行 turtle.forward(50),会发生什么? {{ select(16) }}
  • 画出一条50像素长的线
  • 画笔移动50像素但不画线
  • 程序报错
  • 画笔回到原点
  1. 下列哪个命令可以画一个半径为50的完整圆形? {{ select(17) }}
  • turtle.circle(50, 180)
  • turtle.circle(50)
  • turtle.circle(100, 50)
  • turtle.draw_circle(50)
  1. 运行 print("Hello" + "World") 的结果是? {{ select(18) }}
  • Hello World
  • Hello+World
  • HelloWorld
  • 报错
  1. 下列哪个保留字不能用作变量名? {{ select(19) }}
  • apple
  • if
  • my_var
  • _temp
  1. 执行 print(8 % 3) 的结果是? {{ select(20) }}
  • 2
  • 2.666...
  • 1
  • 24
  1. 要让画笔回到坐标原点 (0, 0),应使用哪个命令? {{ select(21) }}
  • turtle.goto(0)
  • turtle.origin()
  • turtle.home()
  • turtle.reset()
  1. 执行以下代码,输出结果是什么?

    x = 10
    y = x
    x = 20
    print(y)
    

    {{ select(22) }}

  • 10
  • 20
  • 30
  • 0
  1. 在turtle中,turtle.pensize(5) 的作用是? {{ select(23) }}
  • 设置画笔颜色为5号色
  • 设置画笔粗细为5像素
  • 将画笔移动5个单位
  • 设置画布大小为5x5
  1. 下列哪个逻辑表达式能判断一个数 n 是否为偶数? {{ select(24) }}
  • n / 2 == 0
  • n % 2 == 0
  • n // 2 == 0
  • n == 2
  1. 执行 print(not True) 的结果是? {{ select(25) }}
  • True
  • False
  • 1
  • 0

判断题

  1. 在Python中,变量名 MyVariablemyvariable 是同一个变量。 {{ select(26) }}
  1. 在IDLE的交互模式中,可以直接输入 3 + 5 并按回车得到结果8。 {{ select(27) }}
  1. turtle.clear() 命令会清除画布上的所有图形,并且将画笔重置到初始状态(原点,朝右)。 {{ select(28) }}
  1. 表达式 10 > 5 and 3 < 2 的结果是 True。 {{ select(29) }}
  1. input() 函数获取的用户输入,默认是字符串类型。 {{ select(30) }}
  1. 在Python中,"5" + 3 会得到结果 8。 {{ select(31) }}
  1. turtle.speed(10)turtle.speed(1) 的画笔移动速度更快。 {{ select(32) }}
  1. 注释是写给程序员看的,对程序的运行没有任何影响。 {{ select(33) }}
  1. 执行 print(int(9.8)) 的结果是 9。 {{ select(34) }}
  1. 在turtle中,turtle.fillcolor("red") 用于设置画笔的颜色为红色。 {{ select(35) }}