[{"createTime":1735734952000,"id":1,"img":"hwy_ms_500_252.jpeg","link":"https://activity.huaweicloud.com/cps.html?fromacct=261f35b6-af54-4511-a2ca-910fa15905d1&utm_source=V1g3MDY4NTY=&utm_medium=cps&utm_campaign=201905","name":"华为云秒杀","status":9,"txt":"华为云38元秒杀","type":1,"updateTime":1735747411000,"userId":3},{"createTime":1736173885000,"id":2,"img":"txy_480_300.png","link":"https://cloud.tencent.com/act/cps/redirect?redirect=1077&cps_key=edb15096bfff75effaaa8c8bb66138bd&from=console","name":"腾讯云秒杀","status":9,"txt":"腾讯云限量秒杀","type":1,"updateTime":1736173885000,"userId":3},{"createTime":1736177492000,"id":3,"img":"aly_251_140.png","link":"https://www.aliyun.com/minisite/goods?userCode=pwp8kmv3","memo":"","name":"阿里云","status":9,"txt":"阿里云2折起","type":1,"updateTime":1736177492000,"userId":3},{"createTime":1735660800000,"id":4,"img":"vultr_560_300.png","link":"https://www.vultr.com/?ref=9603742-8H","name":"Vultr","status":9,"txt":"Vultr送$100","type":1,"updateTime":1735660800000,"userId":3},{"createTime":1735660800000,"id":5,"img":"jdy_663_320.jpg","link":"https://3.cn/2ay1-e5t","name":"京东云","status":9,"txt":"京东云特惠专区","type":1,"updateTime":1735660800000,"userId":3},{"createTime":1735660800000,"id":6,"img":"new_ads.png","link":"https://www.iodraw.com/ads","name":"发布广告","status":9,"txt":"发布广告","type":1,"updateTime":1735660800000,"userId":3},{"createTime":1735660800000,"id":7,"img":"yun_910_50.png","link":"https://activity.huaweicloud.com/discount_area_v5/index.html?fromacct=261f35b6-af54-4511-a2ca-910fa15905d1&utm_source=aXhpYW95YW5nOA===&utm_medium=cps&utm_campaign=201905","name":"底部","status":9,"txt":"高性能云服务器2折起","type":2,"updateTime":1735660800000,"userId":3}]
单选题(20分)
1.在一个长度为n的带头结点的单链表h上,设有尾指针r,则执行()操作与链表的表长有关。
A 在单链表最后一个元素后插入一个新元素
B 在单链表第一个元素前插入一个新元素
C 删除单链表中最后一个元素
D 删除单链表中的第一个元素
参考答案:C
2.母牛的故事:有一头大母牛,它每年年初生一头小母牛,每头小母牛从第四个年头开始,每年年初也生一头小母牛。问:在n年的时候,共有多少头小母牛?()
#include<stdio.h> int main() { long f[10]; int i,n; scanf("%d",&n);
f[1]=1;f[2]=2;f[3]=3;//边界 for(i=4;i<=n;i++) { f[i]=______;//递推公式 printf("%d
%ld\n",i,f[i]); } return 0; }
A f[i-3]+f[i-1]
B f[i]+f[i-1]
C f[i-3]+f[i-2]
D f[i-2]+f[i-1]
参考答案:A
3.5个人坐在一起,问第5个人多少岁?他说比第4个人大2岁。问第4个人岁数,他说比第3个人大2岁。问第3个人,又说比第2人大两岁。问第2个人,说比第1个人大两岁。最后问第1个人,他说是10岁。请问第五个人多大年龄? ( )
#include<stdio.h> int age(int n) { if(n==1)return (10); else return _____; }
int main() { int n=5; printf("The fifth age is %d.\n",age(n)); return 0; }
A age(n-2)+2
B age(n)+2
C age(n-1)+2
D age(n-1)
参考答案:C
4.已知一对兔子每一个月能生一对小兔子,而一对小兔子出生后第二个月就开始生小兔子,假如一年内没有发生死亡,则一对兔子一年(12个月)能繁殖成多少对?( )
#include<stdio.h> int main() { long f1,f2; int i; f1=f2=1; for(i=1;i<=12;i++)
{ printf("i=%d f2=%ld\n",i,f2); f1=f2; f2=___; } return 0; }
A f2*2+f1
B f1+f2
C f1*2+f2
D f2-f1
参考答案:B
5.猴子第一天摘下若干个桃子,当即吃了一半,还不过瘾,又多吃了一个,第二天早上又将剩下的桃子吃掉一半,又多吃了一个。以后每天早上都吃了前一天剩下的一半再多一个。到第5天早上想再吃时,见只剩下1个桃子了。求第一天共摘了多少个桃子。( )
#include<stdio.h> #define N 5 int main() { int n,s1,s2; s1=1;
for(n=N-1;n>=1;n--)//倒数第二天开始 { s2=___;//算出当天的桃子数 s1=s2; }
printf("第一天的桃子数为%4d\n",s2); return 0; }
A s1-s2/2
B s1*2+1
C (s1+1)*2
D s1+s2
参考答案:C
答案仅供参考,要好好学习C语言啊。