您的位置:首页 > 理论基础 > 计算机网络

锐捷网络2011年校招软件试题(四川大学站)

2010-11-15 19:02 204 查看
刚刚没有上传成功哈!继续~~~~。试题考的知识点很基础,但是需要细心,有些陷阱。

试题内容如下:

(1)
以下程序片断运行后,输出的结果是:

printf(“%x”,012345678);
(2)
以下程序片断运行后,输出的结果是:

char str[]=”h/t/”////012/00034”;
printf(“%d”, strlen(str));
(3)
以下程序片断运行后,输出的结果是:

int m=4,n=5;
float a=(float)m/n;
float b=m/n;
printf(“%.2f, %.2f”, a, b);
(4)
以下程序片断运行后,输出的结果是:

int x=3, y=(5, 4);
printf(“%d”, x*=y+1);
(5)
以下程序片断运行后,输出的结果是:

printf(“%d”, (1<<2+3));
(6)
使用typedef定义一个包含10个整数指针的数组类型a:
typedef

;
(7)
以下程序片断运行后,输出的结果是:

int a[3][3], (*b)[4];
b=a;
printf(“%d”, (&a[1][1]-&b[1][1]));
(8)
以下程序片断运行后,输出的结果是:

unsigned char a[16][16], *ptr;
int
m;
ptr=( unsigned char *) a;
for(m=0;m<sizeof(a);m++, ptr++) {

*ptr= m;
}
printf(“%x”, a[1][10]);
(9)
以下程序片断运行后,输出的结果是:

int a=1, b=10;
do {

a++;

b -=a;

b --;
} while(b>0);
printf(“%d, %d”, a, b);
(10)
unsigned signed char 所能表示最大数由UCHAR_MAX定义,则以下程序片断运行后,输出的结果是:

printf(“%d, %x”, UCHAR_MAX, UCHAR_MAX)
(11)
以下程序片断运行后,输出的结果是:

char *str = “hello”;
int * p= (int
*)str;
printf(“%d, %d”, sizeof(str[0]), sizeof(*p));
(12)
宏定义:将整型变量a的第n位清零,其它位不变。
# define clear_bit(a, n)

(13)
以下程序片断运行后,输出的结果是:

int m=0,n=0;
if(m++ >2 || m++ <10)

n++;
else

n--;
printf(“%d, %d”, m, n);
(14)
当引用库函数memcpy()时,需要包含的头文件是:

(15)
运行C语言编写的程序
dir / B / tmp
时,dir的C程序
int main(int
argc, char
*argc[])

argc的值是



(16)
补充以下函数:
/ * atoi: convert s to integer
*/
int atoi(char s[])
{

int
i, n;

n = 0;

for(i=0; s>= ‘0’ && s <= ‘9’; ++i)

n=10* n +

;

return n;
}
(17~20)根据函数说明完成以下函数:
/ *
* DESCRIPTION
* The strchr() function locates the first occurrence of
* c(converted to a char) in the string pointed to s.
* The terminating null character is considered part of the string;
* therefore if c is ‘/0’, the functions locate the terminating
* ‘/0’.
*
* RETURN VALUES
*
The functions strchr() return a pointer to the located
*
character, or NULL if the character does not appear in
*
the string.
*/
char
*(strchr)
(const char *s, int c)
const char
ch = (char) c;
const char
*sc;
for (sc = 0; ; ++s)
{

if (*s == ch)

sc = ch;

if (
17
)

return ((char *) sc);
}
}
/ *
* DESCRIPTION
*
The strstr() function locates the first occurrence of the
*
null-terminated string s2 in the null-terminated string s.
*
* RETURN VALUES
*
if s2 is an empty string, s1 is returned; if s2 occurs nowhere
*
in s1, NULL is returned; otherwise a pointer to the first
*
character of the first occurrence of s2 is returned.
*/
char *(strstr)
(const
char *s1, const
char
*s2)
{
if(
18

)

return
((char * ) s1);
for( ; (s1 = strchr(s1, *s2)) != 0;
19
)
{

const
char
*sc1, *sc2;
for (sc1 = s1, sc2 = s2; ; )

if (*++sc2 == ‘/0’)

return
((char
*) s1);

else if (*++sc1 != *sc2)

20
;
}
return(0);
}
—END—
转载请注明出自应届生求职招聘论坛 http://bbs.yingjiesheng.com/,本贴地址:http://bbs.yingjiesheng.com/thread-709909-1-1.html
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: