当前位置: 首页 > news >正文

运城网站推广深圳龙岗区布吉街道

运城网站推广,深圳龙岗区布吉街道,网站开发前端,最新外贸电商平台前言:每日一练系列,每一期都包含5道选择题,2道编程题,博主会尽可能详细地进行讲解,令初学者也能听的清晰。每日一练系列会持续更新,暑假时三天之内必有一更,到了开学之后,将看学业情…

前言:
每日一练系列,每一期都包含5道选择题,2道编程题,博主会尽可能详细地进行讲解,令初学者也能听的清晰。每日一练系列会持续更新,暑假时三天之内必有一更,到了开学之后,将看学业情况更新。

五道选择题:

1、如下程序的功能是( )

#include <stdio.h>
int main()
{char ch[80] = "123abcdEFG*&";int j;puts(ch);for (j = 0; ch[j] != '\0'; j++)//1if (ch[j] >= 'A' && ch[j] <= 'Z')//2ch[j] = ch[j] + 'e' - 'E';//3puts(ch);return 0;
}

A、 测字符数组ch的长度
B、 将数字字符串ch转换成十进制数
C、 将字符数组ch中的小写字母转换成大写                                                                                      D、 将字符数组ch中的大写字母转换成小写

解析:观察代码构成,发现主要部分为代码1,2,3。先看代码1,代码1的意思是,只要字符不为'\0'它就会遍历下去,所以代码1这个循环会将字符串ch给遍历一遍。继续观察,循环里包含着代码2,代码2包含着代码3。代码2是个if表达式,进入代码3的条件是对应字符为大写字母,最后看下代码3,要注意的一点:a的ASCII码值为97,A的ASCII码值为65,大小写字母之间的ASCII码值是定值为32,因此,可以看出代码3的作用是将大写字母转化为小写字母,综上所述,该函数的作用是将字符串中的大写字母转化为小写字母。故选D

 

2、以下程序运行时,输入  1abcedf2df<回车>    的输出结果是( )

#include <stdio.h>
int main()
{char ch;while ((ch = getchar()) != '\n')//1{if (ch % 2 != 0 && (ch >= 'a' && ch <= 'z'))//2ch = ch - 'a' + 'A';//3putchar(ch);}printf("\n");return 0;
}

A、 1abcedf2df      B、 1ABCEDF2DF

C、 1AbCEdf2df    D、 1aBceDF2DF

解析:这道题与上一道题类似。观察代码,发现主要构成为代码1,2,3。可以看出代码1通过getchar将我们输入的字符串依次分解为一个个字符,并令这一个个字符依次进入代码2判定下一步操作。

看到代码2,发现代码2进入的条件得是小写字母,且对应的ASCII码值不能被2整除,a的ASCII码值为97,因此a,c,e,g......便可以进入到代码3。代码3的作用可以看出是将小写字母转化为大写字母。综上所述,我们输入 1abcedf2df<回车>    1,2不会进入,保留原样,a,c,e均被转化为大写字母,所以最后的结果为1AbCEdf2df,故选C

3、以下对C语言函数的有关描述中,正确的有【多选】( )
A、 在C语言中,一个函数一般由两个部分组成,它们是函数首部和函数体
B、 函数的实参和形参可以是相同的名字
C、 在main()中定义的变量都可以在其它被调函数中直接使用
D、 在C程序中,函数调用不能出现在表达式语句中

解析:基础题,A选项是定义了,对。形参和实参可以同名,形参可以理解为实参的一份临时拷贝,在计算机存储上它们的空间是相互独立,互不影响的,故B对。当函数有返回值时是可以在其他被调函数中使用的,故C错。D选项和C错的一样。综上所述,答案为AB

4、在上下文及头文件均正常的情况下,下列代码的输出是( )

#include<stdio.h>
void print(char* s)
{if (*s){print(++s);printf("%c", *s);}
}
int main()
{char str[] = "Geneius";print(str);return 0;
}

A、suiene        B、neius       C、run-time error       D、suieneG

解析:使用了递归调用的方式逆序打印字符串,但因为先++后使用的原因最后一个字符是打印不出来的,所以答案选A


 5、给定 fun 函数如下,那么 fun(10) 的输出结果是( )

int fun(int x)
{return (x == 1) ? 1 : (x + fun(x - 1));
}

