1) In Python, what is the purpose of the input() function when used with a variable? a) To display output b) To perform mathematical calculations c) To read user input d) To define a new variable 2) Which of the following is a correct way to concatenate two strings stored in variables name1 and name2? a) name1 + name2 b) join(name1, name2) c) concat(name1, name2) d) merge(name1, name2) 3) What is the data type of the variable in the following statement: price = 29.99? a) Integer b) Float c) String d) Boolean 4) Which of the following is a correct way to assign a value to a variable in Python? a) x = 5 b) x := 5 c) value 5 to x d) x >> 5 5) What is the purpose of the if statement in Python? a) To declare a variable b) To perform conditional execution of code c) To create a loop d) To print output 6) In an if-else statement, what happens if the condition in the if block is not met? a) The else block is executed b) An error occurs c) The program terminates d) The if block is re-evaluated 7) How can multiple conditions be combined in an if statement? a) Using the or keyword b) Using both or and and c) Using the and keyword d) Only one condition is allowed 8) What is the purpose of the elif statement in Python? a) To declare a new variable b) To print output c) To handle multiple conditions d) To end the program 9) What is the role of indentation in Python's if-else statements? a) It is optional and does not affect the code b) It is required to define the scope of the code blocks c) It is used for decoration d) It causes errors
0%
Variable and If Statements
共享
共享
共享
由
Asheik
Secondary
编辑内容
打印
嵌入
更多
作业
排行榜
显示更多
显示更少
此排行榜当前是私人享有。单击
,共享
使其公开。
资源所有者已禁用此排行榜。
此排行榜被禁用,因为您的选择与资源所有者不同。
还原选项
随堂测验
是一个开放式模板。它不会为排行榜生成分数。
需要登录
视觉风格
字体
需要订阅
选项
切换模板
显示所有
播放活动时将显示更多格式。
打开成绩
复制链接
QR 代码
删除
恢复自动保存:
?