锐捷网络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
试题内容如下:
(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
相关文章推荐
- 第二届2011年国信蓝点杯软件设计大赛预赛的试题上三角
- 锐捷网络 2011 届校园招聘嵌入式软件试题
- 2016华为校招机试题(软件开发)
- 阿里巴巴2011年校招试题
- 锐捷网络 2013 届校园招聘嵌入式软件试题
- 华为2011年软件岗位校园招聘机试题---联系人姓名在手机上的数字匹配
- 2014届华为校招软件类机试题(机试时间:2013年9月)
- 华为2016校招 机试题
- 软件测试工程师笔试题中数据库试题集锦
- 第二届2011年国信蓝点杯软件设计大赛预赛的试题股票风险
- [历年IT笔试题]2014京东校园招聘软件开发类笔试试题
- CCF计算机软件能力认证试题练习201312-1-出现次数最多的数
- 第三届软件大赛决赛试题及答案
- 湖南省第六届 中信软件教育杯 大学生程序设计大赛试题 第一题 汽水瓶
- 2011年全国大学生电子设计竞赛试题--来自官网
- 总结2011年10个最重要的开源软件(转)
- 【机试题】大整数相乘--拼多多2018校招内推编程题
- 东莞市2011年信息学特长生测试题 工具软件
- 华为校招软件上机考试题目解析
- 腾讯2014软件开发职位校园招聘笔试试题