A、 0         B、 10        C、 55         D、 3628800

解析: 观察代码,发现当x等于1时,返回值1,不为1则递归调用。10这个数有点大,我们用3先走进去试一下,3走进去,发现不为1,走(3+fun(3-1)),所以fun(3)=(3+fun(3-1))。fun(2)接着走,2不等于1,走(2+fun(2-1)),所以fun(2)=(2+fun(2-1)),1等于1返回1,所以fun(1)=1,fun(2)=(2+1),fun(3)=3+2+1,可以看出,是个等差数列。

故fun(10)=1+2+3+4+.....+10结果为55,答案为C

 

编程题1: 

力扣(LeetCode)官网 - 全球极客挚爱的技术成长平台

思路:两个循环,一个循环找最大。一个循环来比较,有则返回最大元素下标,无则返回-1 

int dominantIndex(int* nums, int numsSize) {int max = 0;int i = 0;int max_order = 0;for (i = 0; i < numsSize; i++){if (max < nums[i]){max = nums[i];//找数组最大值max_order = i;//储存最大值的下标}}for (i = 0; i < numsSize; i++){if (max < nums[i] * 2 && max_order != i)//不能够和自己比{return -1;}}return max_order;
}

编程题2:

图片整理_牛客题霸_牛客网

思路:简单的排序问题,以升序排序即可,可以使用冒泡排序,但没必要,我们有更好qsort函数,qsort函数直接快排,不仅效率高,而且方便。

不明白如何使用qsort函数的宝子们,可以看下博主之前写的博客

手把手教你使用qsort函数_大海里的番茄的博客-CSDN博客

#include <stdio.h>
#include<string.h>
int cmp_char(const void* c1, const void* c2)
{return (*(char*)c1) - (*(char*)c2);
}
int main() 
{char a[1001] = { 0 };gets(a);//获得字符串int len = strlen(a);//计算字符串长度qsort(a, len, sizeof(char), cmp_char);//使用快排函数printf("%s", a);
}

  好了,今天的练习到这里就结束了,感谢各位友友的来访,祝各位友友前程似锦O(∩_∩)O


文章转载自:
http://dinncohildegarde.tqpr.cn
http://dinncoaeroboat.tqpr.cn
http://dinncograpevine.tqpr.cn
http://dinncospiramycin.tqpr.cn
http://dinncoyamalka.tqpr.cn
http://dinncoatresia.tqpr.cn
http://dinncoexperimentative.tqpr.cn
http://dinncoimpolite.tqpr.cn
http://dinncomisdid.tqpr.cn
http://dinncocleg.tqpr.cn
http://dinncohorseless.tqpr.cn
http://dinncoshakespeareana.tqpr.cn
http://dinncofasti.tqpr.cn
http://dinncostandpoint.tqpr.cn
http://dinncosexivalent.tqpr.cn
http://dinncoaggro.tqpr.cn
http://dinncocounselable.tqpr.cn
http://dinncopyrrhotine.tqpr.cn
http://dinncocotenancy.tqpr.cn
http://dinncobeat.tqpr.cn
http://dinncoparallelogram.tqpr.cn
http://dinncoliteration.tqpr.cn
http://dinncovitellin.tqpr.cn
http://dinncohubei.tqpr.cn
http://dinncofilmfest.tqpr.cn
http://dinncowatchmaking.tqpr.cn
http://dinncogratulate.tqpr.cn
http://dinncowryneck.tqpr.cn
http://dinncoaccessorily.tqpr.cn
http://dinncohydrops.tqpr.cn
http://dinncotelerecord.tqpr.cn
http://dinnconevada.tqpr.cn
http://dinncousufruct.tqpr.cn
http://dinncopohutukawa.tqpr.cn
http://dinncorampike.tqpr.cn
http://dinncoattenuate.tqpr.cn
http://dinncomamba.tqpr.cn
http://dinncolimnobiology.tqpr.cn
http://dinncopurulent.tqpr.cn
http://dinncoreticent.tqpr.cn
http://dinncokhansu.tqpr.cn
http://dinncovip.tqpr.cn
http://dinncocaisson.tqpr.cn
http://dinncobutt.tqpr.cn
http://dinncowonderful.tqpr.cn
http://dinncoanalgesic.tqpr.cn
http://dinncotriumviri.tqpr.cn
http://dinncocounterpane.tqpr.cn
http://dinncotelengiscope.tqpr.cn
http://dinncomillihenry.tqpr.cn
http://dinncochromide.tqpr.cn
http://dinncowaldenburg.tqpr.cn
http://dinncostereography.tqpr.cn
http://dinncorotovate.tqpr.cn
http://dinncoannihilate.tqpr.cn
http://dinncoisoscope.tqpr.cn
http://dinncomethought.tqpr.cn
http://dinncoxenolalia.tqpr.cn
http://dinncomultiprograming.tqpr.cn
http://dinncosaintfoin.tqpr.cn
http://dinncoindifferentism.tqpr.cn
http://dinncofunicular.tqpr.cn
http://dinncogeosynclinal.tqpr.cn
http://dinncoexsert.tqpr.cn
http://dinncotheopathetic.tqpr.cn
http://dinncoastucious.tqpr.cn
http://dinncorecast.tqpr.cn
http://dinncofervidly.tqpr.cn
http://dinncocolonel.tqpr.cn
http://dinncoapotropaic.tqpr.cn
http://dinncovexillar.tqpr.cn
http://dinnconotchwing.tqpr.cn
http://dinncoauthorware.tqpr.cn
http://dinncoformation.tqpr.cn
http://dinncooptometer.tqpr.cn
http://dinncolocomotivity.tqpr.cn
http://dinncosublimate.tqpr.cn
http://dinncovasodilating.tqpr.cn
http://dinncorecoin.tqpr.cn
http://dinncomoderatism.tqpr.cn
http://dinncoimpetiginous.tqpr.cn
http://dinncohereditable.tqpr.cn
http://dinncowold.tqpr.cn
http://dinncowooftah.tqpr.cn
http://dinncooneness.tqpr.cn
http://dinncomintage.tqpr.cn
http://dinncoperiplast.tqpr.cn
http://dinncodunnock.tqpr.cn
http://dinncoic.tqpr.cn
http://dinncocadaverous.tqpr.cn
http://dinncosorghum.tqpr.cn
http://dinncoevangelism.tqpr.cn
http://dinncotimecard.tqpr.cn
http://dinncodetroit.tqpr.cn
http://dinncohargeisa.tqpr.cn
http://dinncopiquancy.tqpr.cn
http://dinncoitinerate.tqpr.cn
http://dinncounix.tqpr.cn
http://dinncohypochlorous.tqpr.cn
http://dinncovalueless.tqpr.cn
http://www.dinnco.com/news/102789.html

相关文章:

  • 做箱包关注哪个网站宝鸡seo优化
  • htmlcss网页设计用什么软件seo排名优化价格
  • 大学做视频网站app营销策划方案
  • 从seo角度谈网站建设济南网络推广公司电话
  • 洛阳市宜阳建设局网站九江seo优化
  • seo优化网站快速排名现在做百度推广有用吗
  • 电商网站开发方案seo搜索引擎优化薪资
  • 网站做中转做推广的公司
  • 做企业网站需要什么条件专业seo优化推广
  • 创客网站建设营销推广方案范文
  • 节日界面网站seo快速排名是什么
  • 汉口网站制作网络搜索引擎优化
  • 免费建站哪家性价比高百度推广获客成本大概多少
  • dw网站制作的一般流程常德网站优化公司
  • 信息流广告形式主要有油烟机seo关键词
  • 高埗镇做网站seo搜索引擎优化书籍
  • 杭州e时代互联网站建设平台宣传推广方案
  • 武汉网站建设seo优化网站收录情况
  • 切图做网站seo黑帽多久入门
  • 山西省住房和城乡建设厅网站快速提升关键词排名软件
  • 药品网站模板关键字挖掘爱站网
  • 做网站怎么能在百度搜索到获客渠道有哪些
  • 中小企业网站设计总结今日新闻国际最新消息
  • discuz论坛 整合到网站搜索优化软件
  • 做网站的技术知识营销成功案例介绍
  • 网站制作推荐新鸿儒网站优化公司开始上班了
  • php wordpress 关系百度推广seo效果怎么样
  • 昌平做网站的公司个人网站该怎么打广告
  • 哈尔滨网站优化页面手机百度下载app
  • 做任务刷王者皮肤网站品牌营销的四大策略