StudyPilot
关于博客价格常见问题联系隐私条款

© 2026 StudyPilot. 保留所有权利。

题库INFO1110INFO1110 Week 7 每周题库 · Functions 函数、作用域与返回值

INFO1110 Week 7 每周题库 · Functions 函数、作用域与返回值

Week 7 精选练习:函数定义、参数、作用域、返回值与引用。Curated practice on functions, scope, return values and references.

0题目
0已练习
0%你的正确率
~0 分钟预计时间
W07 Functions 函数基础

What is the best description of the behaviour of the following function?def check(xs: list, val) -> int: count = 0 for x in xs: if x == val: count += 1 return count

W07 Functions 函数基础

What is the value of result after only the following code is run?result = [] for x in range(6): if x == 2 or 3: result.append(x)

W07 Functions 函数基础

What is the value of count after the following code is run?count = 0 for x in 'Hello World': if x == 'l' or x == 'o': count += 1

W07 Functions 函数基础

Consider the function foo defined below. What type of value does foo return?def foo(n: int): """Precondition: n > 0""" total = 0 for i in range(n): total += i print(total)

W07 Scope 变量作用域

What error (if any) will the following code produce?def greet(name): global name return 'Hello, ' + name greet('Alice')

你的进度

0%0 / 40

已练 0 / 40 · 正确率 0%

升级解锁
StudyPilot
题库价格日历
登录