题目信息
-
题目类型
-
六级
-
题目年份
-
2024
-
题目题型
-
单选题
-
关 键 词
-
实例变量
题目题干
14.下列哪个选项可以正确创建并访问类的实例变量?( )gmh100150满分答卷(100150.com)-青少年编程等级考试及竞赛题库
A. class MyClass: gmh100150满分答卷(100150.com)-青少年编程等级考试及竞赛题库
def __init__(self): gmh100150满分答卷(100150.com)-青少年编程等级考试及竞赛题库
self.my_variable = 10 gmh100150满分答卷(100150.com)-青少年编程等级考试及竞赛题库
my_instance = MyClass() gmh100150满分答卷(100150.com)-青少年编程等级考试及竞赛题库
print(my_instance.my_variable)gmh100150满分答卷(100150.com)-青少年编程等级考试及竞赛题库
B. class MyClass: gmh100150满分答卷(100150.com)-青少年编程等级考试及竞赛题库
def __init__(self): gmh100150满分答卷(100150.com)-青少年编程等级考试及竞赛题库
my_variable = 10 gmh100150满分答卷(100150.com)-青少年编程等级考试及竞赛题库
my_instance = MyClass() gmh100150满分答卷(100150.com)-青少年编程等级考试及竞赛题库
print(my_instance.my_variable)gmh100150满分答卷(100150.com)-青少年编程等级考试及竞赛题库
C. class MyClass: gmh100150满分答卷(100150.com)-青少年编程等级考试及竞赛题库
def __init__(self): gmh100150满分答卷(100150.com)-青少年编程等级考试及竞赛题库
my_variable = 10 gmh100150满分答卷(100150.com)-青少年编程等级考试及竞赛题库
my_instance = MyClass() gmh100150满分答卷(100150.com)-青少年编程等级考试及竞赛题库
print(my_instance.my_variable)gmh100150满分答卷(100150.com)-青少年编程等级考试及竞赛题库
D. class MyClass: gmh100150满分答卷(100150.com)-青少年编程等级考试及竞赛题库
def __init__(self): gmh100150满分答卷(100150.com)-青少年编程等级考试及竞赛题库
self.my_variable = 10 gmh100150满分答卷(100150.com)-青少年编程等级考试及竞赛题库
my_instance = MyClass() gmh100150满分答卷(100150.com)-青少年编程等级考试及竞赛题库
print(MyClass.my_variable)gmh100150满分答卷(100150.com)-青少年编程等级考试及竞赛题库
答案解析
相关题目
提示声明
- 免责声明:本站资源均来自网络或者用户投稿,仅供用于学习和交流:如有侵权联系删除!
- 温馨提示:本文属于积分文章,需要充值获得积分或升级VIP会员,也可在会员中心投稿获取。
猜你喜欢
Scratch3.0
全国青少年软件编程等级考试
Python
Scratch图形化一级
Scratch图形化四级
Scratch图形化三级
Scratch图形化二级
电子学会