收藏 分销(赏)

2023年嵌入式C语言高级编程试卷B.doc

上传人:二*** 文档编号:4708521 上传时间:2024-10-10 格式:DOC 页数:9 大小:32.54KB 下载积分:5 金币
下载 相关 举报
2023年嵌入式C语言高级编程试卷B.doc_第1页
第1页 / 共9页
本文档共9页,全文阅读请下载到手机保存,查看更方便
资源描述
<p>上嵌《嵌入式C高级编程》笔试 一. 选择题(每题1分,共20道) 1.C语言程序编译时,程序中的注释部分( &nbsp; &nbsp; &nbsp; ) A)参与编译,并会出现在目的程序中 B)参与编译,但不会出现在目的程序中 C)不参与编译,但会出现在目的程序中 D)不参与编译,也不会出现在目的程序中 2.语句“ int k=0586 ;” ,将( &nbsp; &nbsp; &nbsp; ) A)说明k 为初值586 的整型变量 B)说明k 为初值0586 的整型变量 C)导致编译错误 D)说明整型常量k 的值为0586 3.全局变量的存储类型可以定义为( &nbsp; &nbsp; &nbsp; ) A)auto 或static B)extern 或register C)auto 或extern D)extern 或static 4.设int 型变量x 有初始值3,则表达式x++*5/10 的值是( &nbsp; &nbsp; &nbsp; ) A)0 C)2 B)1 D)3 5.下列表达式的值为0 的是( &nbsp; &nbsp; &nbsp; ) A)3﹪5 C)3/5 B)3/5.0 D)3&lt;5 6.设int a = 3;则表达式a&lt;1&amp;&amp;--a&gt;1的运算结果和a的值分别是( &nbsp; &nbsp; &nbsp; ) A)0和2&nbsp; C)1和2&nbsp; B)0和3 D)1和3 7.设有以下程序段:int a=1, b=10, c=1, x; x=a&amp;&amp;b||--c;printf(″%d, %d\n″,x,c); 执行后输出的结果是( &nbsp; &nbsp; &nbsp; ) A)0,0&nbsp; C)1,0&nbsp; B)0,1&nbsp; D)1,1 8.设有以下程序段:for(a=0, b=0; b!=100&amp;&amp;a&lt;5; a++) scanf(″%d″, &amp;b); 那么,scanf最多可执行次数是( &nbsp; &nbsp; &nbsp; ) A)4 C)5&nbsp;&nbsp;&nbsp; B)6&nbsp;&nbsp;&nbsp; D)1 9.假定a和b为整型变量,则执行下述语句组后,b的值为( &nbsp; &nbsp; &nbsp; )&nbsp; &nbsp; &nbsp; a=1;&nbsp; &nbsp; b=10;&nbsp; &nbsp; do&nbsp; &nbsp; {&nbsp; &nbsp; b -= a;&nbsp; &nbsp; &nbsp; a++;&nbsp; &nbsp; } while (b--&lt;0);&nbsp; A)9&nbsp; C)-1&nbsp; B)-2&nbsp; D)8&nbsp; 10.执行语句“ for(s=0,i=1;i&lt;=10;i=i+3) 1=&quot;&quot; 2=&quot;&quot; 3=&quot;&quot; 4=&quot;&quot; 10=&quot;&quot; 13=&quot;&quot; s=&quot;&quot; i=&quot;&quot; int=&quot;&quot; p=&quot;S之后,*(P+2)的值是(&quot; x=&quot;&quot; char=&quot;&quot; aa.dat=&quot;&quot; fp=&quot;fopen(&quot; ab=&quot;&quot; a=&quot;&quot; wb=&quot;&quot; r=&quot;&quot; 18.=&quot;&quot; p-=&quot;&quot;&gt;Llink=q; q-&gt;Rlink=p; p-&gt;Llink-&gt;Rlink=q; q-&gt;Llink=q;&nbsp; B)p-&gt;Llink=q; p-&gt;Llink-&gt;Rlink=q; q-&gt;Rlink=p; q-&gt;Llink=p-&gt;Llink;&nbsp; C)q-&gt;Rlink=p; q-&gt;Llink=p-&gt;Llink; p-&gt;Llink-&gt;Rlink=q; p-&gt;Llink=q;&nbsp; D)q-&gt;Llink=p-&gt;Llink; q-&gt;Rlink=q; p-&gt;Llink=q; p-&gt;Llink=q;&nbsp; 19. 一个栈的入栈序列是abcde,则栈的不也许输出序列是( &nbsp; &nbsp; &nbsp; )&nbsp; A)edcba C)decba&nbsp; B)dceab D)abcde&nbsp; 20. 以数组Q[0..m-1]存放循环队列中的元素,变量rear和qulen分别指示循环队列中队尾元素的实际位置和当前队列中元素的个数,队列第一个元素的实际位置是( &nbsp; &nbsp; &nbsp; )&nbsp; A)rear-qulen&nbsp; B)rear-qulen+m&nbsp; C)m-qulen&nbsp; D)1+(rear+m-qulen)% m&nbsp; 二. 填空题(每空2分,共10空) &nbsp; 1 下面代码的输出结果是&nbsp;_________________&nbsp; int a = 100; int b = 300; a = b + (b = a)*0; printf(&quot;a = %d, b = %d\r\n&quot;, a, b); 2 下面代码的输出结果是&nbsp;_________________ int main( ) { int i, x, y; i=x=y=0; do { ++i; if(i%2!=0)&nbsp; { x=x+i; i++; } y=y+i++; } while (i&lt;=7); printf(&quot;x=%d, y=%d\n&quot;, x, y); return 0; } &nbsp; 3 设int i, x[3][3]={1,2,3,4,5,6,7,8,9}; 则下面语句的输出结果是&nbsp;_________________&nbsp;    &nbsp; for(i=0; i&lt;3; 4=&quot;&quot; 5=&quot;&quot; 6=&quot;&quot; 7=&quot;&quot; 8=&quot;&quot; 10=&quot;&quot; char=&quot;&quot; lpstring=&quot;&quot; int=&quot;&quot; lpint=&quot;(int&quot; chbuffer=&quot;&quot; _________________=&quot;&quot; ptr=&quot;arr;&quot; include=&quot;&quot; define=&quot;&quot; x=&quot;&quot; k=&quot;2,&quot; m=&quot;1,&quot; a=&quot;&quot; return=&quot;&quot; union=&quot;&quot; short=&quot;&quot; long=&quot;&quot; void=&quot;&quot; element=&quot;&quot; if=&quot;&quot; top=&quot;&quot;&gt;=MAX_STACK_SIZE-1)&nbsp; &nbsp; &nbsp; return stack_full();&nbsp; &nbsp; stack[ ____________ ]=item;&nbsp; }&nbsp; 三. 简答题(每题4分,共5道) 1 写一个“标准”宏SWAP,这个宏输入两个参数,并互换他们的值。 2 char * const p; char const * p const char *p 上述三个有什么区别? 3 static全局变量与普通的全局变量有什么区别?static局部变量和普通局部变量有什么区别?static函数与普通函数有什么区别? 4 heap和stack的区别? 5 请写出C语言中打开文献、读写文献、文献定位、关闭文献的函数。 《嵌入式C高级编程》机试 编程题(每题8分,共5道) 一、编写两个函数将整型变量x的二进制位的第n位置1或清零,其他位不变。 二、编写一个把字符串转换成长整型数的函数,原型为long atol(const char *nptr)。 三、编写一个递归函数,判断数组a[N]是否为一个递增数组。 四、编写一个函数,功能是把一个字符串循环右移n个。 比如本来是&quot;abcdefg&quot;,假如n=2,移位后应当是&quot;fgabcde&quot; 。&nbsp; 五、排列数字。将1、2 …… 19、20 这20 个数字排成一排,使得相邻的两个数字之和为一个素数,且首尾两个数字之和也为一个素数。编写程序,打印出所有的排法。</p>
展开阅读全文

开通  VIP会员、SVIP会员  优惠大
下载10份以上建议开通VIP会员
下载20份以上建议开通SVIP会员


开通VIP      成为共赢上传

当前位置:首页 > 通信科技 > 开发语言

移动网页_全站_页脚广告1

关于我们      便捷服务       自信AI       AI导航        抽奖活动

©2010-2026 宁波自信网络信息技术有限公司  版权所有

客服电话:0574-28810668  投诉电话:18658249818

gongan.png浙公网安备33021202000488号   

icp.png浙ICP备2021020529号-1  |  浙B2-20240490  

关注我们 :微信公众号    抖音    微博    LOFTER 

客服