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

网站做适配顶尖文案网站

网站做适配,顶尖文案网站,湖南宣传片制作公司,亿寻跨境外贸人才网前言 在学C语言之前回顾一下C中的一些知识.选用的是中国大学MOOC中C程序设计(面向对象进阶)中的C语言水平评估测试题. 题目 ​The keyword "unsigned" can modify the keyword [ B ] A.signed B.long C.long double D.float题解:unsigned是无符号的意识,通常在…

前言

在学C++语言之前回顾一下C中的一些知识.选用的是中国大学MOOC中C++程序设计(面向对象进阶)中的C语言水平评估测试题.

题目

​The keyword "unsigned" can modify the keyword [  B  ]

  • A.signed

  • B.long

  • C.long double

  • D.float
    题解:unsigned是无符号的意识,通常在整数前面加

‍In the following strings, the correct C identifier is [ C  ]

  • A.break

  • B.2d

  • C._256

  • D.foo-1
    题解:不能是关键字,连接符,数字(不能写第一个)

‌The string "r\tu\r\"Okay?\"\n"  will occupy [  D ] bytes memory.

  • A.15

  • B.18

  • C.12

  • D.13
    题解:转义符算一个字节,一个字母算一个字节,/和?也算一个字节.

 In C programming language, the result of statement 5 ^ 4  is [ D  ]

  • A.4

  • B.3

  • C.2

  • D.1
    题解:" ^ "这个是异或的意思.

 

For the statement: int* a[10],*b; the correct description is[  A  ]

  • A.a can only be rvalue, but b can be lvalue

  • B.both a and b can only be rvalue

  • C.a can only be lvalue, but b can be rvalue

  • D.both a and b can only be lvalue
    题解:这个涉及到指针数组,这个int* a[10]就是指数组中的每个元素都是一个指针(int
    *类型),即使a是一个指针数组,但是它仍是一个数组,所以a是代指整个数组的起始地址,这个地址是常量.

If compiled with a STANDARD C COMPILER (e.g. gcc), which is correct about the following function "add"? [  A  ]
double add(int *, int *, int k) 
{   return (double) (8+k); }
int main() {   
int x=1, y=2,z=3;   
add(&x, &y, z);   
return 0; }

  • A.Compile error. After filling in the name of the formal parameters, the program can be compiled without errors;

  • B.Compile success.

  • C.Compile error. After changing " return (double) (8+k);" to "return 8+k", the program can be compiled without errors;

  • D.Compile error. After changing "int  k" to "double  k", the program can be compiled without errors;
    题解:个人认为编译器版本会影响这道题,就以菜鸟教程的编译器为例要将形参写的具体.

The correct one about pointers is: [    D ]‏
We assume that all codes are compiled on 32-bit platform

  • A.double *p;  where p occupies 8 byte memory;

  • B.struct S{ char* m;} n; where n occupies 1 byte memory;

  • C.char *p;  where p occupies 1 byte memory;

  • D.struct T{ double d; } *p;  where p occupies 4 bytes memory;
    题解:指针的占内存空间4bytes

Given the following program, when do-while loop finishes,the value of x is[   B  ]​enum { APPLE, LEMON=6, ORANGE, BANANA=2, GRAPE};
void f ( ) {     
int x=GRAPE;     
do {          
x++;     } 
while ((x-APPLE)<=ORANGE); }

  • A.6 

  • B.8

  • C.ORANGE         

  • D.BANANA 
    题解:这个题可去看我之前写的非阻塞式按键-单双击长按的实现-CSDN博客里面有对enum一些解释,这里APPLE默认是0,ORANGE是在LEMON上加一,类似GRAPE同理.

Which of the following statements are completely correct? [  B   ]

  • A.int *p; scanf("%d", &p);

  • B.int k, *p=&k;  scanf("%d", p);

  • C.int k, *p;  *p= &k;   scanf("%d", p);

  • D.int *p; scanf("%d", p);
    题解:这里主要考察野指针.野指针就是指没有初始化指针.它所指向的内存地址可以是任何地址,可能指向的是只读,或者从操作系统的保留地址.举例
    int k, *p;
    *p = &k;
    scanf("%d", p);
    分析:p是一个未初始化的指针,它的值是随机的,指向位置是未知的.
    *p = &k;的意思是将k的存储地址给p指向的位置.
    你无法确定这个内存位置是安全的.

