#P3777. PYAI2-2月考选择题3月

PYAI2-2月考选择题3月

题目描述

单项选择题

1. Pygame 中绘制圆形的标准函数是?()

{{ select(1) }}

  • pygame.draw.round()
  • pygame.draw.circle()
  • pygame.draw.ball()
  • pygame.screen.draw_circle()

2.要获取 Pygame 中所有待处理的事件,应使用哪个函数?()

{{ select(2) }}

  • pygame.event.get()
  • pygame.event.all()
  • pygame.event.fetch()
  • pygame.event.read()

3. 要检测 Pygame 中某个键盘按键是否持续按下,应使用哪个模块的函数?()

{{ select(3) }}

  • pygame.event
  • pygame.key
  • pygame.input
  • pygame.screen

4.关闭 Pygame 并释放资源的函数是?

{{ select(4) }}

  • pygame.quit ()
  • pygame.close ()
  • pygame.stop ()
  • pygame.exit ()

5. 以下哪个代码能正确处理 Pygame 的窗口关闭事件?()

{{ select(5) }}

  • if event.type == pygame.QUIT: pygame.quit()
  • if event == pygame.QUIT: pygame.close()
  • if event.type == pygame.WINDOW_QUIT: pygame.exit()
  • if event.name == "quit": pygame.quit()

6. 以下哪个不是 Pygame 中pygame.draw.rect()的参数?()

{{ select(6) }}

  • 画布对象
  • 颜色值
  • 矩形的坐标和尺寸
  • 矩形的旋转角度

7. 在事件循环中,获取鼠标位置的代码是?

{{ select(7) }}

  • pos = pygame.mouse.get_pos()
  • pos = mouse.pos
  • pos = pygame.mouse()
  • pos = event.mouse()

8. 按下方向键 →,对应的按键常量是?

{{ select(8) }}

  • pygame.RIGHT
  • pygame.RIGHT
  • pygame.K_RIGHT
  • pygame.K_ARROW_RIGHT

9. Pygame 中,pygame.display.update() 的作用是?

{{ select(9) }}

  • 初始化窗口
  • 刷新屏幕显示
  • 关闭窗口
  • 填充颜色

10. 类中的 self 代表什么?

{{ select(10) }}

  • 类本身
  • 当前对象自己
  • 父类
  • 函数

11. 检测鼠标右键按下,判断条件是?

{{ select(11) }}

  • x, y = pygame.mouse.get_pos()
  • x, y = pygame.mouse.pos()
  • x, y = pygame.mouse.position()
  • move_mouse()

12. 使用类创建一个玩家对象,正确写法是?

{{ select(12) }}

  • player = Player()

  • player = new Player()

  • player = class Player()

  • Player = player()

13. 以下哪项是 Pygame 正确绘制直线的代码?

{{ select(13) }}

  • pygame.draw.line(screen, color, start, end, width)
  • pygame.draw.line(start, end, color)
  • pygame.draw.line(color, start, end)
  • pygame.draw.line(screen, start, end)

14. 表示键盘上方向键按下的常量是?

{{ select(14) }}

  • pygame.K_UP
  • pygame.KEY_UP
  • pygame.UP_KEY
  • pygame.K_ARROW_UP

15.以下哪项是 Pygame 正确绘制圆形的代码?

{{ select(15) }}

  • pygame.draw.circle(red, (255,0,0), 100)
  • pygame.draw.circle(screen, (255,0,0), (x,y), radius)
  • pygame.draw.circle((x,y), red, screen)
  • pygame.draw.circle(radius, screen, color)

16. Pygame 中设置帧率的模块是?

{{ select(16) }}

  • pygame.time
  • pygame.clock
  • pygame.fps
  • pygame.timer

17.在 Pygame 中,screen.fill() 的作用是?

{{ select(17) }}

  • 绘制图片
  • 绘制文字
  • 刷新屏幕
  • 填充背景颜色

18. 下列关于 Python 类和对象的说法正确的是?

{{ select(18) }}

  • 类是具体实例,对象是模板
  • 对象是类的具体实例
  • 一个类只能创建一个对象
  • 类不能包含函数

19. Pygame 中绘制直线的正确函数是?

{{ select(19) }}

  • pygame.draw.straight()

  • pygame.draw.line_to()

  • pygame.draw.line()

  • pygame.screen.draw_line()

20.使用 pygame.draw.circle 绘制实心圆,最后一个参数应设为?

{{ select(20) }}

  • 1
  • 10
  • 0
  • 255