1) Which of the following is a valid variable name in Python? a) 2name b) my_name c) class d) print 2) "What will this code print? a) HelloWorld b) Hello + World c) Hello World d) Error 3) Which method makes a string all uppercase? a) .upper() b) .capitalize() c) .lower() d) .replace() 4) True or False: A variable name in Python can include spaces. a) TRUE b) FALSE 5) True or False: The len() function can be used to count the number of characters in a string. a) TRUE b) FALSE 6) True or False: Functions in Python must always return a value. a) TRUE b) FALSE 7) "Fill in the blank to get the first character of the string word: a) 0 b) 2 c) 3 d) 1 8) Which of the following is NOT a valid Python data type? a) int b) str c) real d) list 9) "What will this code output? a) ALICE b) alice c) Alice d) Error 10) Which operator is used for exponentiation in Python? a) ^ b) ** c) exp() d) // 11) "What will this code print? a) 2 b) 2.5 c) 3 d) Error 12) True or False: Strings in Python are immutable. a) TRUE b) FALSE 13) Which function is used to find the length of a list or string? a) count() b) size() c) len() d) length() 14) Fill in the blank: The keyword used to return a value from a function is _____. a) return b) yield c) send d) output 15) Which method removes whitespace from both ends of a string? a) strip() b) trim() c) cut() d) split() 16) "What will this code print? a) y b) t c) P d) Error 17) Fill in the blank: To take input from the user, we use the _____ function. a) input() b) read() c) scan() d) ask() 18) "What will this code output? a) 10 b) 55 c) Error 19) Fill in the blank: The built-in function to convert a string to an integer is _____. a) int() b) str() c) float() d) convert() 20) True or False: In Python, you can assign multiple variables in one line. a) TRUE b) FALSE
0%
Variable, Strings, Methods, Functions
共享
共享
共享
由
Theudysmejiaper
10th Grade
Computing
编辑内容
打印
嵌入
更多
作业
排行榜
显示更多
显示更少
此排行榜当前是私人享有。单击
,共享
使其公开。
资源所有者已禁用此排行榜。
此排行榜被禁用,因为您的选择与资源所有者不同。
还原选项
随堂测验
是一个开放式模板。它不会为排行榜生成分数。
需要登录
视觉风格
字体
需要订阅
选项
切换模板
显示所有
播放活动时将显示更多格式。
打开成绩
复制链接
QR 代码
删除
恢复自动保存:
?