Which statement satisfies the condition: If string s1 equals to strings s2, then execute ST.  [   D  ]

  • A.if(strcpy(sl, s2)==1) ST;

  • B.if(sl==s2) ST;

  • C.if(sl-s2==0) ST;

  • D.if(strcmp(s2,s1)==0) ST;
    题解:strcpy(sl, s2)是指把s2的内容复制到s1,用的是s1的地址,不是数值1.
    s1和s2比较的是字符串的地址值,不是内容,上面的数组一个这个s1和s2属于衰减,代表数组的起始地址.
    s1-s2同样的算的是地址差值.
    strcmp(s1,s2)用于比较s1和s2的内容.

 Given the following program[ D ]
#include  <stdio.h>
int fun( )
{   static int x=1;   x+=1;   return x; }
int main( ){   int i, s=1;   for(i=1; i<=5;i++)     
s+=fun( );   
printf("%d\n", s);   
return 0 }

  • A.11

  • B.120

  • C.6

  • D.21
    题解:

#include  <stdio.h>int fun( ){static int x=1;x+=1;return x;
}
int main( ){int i, s=1;for(i=1; i<=5;i++){int a =fun( );s+=a;printf("fun=%d\n",a);printf("s=%d\n",s);}}

运行结果:fun=2 s=3 fun=3 s=6 fun=4 s=10 fun=5 s=15 fun=6 s=21

总结

这些题还是比较不错和全面的,有些题还可以深入研究,比如数组指针,指针数组(不好记的话可以在中间加上"的",指针的数组,数组的指针.就很好的明白.)(数组指针声明:int (*p)[5];  // p 是指向 int 类型数组的指针;指针的数组声明int *arr[5];  // arr 是一个包含 5 个 int 指针的数组这两个也很好记,[5]前面就是这是什么数组举例:int (*p)[5];p[5],p其实代表是数组的起始地址,现在使用是(*p)则表示指向这个数组,则叫数组的指针.指针数组也是一样:int *arr[5];[5]前面跟的是arr再前面表示类型所以这表示一个数组里面存储的指针,叫指针的数组.为什么要从右往左读,为了声明的结构清晰)还有野指针,悬空指针(指向一块已经释放的内存就是选空指针),越界指针(指针访问超出数组分配的内存范围).

http://www.hkea.cn/news/358130/

相关文章:

  • 网站有备案 去掉备案网络营销意思
  • 新建网站推广给企业百度问一问在线咨询客服
  • 曹鹏wordpress建站seo视频广东疫情防控措施
  • 网站开发的岗位排名优化工具
  • 岳阳做网站怎么做推广让别人主动加我
  • 不断改进网站建设公司百度官网优化
  • 万户网站宁波网站制作优化服务
  • 潍坊快速网站排名网站是怎么做出来的
  • 聚美优品的pc网站建设注册网址
  • 陕西省住房与城乡建设厅网站免费b站推广软件
  • 淮南市住房与城乡建设部网站网店买卖有哪些平台
  • 网页qq表情佛山百度快速排名优化
  • 网站建设方案论文1500社会新闻最新消息
  • 网站组建 需求分析市场监督管理局职责
  • 云课堂哪个网站做的好厦门关键词优化seo
  • 中企动力沈阳分公司seo免费诊断电话
  • 网站vps被黑湖人最新排名最新排名
  • 如何夸奖客户网站做的好seo课程心得体会
  • 有哪些做电子商务的网站时空seo助手
  • 临沂百度网站电脑培训机构哪个好
  • 无锡专业做网站的公司怎样把自己的产品放到网上销售
  • 大学网站建设管理办法推广技巧
  • 长春做网站公司seo关键词排名优化软件怎么选
  • 网站开发未按合同约定工期完工seo关键词排名怎么提升
  • 创可贴app海报制作网站百度seo优化方法
  • 龙岗品牌网站建设2024年新闻摘抄
  • 南阳住房和城乡建设厅网站招聘网站排名
  • 如何做网站活动封面建站的公司
  • 温州网站建设培训营销推广方案包括哪些内容
  • 厦门 建网站商业软文案例