1) What is a correct syntax to output 'Hello World' in Python? a) print('Hello World') b) echo 'Hello World' c) printf('Hello World') d) cout << 'Hello World' e) System.out.println('Hello World') f) Console.WriteLine('Hello World') 2) How do you insert COMMENTS in Python code? a) // This is a comment b) # This is a comment c) <!-- This is a comment --> d) /* This is a comment */ e) REM This is a comment f) COMMENT This is a comment 3) Which of the following is a mutable data type in Python? a) Tuple b) List c) String d) Integer e) Float f) Boolean 4) How do you start a function in Python? a) function myFunction() b) def myFunction() c) create myFunction() d) start myFunction() e) begin myFunction() f) init myFunction() 5) Which keyword is used for function in Python? a) func b) define c) def d) function e) declare f) create 6) How do you create a variable with the numeric value 5? a) x = 5 b) int x = 5 c) x := 5 d) x <- 5 e) x == 5 f) x = 5.0 7) Which operator is used to multiply numbers in Python? a) * b) x c) ^ d) % e) & f) @ 8) Which of the following is a valid variable name in Python? a) 1variable b) variable_1 c) variable-1 d) variable 1 e) variable.one f) variable#1 9) What is the output of print(2 ** 3)? a) 6 b) 8 c) 9 d) 5 e) 4 f) 10 10) Which method can be used to remove any whitespace from both ends of a string? a) strip() b) trim() c) cut() d) remove() e) delete() f) erase() 11) Which of the following is used to define a block of code in Python? a) {} b) () c) [] d) Indentation e) <> f) // 12) What is the correct file extension for Python files? a) .py b) .python c) .pt d) .pyt e) .pyth f) .p 13) How do you create a dictionary in Python? a) {key: value} b) [key: value] c) (key: value) d) <key: value> e) key: value f) key = value 14) Which of the following is not a Python data type? a) Set b) Array c) List d) Tuple e) Dictionary f) String 15) Which function is used to get the length of a list in Python? a) length() b) len() c) size() d) count() e) measure() f) getLength() 16) What is the output of print(10 // 3)? a) 3.33 b) 3 c) 3.0 d) 4 e) 2 f) 2.5 17) Which keyword is used to create a class in Python? a) class b) Class c) define d) create e) object f) new 18) How do you create a set in Python? a) set() b) {} c) [] d) () e) <> f) set{} 19) What is the correct syntax to import a module named 'math'? a) import math b) include math c) require math d) use math e) load math f) attach math 20) Which of the following is used to handle exceptions in Python? a) try/except b) catch/throw c) handle/error d) try/catch e) begin/rescue f) error/handle
0%
Python Coding Quiz
共享
共享
共享
由
Tylerl27
编辑内容
打印
嵌入
更多
作业
排行榜
显示更多
显示更少
此排行榜当前是私人享有。单击
,共享
使其公开。
资源所有者已禁用此排行榜。
此排行榜被禁用,因为您的选择与资源所有者不同。
还原选项
问答游戏
是一个开放式模板。它不会为排行榜生成分数。
需要登录
视觉风格
字体
需要订阅
选项
AI增强版:本活动包含AI生成的内容。
了解更多信息。
切换模板
显示所有
播放活动时将显示更多格式。
打开成绩
复制链接
QR 代码
删除
恢复自动保存:
?