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 代碼
刪除
恢復自動保存:
?