试题答案

3773考试网计算机等级考试试题答案正文

[组图]2009年9月全国计算机等级考试二级C语言真题及答案

来源:fjzsksw.com 2010-4-1 11:31:05

 

 

11)有以下程序

#include <stdio.h>

int a=5;

void fun(int b)

{ int a=10;

  a+=b;printf(“%d”,a);

}

main()

{ int c=20;

  fun(c);a+=c;printf(“%d\n”,a);

}

程序运行后的输出结果是 11

 

12)设有定义:

struct person

{ int ID;char name[12];}p;

请将scanf(“%d”, 12 );语句补充完整,使其能够为结构体变量p的成员ID正确读入数据。

 

13)有以下程序

#include <stdio.h>

main()

{ char a[20]=”How are you?”,b[20];

  scanf(“%s”,b);printf(“%s %s\n”,a,b);

}

程序运行时从键盘输入:How are you?<回车>

则输出结果为 13

 

14)有以下程序

#include <stdio.h>

typedef struct

{ int num;double s}REC;

void fun1( REC x ){x.num=23;x.s=88.5;}

main()

{ REC a={16,90.0 };

  fun1(a);

  printf(“%d\n”,a.num);

}

程序运行后的输出结果是 14

 

15)有以下程序

#include <stdio.h>

fun(int x)

{ if(x/2>0) run(x/2);

  printf(“%d ”,x);

}

main()

{ fun(6);printf(“\n”); }

程序运行后的输出结果是 15

 

 

 

上一页  [1] [2] [3] [4] [5] [6] [7] 下一页

触屏版 电脑版
3773考试网 琼ICP备12003406号-1