嵌入式软件工程师C语言笔试题

嵌入式软件工程师C语言笔试题
嵌入式软件工程师C语言笔试题

软件笔试题(A)

姓名:___________________________________ 学校:_____________________________________

专业:___________________________________ 电话:_____________________________________

(如无特殊说明,以下所有测试内容都是基于32位嵌入式系统)

1)程序的局部变量存在于 _______________ 中,全局变量存在于_________________ 中,动态申请数据存在于_________________ 中。

2)如何用if来做零值比较

int a : if(a==O)

bool a : _________________________

float a : _________________________

void * a :

3)

void func( char str[1OO])

{

printf( “ %d ,sizeof( str ));

}

输出结果是:_____________________

有下列定义:

char str[] = “ Hello World ” ;

char *p = str;

int n = 10;

void *ptr = malloc( 100 );

请写出如下表达式的值:

sizeof (str ) = _

sizeof ( p ) = _

sizeof ( n ) = _

sizeof ( ptr )= _

4)

un sig ned char *p1;

un sig ned long *p2;

p1=(unsigned char *)0x87000000;

p2=(unsigned long *)0x80010000;

请问p1+5 = ____________ ; ___________

p2+5 = ________ ; _____________

5) char str[10]; strcpy(str,"0123456789");

产生什么结果?为什么?

6)用C语句,让程序跳转到绝对地址0XFFFF0去执行

7) 已知一个数组array ,用一个宏定义,求出数组的元素个数

#define ARRAY_COUNT _____________________________________________________

8) 简要说明,为什么标准头文件都有类似以下的结构。

#ifndef __INC_Ho neywell_Debug

#defi ne __INC_Ho neywell_Debug

#ifdef __cplusplus

extern "C" {

#en dif

/*???*/

#ifdef __cplusplus

}

#en dif

#e ndif /*__INC_Hon eywell_Debug */

Honeywell

9) 给定结构

struct toke n_t

{

char digit:4;

char in dex:4;

un sig ned short data:8;

un sig ned long tick;

};

问sizeof(token_t) = ________

10) 在空白处填写完整强制类型转换

short (*day_p)[16];

day_p = ( ____________ ) malloc ( ______ );

11)简述:TCP/UDP有何区别?TCP/IP通信建立的过程怎样?端口有什么作用?

12) 找出下列嵌入式系统中断处理函数中的错误:

__in terrupt double compute_area (double radius) {

double area = PI * radius * radius;

prin tf(" Area = %f", area);

return area;

13)请写一个宏,若处理器是Big_endian的,则返回0;若是Little_endian 的,则返回1

3 / 7

14) 数组a[N] ,存放了1 至N-1 个自然数,其中某个自然数重复一次。写一个函数,重复的数字。

找出被要求:(时间复杂度为0(N),可用一种或一种以上方法) 函数原型:int do_dup(int a[],int N)

Honeywell

5 / 7

15)基于如下数据结构,实现环形缓冲区的读写函数

实现其读写函数:

// -------------------------------------------------------------------------------------------- BOOL write_fifo(i nt n ew_data) /* write one item into ring buffer */

#defi ne BUF_SIZE (100)

typedef struct { un sig ned char un sig

ned char BOOL str_data_buf write_ in dex; read_ in dex; full_flag; empty_flag; int data_buf[BUF_SIZE];

}data_buf_t, *p_data_buf; static data_buf_t

rin g_buf;

读 用 区 空 域

item 21 使

BOOL read_item (int* data) /* read one item from ring buffer */

Honeywell 选做部分(C++)

1)类的静态成员和非静态成员有何区别?

2)定义并实现String类,要求有构造函数、析构函数和赋值函数,

7 / 7

相关主题
相关文档
最新文档