Chapter 2

10 试题

1.

Which of the following is a comment in Python?

# This is a test

* This is a test

/* This is a test */

// This is a test

2.

What does the following code print out?

print "123" + "abc"

This is a syntax error because you cannot add strings

hello world

123+abc

123abc

3.

Which of the following is a bad Python variable name?

Spam

_spam

SPAM23

23spam

4.

Which of the following is not a Python reserved word?

iterate

continue

else

break

5.

Assume the variable x has been initialized to an integer value (e.g., x = 3). What does the following statement do?

x = x + 2

This would fail as it is a syntax error

Exit the program

Increase the speed of the program by a factor of 2

Retrieve the current value for x, add two to it, and put the sum back into x

6.

Which of the following elements of a mathematical expression in Python is evaluated first?

Parenthesis ( )

Multiplication *

Addition +

Subtraction -

7.

What is the value of the following expression

42 % 10

Hint - the "%" is the remainder operator

10

1042

2

420

8.

What will be the value of x after the following statement executes:

x = 1 + 2 * 3 - 8 / 4

5

8

2

4

9.

What will be the value of x when the following statement is executed:

x = int(98.6)

98

100

99

6

10.

What does the Python raw_input() function do?

Pause the program and read data from the user

Connect to the network and retrieve a web page.

Read the memory of the running program

Take a screen shot from an area of the screen

Coursera课程Python for everyone:chapter 2相关推荐

  1. Coursera课程Python for everyone:chapter10

    Chapter 10 Quiz 10 试题 1. What is the difference between a Python tuple and Python list? Lists are mu ...

  2. Coursera课程Python for everyone:chapter9

    Chapter 9 Quiz 10 试题 1. How are Python dictionaries different from Python lists? Python lists mainta ...

  3. Coursera课程Python for everyone:chapter8

    Chapter 8 Quiz 10 试题 1. How are "collection" variables different from normal variables? Co ...

  4. Coursera课程Python for everyone:chapter7

    Chapter 7 Quiz 10 试题 1. Given the architecture and terminology we introduced in Chapter 1, where are ...

  5. Coursera课程Python for everyone:chapter6

    Chapter 6 Quiz 10 试题 1. What does the following Python Program print out? str1 = "Hello" s ...

  6. Coursera课程Python for everyone:chapter5

    Chapter 5 10 试题 1. What is wrong with this Python loop: n = 5 while n > 0 :print n print 'All don ...

  7. Coursera课程Python for everyone:chapter4

    Chapter 4 10 试题 1. Which Python keyword indicates the start of a function definition? def help sweet ...

  8. Coursera课程Python for everyone:chapter3

    Chapter 3 10 试题 1. What do we do to a Python statement that is immediately after an if statement to ...

  9. Coursera课程Python for everyone:Quiz: Many-to-Many Relationships and Python

    Many-to-Many Relationships and Python 9 试题

最新文章

  1. category使用 objc_setAssociatedObject/objc_getAssociatedObject 实现添加属性
  2. 图像重建算法_降噪重建技术路在何方?
  3. mysql jdbc无法连接_jdbc无法连接mysql
  4. struts2 跳转类型 result type=chain、dispatcher、redirect
  5. Karma和Jasmine自动化单元测试
  6. Android之Lollipop DevicePolicyManager学习(下)
  7. android 复制字符串,Cocos2dx 复制文本到剪切板(Android 和 ios)
  8. 清华大学医学院 | 体外成熟人卵单细胞多组学研究及总结干细胞分化为配子进展文章...
  9. 计组之数据运算:12、加法器设计
  10. windows环境 logstash file input fail 解决
  11. struts2上传文件
  12. JavaScriptJQ 004_JS闭包
  13. idea git将多余的代码提交到本地,如何退回。
  14. 计算机ppt咋弄,ppt打不开怎么办?教您详细解决方法
  15. m4a怎么转换成mp3,m4a转mp3方法
  16. python好学么零基础_python编程好学吗 自学行吗
  17. 正点原子开发板STM32F407ZG-基于AD7606进行八路数据采集
  18. [转] 教师的备课主要解决哪些问题?
  19. Anaconda入门:安装及包与环境的管理(conda命令)
  20. 常用的行列式和矩阵的性质

热门文章

  1. 谈无人车安卓为时尚早,投自动驾驶有三个标准
  2. 天通苑海鲜餐馆数据调查,很难想象消费越贵越受欢迎
  3. mysql服务重启后不见了_一次诡异的Mysql服务不断重启故障排查
  4. Java Review - 并发编程_抽象同步队列AQS
  5. JVM - CMS深度剖析
  6. Oracle-等待事件解读
  7. 常用的20个正则表达式
  8. NavigationDrawer和NavigationView-Android M新控件
  9. python多线程下载m3u8文件,python 实现多线程下载m3u8格式视频并使用fmmpeg合并
  10. 字符串工具类---StringUtils