计算机二级习题练习

计算机二级考试C语言每日一练(2015-12-3)
1题:设变量均已正确定义并赋值,以下与其他三组输出结果不同的一组语句是(  )。
A.x++;printf("%dkn",x);
B.n=++x;printf("%d\n",n);
C.++x;printf("%d\n",x);
D.n=x++;printf("%6d\n",n);
【单选题】:      

2题:下面叙述正确的是()
A.2/3与2.0/3.0等价
B.(int)2.0/3与2/3等价
C.++5与6等价
D.„A‟与”A”等价
【单选题】:      

3题:
以下对结构变量stul中成员age的非法引用是 ()
struct student
{ int age;
int num;
}stu1,*p;
p=&stu1;
A、 stu1.age
B、 student.age
C、 p->age
D、(*p).age
【单选题】:      

4题:char a[5]={ ‘a’,’b’,’c’} 数组长度为()。
 
【填空题】:

5题:若有定义:int a=2,b=3;float x=3.5,y=2.5;则表达式(float)(a+
B)/2+(int)x%(int)y的值为() 。
【填空题】:

6题:下面程序的运行结果是( )。
  #include
  voiddel(char*s)
  {inti,j;
  char*a:
  a=s:
  for(i=0,j一0;a[i]!='\o';i++)
  {if(a[i]>='0'&&a[i]<='9')
  {s[j]=a[i];
  j++;
  }
  s[j]='\0';
  }
  )
  main()
  {char*s==”aa89gggh”:
  del(s);
  printf(”\n%s”,s);
A.1
B.2
C.3
D.4
【单选题】:      

7题:检查软件产品是否符合需求定义的过程是()。
【填空题】:

8题:以下程序中函数huiwen的功能是检查一个字符串是否是回文,当字符串是回文时,函数返回字符串:yes!,否则函数返回字符串:no!,并在主函数中输出,所谓回文即正向与反向的拼写都一样,例如:adgda。请填空。
#include 
char *huiwen(char *str)
{ char *p1,*p2; int i,t=0;
p1=str;p2= 【 】 ;
for(i=0;i<=strlen(str)/2;i++)
if(*p1++!=*p2--){t=1;break;}
if( 【 】 ) return("yes!");
else return("no!");
}
main()
{ char str[50];
printf("Input:"); scanf("%s",str);
printf("%s\n", 【 】 );

【填空题】:

9题:在程序中 int a = 0x6d,是把一个()进制的数给变量a 注意这里的0x 必须存在。
【填空题】:

10题:有以下程序:
#include
struct stu
{int num;char name[l0];int age;};
void fun(struct stu*p)
{printf("%s\n",p->name);}
main(  )
{struct stu x[3]={{01,"Zhang",20),{02,"Wang",l9},{03,"Zha0",l8}};
fun(x+2);
}
程序运行后的输出结果是(  )。
A.Zhang
B.Zhao
C.Wang 
D.19
【单选题】:      

 

您正在结束答题

请确认是否提交试卷?

继续做题 确认提交