糯米文學吧

位置:首頁 > 計算機 > 計算機四級

歷年計算機四級嵌入式系統開發工程師模擬題

滴水可以穿石也是鍥而不捨精神的體現。我們航行在沒有邊際的學習海洋上,只有憑藉這種精神,才可能到達知識的彼岸,下面是小編為大家搜素整理的計算機四級考試題,希望能給大家帶來幫助!更多精彩內容請及時關注我們應屆畢業生考試 網!

歷年計算機四級嵌入式系統開發工程師模擬題

  一、分析題。本題(各5分)。

假設下面代碼中的變量都是合法變量,調用外部的`函數都是正確的。回答幾個問題:

這些代碼意圖要幹什麼?

是否有問題?

如果有問題,該如何修改,或者如何避免類似錯誤發生?

如果沒有問題,如果代碼有輸出,輸出是什麼?

1、———————————————————–

int isvowel (char c)

{

return c==’a’’’’’’’’||c==’e’’’’’’’’||c==’i’’’’’’’’||c==’o’’’’’’’’||c==’u’’’’

}

2、———————————————————–

while (c==’ ’||c=’ ‘||c==’’)

c=getc(f);

3、———————————————————–

/* 當x=2, y=3, z=? */

if (x==0)

if (y==0)

z=-1;

else

z=x+y;

4、———————————————————–

/* 處理網絡事件 */

void process_network_code(int x, int y)

{

/* 選擇modes_pointer資源 */

switch (line) {

case THING1:

/* 處理異常1#, 使用老的modes_pointer資源 */

doit1();

break;

case THING2:

/* 處理異常2#, 需要重新啟動服務 */

if (x == STUFF) {

/* 重新申請modes_pointer資源,沒有初始化 */

do_first_stuff();

/* 在這種條件下,有些資源不用重新申請 */

if (y == OTHER_STUFF)

break;

/* 申請剩下的資源,並初始化 */

do_later_stuff();

}

/* 初始化modes_pointer資源 */

initialize_modes_pointer();

break;

default:

/* 處理普通事件, 使用老的modes_pointer資源 */

processing();

}

/* 使用modes_pointer資源,處理事件 */

use_modes_pointer();

}

5、———————————————————–

int is_gb2312_char c1, char c2)

{

if (c1 >= 0xa1 && c2 >= 0xa1)

return 1;

else

return 0;

}

6、———————————————————–

下面x, y的值是多少,有什麼問題?

int x = 10, y = 3;

x ^= y;

y ^= x;

x ^= y;

/* x=?, y = ? */

7、———————————————————–

int days[]={31,28,31,30,31,30,31,31,30,31,30,31,};

int calendar[12][31];

int (*monthp)[31];

int *dayp;

int i;

memset(calendar, 0, sizeof(calendar));

i = 0;

for (monthp = calendar; monthp < &calendar[12]; monthp++) {

for (dayp = *monthp; dayp < &(*monthp)[31]; dayp++) {

if (dayp - *monthp < days[calendar - monthp]) {

*dayp = i++ % 7 + 1;

}

}

}

8、———————————————————–

void printnum(long n)

{

if (n < 0) {

put’-’’’’’’’’);

n = -n;

}

if (n >= 10) {

printnum(n/10);

}

putchar (”0123456789″[n%10]);

}

9、———————————————————–

void * memchr(void *pv, unsigned char ch, size_t size)

{

unsigned char *pch = (unsigned char *) pv;

unsigned char *pchEnd = pch + size;

while (pch < pchEnd) {

if (*pch == ch)

return (pch);

pch++;

}

return NULL;

}

10、———————————————————–

void * memchr(void *pv, unsigned char ch, size_t size)

{

unsigned char *pch = (unsigned char *) pv;

unsigned char *pchPlant = pch + size;

unsigned char chSave = *pchPlant;

*pchPlant = ch;

while (pch != ch) {

pch++;

}

*pchPlant = chSave;

return ((pch == pchPlant) ? NULL : pch);

}