#641. 模拟1

模拟1


选择题

  1. 下列哪个选项可以正确地将字符串 "42" 转换为整数? {{ select(1) }}
  • int("42")
  • str(42)
  • float("42")
  • bool("42")
  1. 执行以下代码后,变量 x 的值是多少?

    x = 10
    y = 3
    x %= y
    

    {{ select(2) }}

  • 1
  • 3
  • 0
  • 10
  1. 在 Turtle 中,要绘制一个边长为 100 的正方形,以下哪段代码是正确的? {{ select(3) }}
  • for i in range(4):
        turtle.forward(100)
        turtle.left(90)
    
  • for i in range(3):
        turtle.forward(100)
        turtle.left(120)
    
  • turtle.circle(100)
    
  • turtle.forward(100)
    turtle.left(45)
    turtle.forward(100)
    
  1. 下列关于 Python 变量命名的说法,正确的是? {{ select(4) }}
  • 变量名可以以数字开头
  • 变量名不能包含下划线
  • 变量名区分大小写
  • if 可以作为变量名
  1. 运行 print(5 == 5.0) 的结果是? {{ select(5) }}
  • True
  • False
  • 5
  • 5.0
  1. 以下哪个表达式的值为 False? {{ select(6) }}
  • not (3 > 5)
  • 10 != 9
  • 7 <= 6
  • 'a' == 'a'
  1. 在 IDLE 中,如何退出交互模式? {{ select(7) }}
  • 输入 quit()
  • 输入 exit()
  • 关闭窗口
  • 以上都可以
  1. 已知 a = Trueb = False,则表达式 a and not b 的值是? {{ select(8) }}
  • True
  • False
  • None
  • 报错
  1. 下列哪条语句能正确输出 “Hello, World!”? {{ select(9) }}
  • print(Hello, World!)
  • print("Hello, World!")
  • echo "Hello, World!"
  • console.log("Hello, World!")
  1. 执行以下代码的输出是什么?

    print("Python" * 2)
    

    {{ select(10) }}

  • Python2
  • Python Python
  • PythonPython
  • 报错
  1. 要计算 2 的 8 次方,应使用以下哪个表达式? {{ select(11) }}
  • 2 ^ 8
  • 2 ** 8
  • pow(2, 8)
  • B 和 C 都对
  1. 下列哪项不是 Python 的关键字? {{ select(12) }}
  • def
  • return
  • variable
  • import
  1. 在 Turtle 中,turtle.penup() 的作用是? {{ select(13) }}
  • 提起画笔,移动时不绘图
  • 放下画笔,开始绘图
  • 清除画布
  • 隐藏海龟图标
  1. 执行 print(type(3.14)) 的输出是? {{ select(14) }}
  • <class 'int'>
  • <class 'float'>
  • <class 'str'>
  • 3.14
  1. 下列哪个选项能正确读取用户输入并转换为整数? {{ select(15) }}
  • input(int())
  • int(input())
  • read(int)
  • scan(int)
  1. 表达式 10 // 3 的结果是? {{ select(16) }}
  • 3.333...
  • 3
  • 4
  • 1
  1. 以下代码运行后,输出结果是?

    a = 5
    b = a
    a = 10
    print(b)
    

    {{ select(17) }}

  • 5
  • 10
  • 15
  • 0
  1. 在 Turtle 中,要将画笔颜色设为蓝色,应使用? {{ select(18) }}
  • turtle.color("blue")
  • turtle.bgcolor("blue")
  • turtle.fillcolor("blue")
  • turtle.shape("blue")
  1. 下列哪个逻辑表达式等价于 x > 5 and x < 10? {{ select(19) }}
  • 5 < x < 10
  • x >= 5 or x <= 10
  • not (x <= 5 or x >= 10)
  • A 和 C 都对
  1. 执行 print(bool(0)) 的结果是? {{ select(20) }}
  • True
  • False
  • 0
  • 报错
  1. 以下哪项会导致程序报错? {{ select(21) }}
  • print("123" + "456")
  • print(123 + 456)
  • print("123" + 456)
  • print(str(123) + "456")
  1. 在 Turtle 中,turtle.home() 的作用是? {{ select(22) }}
  • 将画笔回到原点 (0,0),方向朝右
  • 隐藏画笔
  • 清空画布
  • 结束程序
  1. 下列关于注释的说法,错误的是? {{ select(23) }}
  • # 用于单行注释
  • '''""" 可用于多行注释
  • 注释会被 Python 解释器执行
  • 注释有助于提高代码可读性
  1. 执行以下代码的输出是?

    x = 7
    if x % 2 == 0:
        print("偶数")
    else:
        print("奇数")
    

    {{ select(24) }}

  • 偶数
  • 奇数
  • 7
  • 报错
  1. 要导入 math 模块,正确的语句是? {{ select(25) }}
  • import math
  • include math
  • using math
  • require math

判断题

  1. print(10 / 2) 的输出是 5。 {{ select(26) }}
  1. 在 Python 中,"Hello"'Hello' 是等价的。 {{ select(27) }}
  1. turtle.speed(0) 表示画笔速度最慢。 {{ select(28) }}
  1. 变量名 my_var_1 是合法的。 {{ select(29) }}
  1. 3 + "5" 会输出 "35"。 {{ select(30) }}
  1. len("Python") 的返回值是 6。 {{ select(31) }}
  1. False == 0 的结果是 True。 {{ select(32) }}
  1. turtle.circle(50) 默认绘制一个完整的圆。 {{ select(33) }}
  1. 在 IDLE 中,脚本模式需要保存文件后才能运行。 {{ select(34) }}
  1. input() 函数返回的数据类型总是字符串。 {{ select(35) }}