嵌入式的筆試 面試經典題目

2021-05-26 06:52:22 字數 4921 閱讀 7240

**:

輸出char s1="2kgames";

char* s2=;

char s3[20]="2kgames";

sizeof(s1)==?

sizeof(s2)==?

sizeof(s3)==?

strlen(s1)==?

strlen(s3)==? 

《答案:8 4 20 7 7

2.輸出

class a

public:

a()

~a()

virtual void p()

virtual void q()

class b:public a

public:

b()

~b()

void q()

int main()

a* p=new b;

delete p;

答案:aba

3. 用乙個c語言表示式判斷乙個數是否位2的n次冪。

答案:x == (((x ^ (~0x0)) + 1) & x)

4. 寫乙個高效能的函式把乙個int乘以9

答案:int multiply_9(int a)

return ((a<<3)+a);

5.請寫乙個c函式,若處理器是big_endian的,則返回0;若是little_endian的,則返回1

解答:int checkcpu()

union w

int a;

char b;

} c;

c.a = 1;

return (c.b == 1);

6.int (* (*f)(int, int))(int)這裡的f是什麼?

答案:f是指標,指向乙個引數為(int,int),返回值為乙個指標的函式

這個返回的指標指向乙個引數為(int),返回值為int的函式

我的筆試之二:思科篇

1.typedef struct

char data[10];

}t1;

typedef struct

t1* p;

char data[0];

}t2;

sizeof(t2)==?

答案:4

2.含n個元素的乙個陣列,陣列的值的範圍是1~n-1,找出重複的那個值。

答案:int array[n];

int findrepeat(void)

int flag[n]=;

int i;

for(i=0;i小於n;i++)//由於此論壇系統問題直接有小於號出現顯示不正常,故此用漢字描述

if(flag[array[i]]==1)

return array[i];

else

flag[array[i]]=1;

3.下面哪些編譯通不過?

(a).

void t()

const int n=100;

int a[n];

a[2]=42;

(b).

void t()

*((int* const)0x23567890)=5;

(c).

char* fuc(void)

char a[4];

strcpy(a,"abcd");

return a;

答案:abc都可以通過編譯。

我的筆試之三:趨勢科技篇

1. 找錯誤

(1) void test(const int v)

int* p;

p=v;

答案:不能把非const指標指向const變數。應該是:const int* p;

(2) void test(const int& v)

const int& p;

p=v;

答案:引用必須在定義的時候初始化。應該是:const int& p=v;

2. 程式設計題,翻轉鍊錶。

答案:typedef struct node

int value;

struct node* next;

}slink;

slink* reverselink(slink* h)

slink* pre,*cur,*next;

pre=null;

cur=h;

next=cur->next;

while(next)

cur->next=pre;

pre=cur;

cur=next;

next=next->next;

return cur;

3.寫出輸出結果

class a

public:

a()f(0);

virtual void f(int n)

cout<<"a0:"<<   }

virtual void f(int n) const

cout<<"a1:"<<   }

virtual void f(char* s)

cout<<"a2:"<<   }

class b:public a

public:

void f(int n)

cout<<"b0:"<<    }

void f(char* s)

cout<<"b1:<<    }

int main()

a* p;

const a* cp;

b b;

p=&b;

p->f(1);

p->f("test");

a().f(2);

cp=&b;

cp->f(2);

答案:a0:0

b0:1

b1:test

a0:0

a0:2

a1:2

4. utp(非遮蔽雙絞線)的傳輸距離是?

答案:100m

5.176.68.160.0/22的子網掩碼是:

答案:255.255.252.0

我的筆試之四:先鋒商泰篇

1.下面表示式正確的是:

a. char* const s="hello";

*s=''''''''w''''

b. char* const s="hello";

s="world";

c. const char* s="hello";

*s=''''''''w''''

d. const char* s="hello";

s="world"; 

答案:d

2.下面表示式正確的是:

a. char* const s="hello";

*s=''''''''w''''

b. char* const s="hello";

s="world";

c. char s="hello";

*s=''''''''w''''

d. char s="hello";

s="world";

答案:c

3.寫出程式輸出結果:

char t="abcdefghijklmno";

t[12]=''/0''//這裡本該也沒有這麼多單引號

int i=0;

while(t[++i]!=''/0'')//這裡也是

printf("%c",t[i++]);

答案:bdfhjln

我的筆試之五--展訊篇

1. 程式設計求兩個字串的最大公共字串。

答案:#include "stdio.h"

#include "string.h"

/* 函式功能:求兩個字串的最大公共字串 */

void commonstr(char* str1,char* str2)

char* s1,*s2;

int i,j,k;          // i--最大公共字串的長度

int len1;           // j--子串s2的開始位置

int len2;           // k--子串s1的開始位置

int p;

len1=strlen(str1);

len2=strlen(str2);

if(len1

{s1=str2;

s2=str1;

len2=len1;

else

s1=str1;

s2=str2;

for(i=len2;i>0;i--)   // 從最大的開始找

for(j=0;j+i<=len2;j++)

for(k=0;k+i<=len1;k++)

p=0;

while(s1[k+p]==s2[j+p])

p++;

if(p>=i)

for(p=0;p小於i;p++)

printf("%c",s1[k+p]);

printf("/n");

return;

int main(void)

char* s1="worlld";

char* s2="hello,cjw";

commonstr(s1,s2);

return 0;

2.計算乙個位元組裡1的個數。

方法一:

int num_1(char data)

int i,j;

int sum=0;

j=1;

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

j=1<

if(data&j)

sum++;

return sum;

方法二:

unsigned int findoneinnumber_02(unsigned char x)

unsigned int n;

for(n=0; x; n++)

x &= x-1;

return n;

嵌入式筆試題目

1 wlan和wifi有什麼區別?wlan是wireless local network的縮寫,代表無線區域網,不特指某項技術。實現wlan的特定技術實際上有多種,802.11是其中應用最為廣泛的一種wlan技術。wifi實際上指的是wifi聯盟,它負責802.11的商業推廣,裝置的標準認證,但是最...

嵌入式筆試題目(二)

1 寫出簡單的hello world字元裝置驅動?include include include include static int init hello init void 初始化模組時執行 static void exit hello exit void 解除安裝模組時執行 module li...

常見的嵌入式筆試 面試(三)

1.下列函式中,能宣告為虛函式的是 bcd a.建構函式 b.公有成員函式 c.析構函式 d.私有成員函式 2.某一系統功能,需要一次性載入n n在100左右 個隨機數,後續只對該集合進行遍歷.最宜採用哪種結構存放?c a.hash表 b.二叉樹 c.鍊錶 d.析 隨機數,未經排序,二叉樹不適合 需...