在线客服

自考365-自考学历培训

工学类

首页 > 工学类 > 正文

下列不是递归函数的是( )。

2019-01-02 14:50    自考365

报名季活动
下列不是递归函数的是( )。
A.int t(int n)
{ if(n==0) return 0;
else return(n-1);
}
B.int t(int n)
{ if(n==0) return 0;
else return t(n-1);
}
C.int t(int n)
{ if(n==0) return 0;
else return n+t(n-1);
}
D.int t(int n)
{ if(n==0) return 1;
else return n*t(n-1);
}
查看答案解析
【正确答案】
A
【答案解析】
只有A选项的else部分返回值时没有再次调用函数,所以答案选A。参见教材P175。
本题知识点:函数的嵌套调用和递归调用,
 自考365网小编精心为广大自考学员整理的相关历年试题及答案解析,想了解相关自考试题请持续关注自考365网校。
  让自考更有氛围,想加入自考365订阅号请添加zhengbaozikao365
分享到:
小自考
你可能喜欢
更多相关资讯
更多课程推荐