APP下载
首页
>
IT互联网
>
信息技术知识竞赛c语言
搜索
信息技术知识竞赛c语言
题目内容
(
单选题
)
有以下程序
#include "stdio.h"
void main( )
{ int n[3][3], i, j;
for(i=0;i<3;i++ )
for(j=0;j<3;j++ )
n[i][j]=i+j;
for(i=0;i<2;i++ )
for(j=0;j<2;j++ )
n[i+1][j+1]+=n[i][j];
printf("%d\n", n[i][j]);
}
执行后的输出结果是( )。

A、10

B、8

C、6

D、4

答案:C

信息技术知识竞赛c语言
有以下程序
int fun(int x[],int n)
{static int sum=0,i;
for(i=0;i<n;i++) sum+=x[i];
return sum;
}
main()
{int a[]={1,2,3,4,5},b[]={6,7,8,9},s=0;
s=fun(a,5)+fun(b,4);printf("%d\n",s);
}
程序执行后的输出结果是()。
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-58c0-c089-2897e0346518.html
点击查看题目
#include "stdio.h"
int digits(int n)
{
int c=0;
do {
c++;
n/=10;
}while(n);
return c;
}
void main( )
{
printf("%d",digits(824));
}
程序运行结果是 ( ) 。
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6860-c089-2897e0346507.html
点击查看题目
有以下程序
#include
# include
char *fun(char *t)
{
char *p=t;
return(p+strlen(t)/2);
}
void main()
{
char *str="abcdefgh";
str=fun(str);
puts(str);
}
执行后的输出结果是( )。
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6c48-c089-2897e0346500.html
点击查看题目
请读程序:
main()
{ char *p;
char s[80];
scanf("%s",s);
p=s[0];
printf("%s",p);
}
请判断上面程序选出正确答案是()。
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-5ca8-c089-2897e034650f.html
点击查看题目
有以下程序
#include
void main( )
{ int a=1,*p,**pp;
pp=&p;
p=&a;
a++;
printf ("%d,%d,%d\n", a,*p, **pp);
}
执行后的输出结果是( )。
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6860-c089-2897e034651f.html
点击查看题目
下面的C程序完成的功能是()。
#define SIZE 5
void func(int data[SIZE]);
main()
{
int i,buf[SIZE];
printf("Please input %d numbers:",SIZE);
for(i=0;i scanf("%d",&buf[i]);
func(buf);
for(i=0;i printf("%5d",buf[i]);
}
void func(int data[SIZE])
{
int i,j,d;
for(i=0;i for(j=0;j if(data[j]>data[j+1])
{
d=data[j];
data[j]=data[j+1];
data[j+1]=d; }
}
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-5ca8-c089-2897e034650b.html
点击查看题目
以下函数的功能是:通过键盘输入数据,为数组中的所有元素赋值。
  #include
  #define N 10
  void fun(int x[N])
  { int i=0;
   while (i scanf("%d",______);
  }
  在程序中下划线处应填入的是( )。
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6090-c089-2897e0346520.html
点击查看题目
下面程序的运行结果是 ( )。
#include “stdio.h”
int f(int a[],int n)
{ if(n>1)
return a[0] + f(a+1, n-1);
else
return a[0];
}
main()
{ int aa[10]={1,2,3,4,5,6,7,8,9,10}, s;
s = f(aa+2,4); printf("%d\n", s);
}
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6c48-c089-2897e0346513.html
点击查看题目
设有int x,y; 以下语句判断x和y是否相等,正确的说法是该语句()。
if (x=y) printf(" x is equal to y.");
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-50f0-c089-2897e034651b.html
点击查看题目
要使下列程序的输出结果是字符A,则下划线处应填 ( ) 。
main()
{
char x='b';
int i=0;
do{
--x;
}while( _____ );
printf("%c",x);
}
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6860-c089-2897e0346504.html
点击查看题目
首页
>
IT互联网
>
信息技术知识竞赛c语言
题目内容
(
单选题
)
手机预览
信息技术知识竞赛c语言

有以下程序
#include "stdio.h"
void main( )
{ int n[3][3], i, j;
for(i=0;i<3;i++ )
for(j=0;j<3;j++ )
n[i][j]=i+j;
for(i=0;i<2;i++ )
for(j=0;j<2;j++ )
n[i+1][j+1]+=n[i][j];
printf("%d\n", n[i][j]);
}
执行后的输出结果是( )。

A、10

B、8

C、6

D、4

答案:C

信息技术知识竞赛c语言
相关题目
有以下程序
int fun(int x[],int n)
{static int sum=0,i;
for(i=0;i<n;i++) sum+=x[i];
return sum;
}
main()
{int a[]={1,2,3,4,5},b[]={6,7,8,9},s=0;
s=fun(a,5)+fun(b,4);printf("%d\n",s);
}
程序执行后的输出结果是()。

A. 45

B. 50

C. 60

D. 55

https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-58c0-c089-2897e0346518.html
点击查看答案
#include "stdio.h"
int digits(int n)
{
int c=0;
do {
c++;
n/=10;
}while(n);
return c;
}
void main( )
{
printf("%d",digits(824));
}
程序运行结果是 ( ) 。

A. 8

B. 3

C. 4

D. 5

https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6860-c089-2897e0346507.html
点击查看答案
有以下程序
#include
# include
char *fun(char *t)
{
char *p=t;
return(p+strlen(t)/2);
}
void main()
{
char *str="abcdefgh";
str=fun(str);
puts(str);
}
执行后的输出结果是( )。

A. efgh

B. abcd

C. bcde

D. cdef

https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6c48-c089-2897e0346500.html
点击查看答案
请读程序:
main()
{ char *p;
char s[80];
scanf("%s",s);
p=s[0];
printf("%s",p);
}
请判断上面程序选出正确答案是()。

A. 错误:p=s[0];
正确:p=*s;

B. 错误:p=s[0];
正确:p=s[];

C. 错误:p=s[0];
正确:p=s;

D. 错误:p=s[0];
正确:p=&s;

https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-5ca8-c089-2897e034650f.html
点击查看答案
有以下程序
#include
void main( )
{ int a=1,*p,**pp;
pp=&p;
p=&a;
a++;
printf ("%d,%d,%d\n", a,*p, **pp);
}
执行后的输出结果是( )。

A. 2,1,1

B. 2,1,2

C. 2,2,2

D. 1,1,1

https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6860-c089-2897e034651f.html
点击查看答案
下面的C程序完成的功能是()。
#define SIZE 5
void func(int data[SIZE]);
main()
{
int i,buf[SIZE];
printf("Please input %d numbers:",SIZE);
for(i=0;i scanf("%d",&buf[i]);
func(buf);
for(i=0;i printf("%5d",buf[i]);
}
void func(int data[SIZE])
{
int i,j,d;
for(i=0;i for(j=0;j if(data[j]>data[j+1])
{
d=data[j];
data[j]=data[j+1];
data[j+1]=d; }
}

A. 对一维数组降序排序

B. 对一维数组升序排序

C. 对一维数组逆向排序

D. 对一维数组顺序排序

https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-5ca8-c089-2897e034650b.html
点击查看答案
以下函数的功能是:通过键盘输入数据,为数组中的所有元素赋值。
  #include
  #define N 10
  void fun(int x[N])
  { int i=0;
   while (i scanf("%d",______);
  }
  在程序中下划线处应填入的是( )。

A. x+i

B. &x[i+1] 

C.  x+(i++)

D. &x[++i]

https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6090-c089-2897e0346520.html
点击查看答案
下面程序的运行结果是 ( )。
#include “stdio.h”
int f(int a[],int n)
{ if(n>1)
return a[0] + f(a+1, n-1);
else
return a[0];
}
main()
{ int aa[10]={1,2,3,4,5,6,7,8,9,10}, s;
s = f(aa+2,4); printf("%d\n", s);
}

A. 16

B. 18

C. 20

D. 22

https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6c48-c089-2897e0346513.html
点击查看答案
设有int x,y; 以下语句判断x和y是否相等,正确的说法是该语句()。
if (x=y) printf(" x is equal to y.");

A. 语法错

B. 不能判断x和y是否相等

C. 编译出错

D. 能判断x和y是否相等

https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-50f0-c089-2897e034651b.html
点击查看答案
要使下列程序的输出结果是字符A,则下划线处应填 ( ) 。
main()
{
char x='b';
int i=0;
do{
--x;
}while( _____ );
printf("%c",x);
}

A. i++<31

B. i++<32

C. i<31

D. i<32

https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6860-c089-2897e0346504.html
点击查看答案
试题通小程序
试题通app下载