嵌入式软件工程师笔试题

时间:2018-12-31 12:00:00 资料大全 我要投稿

嵌入式软件工程师笔试题

  1、将一个字符串逆序

嵌入式软件工程师笔试题

  2、将一个链表逆序

  3、计算一个字节里(byte)里面有多少bit被置1

  4、搜索给定的字节(byte)

  5、在一个字符串中找到可能的最长的子字符串

  6、字符串转换为整数

  7、整数转换为字符串

  /*

  * 题目:将一个字符串逆序

  * 完成时间:2006.9.30深圳极讯网吧

  * 版权归刘志强所有

  * 描述:写本程序的目的是希望练一下手,希望下午去面试能成功,不希望国庆节之后再去找工作拉!

  */

  #include

  using namespace std;

  //#define NULL ((void *)0)

  char * mystrrev(char * const dest,const char * const src)

  {

  if (dest==NULL && src==NULL)

  return NULL;

  char *addr = dest;

  int val_len = strlen(src);

  dest[val_len] = '\0';

  int i;

  for (i=0; i

  {

  *(dest+i) = *(src+val_len-i-1);

  }

  return addr;

  }

  main()

  {

  char *str="asdfa";

  char *str1=NULL;

  str1 = (char *)malloc(20);

  if (str1 == NULL)

  cout<<"malloc failed";

  cout<

  free(str1);

  str1=NULL;//杜绝野指针

  }

  p=head;

  q=p->next;

  while(q!=NULL)

  {

  temp=q->next;

  q->next=p;

  p=q;

  q=temp;

  }

  这样增加个辅助的指针就行乐,

嵌入式软件工程师笔试题

  ok 通过编译的代码:

  #include

  #include

  #include

  typedef struct List{

  int data;

  struct List *next;

  }List;

  List *list_create(void)

  {

  struct List *head,*tail,*p;

  int e;

  head=(List *)malloc(sizeof(List));

  tail=head;

  printf("\nList Create,input numbers(end of 0):");

  scanf("%d",&e);

  while(e){

  p=(List *)malloc(sizeof(List));

  p->data=e;

  tail->next=p;

  tail=p;

  scanf("%d",&e);}

  tail->next=NULL;

  return head;

  }

  List *list_reverse(List *head)

  {

  List *p,*q,*r;

  p=head;

  q=p->next;

  while(q!=NULL)

  {

  r=q->next;

  q->next=p;

  p=q;

  q=r;

  }

  head->next=NULL;

  head=p;

  return head;

  }

  void main(void)

  {

  struct List *head,*p;

  int d;

  head=list_create();

  printf("\n");

  for(p=head->next;p;p=p->next)

  printf("--%d--",p->data);

  head=list_reverse(head);

  printf("\n");

  for(p=head;p->next;p=p->next)

  printf("--%d--",p->data);

  }

  编写函数数N个BYTE的数据中有多少位是1。

  解:此题按步骤解:先定位到某一个BYTE数据;再计算其中有多少个1。叠加得解。

  #incluede

  #define N 10

  //定义BYTE类型别名

  #ifndef BYTE

  typedef unsigned char BYTE;

  #endif

  int comb(BYTE b[],int n)

  {

  int count=0;

  int bi,bj;

  BYTE cc=1,tt;

  //历遍到第bi个BYTE数据

  for(bi=0;bi

  {

  //计算该BYTE的8个bit中有多少个1

  tt=b[bi];

  for(bj=0;bj<8;bj++)

  {

  //与1相与或模2结果是否是1?测试当前bit是否为1

  //if(tt%2==1)

  if((tt&cc)==1)

  {

  count++;

  }

  //右移一位或除以2,效果相同

  //tt=tt>>1;

  tt=tt/2;

  }

  }

  return count;

  }

  //测试

  int main()

  {

  BYTE b[10]={3,3,3,11,1,1,1,1,1,1};

  cout<

  return 0;

  }

  1,

资料共享平台

嵌入式软件工程师笔试题》(https://www.unjs.com)。编写一个 C 函数,该函数在一个字符串中找到可能的最长的子字符串,且该字符串是由同一字符组成的'。

  char * search(char *cpSource, char ch)

  {

  char *cpTemp=NULL, *cpDest=NULL;

  int iTemp, iCount=0;

  while(*cpSource)

  {

  if(*cpSource == ch)

  {

  iTemp = 0;

  cpTemp = cpSource;

  while(*cpSource == ch)

  ++iTemp, ++cpSource;

  if(iTemp > iCount)

  iCount = iTemp, cpDest = cpTemp;

  if(!*cpSource)

  break;

  }

  ++cpSource;

  }

  return cpDest;

  }

  #include

  #include

  //

  // 自定义函数MyAtoI

  // 实现整数字符串转换为证书输出

  // 程序不检查字符串的正确性,请用户在调用前检查

  //

  int MyAtoI(char str[])

  {

  int i;

  int weight = 1; // 权重

  int rtn = 0; // 用作返回

  for(i = strlen(str) - 1; i >= 0; i--)

  {

  rtn += (str[i] - '0')* weight; //

  weight *= 10; // 增重

  }

  return rtn;

  }

  void main()

  {

  char str[32];

  printf("Input a string :");

  gets(str);

  printf("%d\n", MyAtoI(str));

  }

  #include

  #include

  void reverse(char s[])

  { //字符串反转

  int c, i=0, j;

  for(j=strlen(s)-1;i

  { c=s[i];

  s[i]=s[j];

  s[j]=c;

  i++;

  }

  }

  void IntegerToString(char s[],int n)

  { int i=0,sign;

  if((sign=n)<0)//如果是负数,先转成正数

  n=-n;

  do //从个位开始变成字符,直到最高位,最后应该反转

  { s[i++]=n%10+'0';

  }while((n=n/10)>0);

  //如果是负数,补上负号

  if(sign<0)

  s[i++]='-';

  s[i]='\0';//字符串结束

  reverse(s);

  }

  void main()

  { int m;

  char c[100];

  printf("请输入整数m: ");

  scanf("%d",&m);

  IntegerToString(c,m);

  printf("integer = %d string = %s\n", m, c);

  }

  嵌入式软件工程师应知道的0x10个基本问题(经典收藏版)

  C语言测试是招聘嵌入式系统程序员过程中必须而且有效的方法。这些年,我既参加也组织了许多这种测试,在这过程中我意识到这些测试能为面试者和被面试者提供许多有用信息,此外,撇开面试的压力不谈,这种测试也是相当有趣的。

  从被面试者的角度来讲,你能了解许多关于出题者或监考者的情况。这个测试只是出题者为显示其对ANSI标准细节的知识而不是技术技巧而设计吗?这是个愚蠢的问题吗?如要你答出某个字符的ASCII值。这些问题着重考察你的系统调用和内存分配策略方面的能力吗?这标志着出题者也许花时间在微机上而不是在嵌入式系统上。如果上述任何问题的答案是"是"的话,那么我知道我得认真考虑我是否应该去做这份工作。

  从面试者的角度来讲,一个测试也许能从多方面揭示应试者的素质:最基本的,你能了解应试者C语言的水平。不管怎么样,看一下这人如何回答他不会的问题也是满有趣。应试者是以好的直觉做出明智的选择,还是只是瞎蒙呢?当应试者在某个问题上卡住时是找借口呢,还是表现出对问题的真正的好奇心,把这看成学习的机会呢?我发现这些信息与他们的测试成绩一样有用。

  有了这些想法,我决定出一些真正针对嵌入式系统的考题,希望这些令人头痛的考题能给正在找工作的人一点帮助。这些问题都是我这些年实际碰到的。其中有些题很难,但它们应该都能给你一点启迪。

  这个测试适于不同水平的应试者,大多数初级水平的应试者的成绩会很差,经验丰富的程序员应该有很好的成绩。为了让你能自己决定某些问题的偏好,每个问题没有分配分数,如果选择这些考题为你所用,请自行按你的意思分配分数。

  预处理器(Preprocessor)

【嵌入式软件工程师笔试题】相关文章:

1.软件工程师笔试题

2.VC软件工程师笔试题

3.软件工程师笔试题集

4.软件开发工程师笔试题

5.德尔福软件工程师笔试题

6.360软件工程师的笔试题

7.软件测试工程师笔试试题

8.java软件工程师笔试题目