嵌入式软件工程师C语言笔试题Word格式.docx
《嵌入式软件工程师C语言笔试题Word格式.docx》由会员分享,可在线阅读,更多相关《嵌入式软件工程师C语言笔试题Word格式.docx(5页珍藏版)》请在冰豆网上搜索。
inta:
if(a==0)
boola:
floata:
void*a:
3)
voidfunc(charstr[100])
{
printf(“%d”,sizeof(str));
}
输出结果是:
有下列定义:
charstr[]=“HelloWorld”;
char*p=str;
intn=10;
void*ptr=malloc(100);
请写出如下表达式的值:
sizeof(str)=;
sizeof(p)=;
sizeof(n)=;
sizeof(ptr)=;
4)
unsignedchar*p1;
unsignedlong*p2;
p1=(unsignedchar*)0x87000000;
p2=(unsignedlong*)0x80010000;
请问p1+5=;
p2+5=;
5)charstr[10];
strcpy(str,"
0123456789"
);
产生什么结果?
为什么?
6)用C语句,让程序跳转到绝对地址0xFFFF0去执行
7)已知一个数组array,用一个宏定义,求出数组的元素个数
#defineARRAY_COUNT
8)简要说明,为什么标准头文件都有类似以下的结构。
#ifndef__INC_Honeywell_Debug
#define__INC_Honeywell_Debug
#ifdef__cplusplus
extern"
C"
{
#endif
/*...*/
#endif/*__INC_Honeywell_Debug*/
9)
给定结构
structtoken_t
chardigit:
4;
charindex:
unsignedshortdata:
8;
unsignedlongtick;
};
问sizeof(token_t)=
10)在空白处填写完整强制类型转换
short(*day_p)[16];
day_p=()malloc();
11)简述:
TCP/UDP有何区别?
TCP/IP通信建立的过程怎样?
端口有什么作用?
12)找出下列嵌入式系统中断处理函数中的错误:
__interruptdoublecompute_area(doubleradius)
{
doublearea=PI*radius*radius;
printf("
Area=%f"
area);
returnarea;
13)请写一个宏,若处理器是Big_endian的,则返回0;
若是Little_endian的,则返回1
14)数组a[N],存放了1至N-1个自然数,其中某个自然数重复一次。
写一个函数,找出被重复的数字。
要求:
(时间复杂度为O(N),可用一种或一种以上方法)
函数原型:
intdo_dup(inta[],intN)
15)
基于如下数据结构,实现环形缓冲区的读写函数
#defineBUF_SIZE(100)
typedefstructstr_data_buf
unsignedcharwrite_index;
unsignedcharread_index;
BOOLfull_flag;
BOOLempty_flag;
intdata_buf[BUF_SIZE];
}data_buf_t,*p_data_buf;
staticdata_buf_tring_buf;
实现其读写函数:
//----------------------------------------------------------------------------------------------
BOOLwrite_fifo(intnew_data)/*writeoneitemintoringbuffer*/
BOOLread_item(int*data)/*readoneitemfromringbuffer*/
选做部分(C++)
1)类的静态成员和非静态成员有何区别?
2)定义并实现String类,要求有构造函数、析构函数和赋值函数,