大学MOOC 数据结构-周强(青岛大学)1464803168 最新慕课完整章节测试答案
1-预备知识 [01_50_21 18段]
随堂测验1
1、单选题:
以下各语言书写的代码可认为其功能是相同的。对于该代码,哪项判断是正确的?C/C++:#include <stdio.h>
int hehe(){
printf("hehe");
hehe();
return 0;
}
int main(){
hehe();
return 0;
}Java语言:public class Main{
public static int hehe() {
System.out.println("hehe");
hehe();
return 0;
}
public static void main(String args[])
{
hehe();
}
}Python语言:def hehe():
print("hehe")
hehe()
return 0
hehe()
选项:
A: 代码有错,无法运行。
B: 代码可以运行,并在有限次函数调用后结束。
C: 代码可以运行,将产生无限次函数递归调用(不考虑机器出故障、停电等意外因素)。
D: 以上都不对。
答案: 【 代码可以运行,并在有限次函数调用后结束。】点我阅读全文




