试题通
试题通
APP下载
首页
>
IT互联网
>
信息技术知识竞赛c语言
试题通
搜索
信息技术知识竞赛c语言
题目内容
(
单选题
)
有以下程序
#include
Main()
{int a=1,b=0;
if(--a) b++;
else if(a==0) b+=2;
else b+=3;
printf(“%d\n”,b);
}
程序运行后的输出结果是()。

A、0

B、1

C、2

D、3

答案:C

试题通
信息技术知识竞赛c语言
试题通
有以下程序
#include
void main()
{ int b[3] [3]={0,1,2,0,1,2,0,1,2},i,j,t=1;
for(i=0; i<3; i++)
for(j=i;j<=i;j++) t+=b[i][b[j][i]];
printf("%d\n",t);
}
执行后的输出结果是( )。
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6860-c089-2897e0346516.html
点击查看题目
有以下程序
#include "stdio.h"
#include
void main()
{ float x,y,z;
scanf("%f,%f",&x,&y);
z=x/y;
while(1)
{ if(fabs(z)>1.0)
{ x=y;
y=z;
z=x/y;
}
else break;
}
printf("%f\n",y);
}
通过键盘输入3.6,2.4,执行后的输出结果是( )。
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6c48-c089-2897e0346506.html
点击查看题目
下程序运行后的输出结果是() 。
  #include
  main()
  { int a;
  a=(int)((double)(3/2)+0.5+(int)1.99*2);
  printf("%d\n",a);
  }
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6478-c089-2897e0346505.html
点击查看题目
有以下程序
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
点击查看题目
下列不正确的转义字符是()。
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-4d08-c089-2897e0346501.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
点击查看题目
以下能正确定义字符串的语句是()。
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-4d08-c089-2897e034651c.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
点击查看题目
以下程序的输出结果是()。
long fun( int n)
{ long s;
if(n==1||n==2)s=2;
else s=n-fun(n-1);
return s;}
main()
{ printf("%ld\n", fun(3)); }
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-58c0-c089-2897e034650b.html
点击查看题目
若有定义语句:int year=2009,*p=&year;,以下不能使变量year中的值增至2010的语句是()。
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-54d8-c089-2897e0346505.html
点击查看题目
首页
>
IT互联网
>
信息技术知识竞赛c语言
题目内容
(
单选题
)
手机预览
试题通
信息技术知识竞赛c语言

有以下程序
#include
Main()
{int a=1,b=0;
if(--a) b++;
else if(a==0) b+=2;
else b+=3;
printf(“%d\n”,b);
}
程序运行后的输出结果是()。

A、0

B、1

C、2

D、3

答案:C

试题通
试题通
信息技术知识竞赛c语言
相关题目
有以下程序
#include
void main()
{ int b[3] [3]={0,1,2,0,1,2,0,1,2},i,j,t=1;
for(i=0; i<3; i++)
for(j=i;j<=i;j++) t+=b[i][b[j][i]];
printf("%d\n",t);
}
执行后的输出结果是( )。

A. 1

B. 2

C. 3

D. 4

https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6860-c089-2897e0346516.html
点击查看答案
有以下程序
#include "stdio.h"
#include
void main()
{ float x,y,z;
scanf("%f,%f",&x,&y);
z=x/y;
while(1)
{ if(fabs(z)>1.0)
{ x=y;
y=z;
z=x/y;
}
else break;
}
printf("%f\n",y);
}
通过键盘输入3.6,2.4,执行后的输出结果是( )。

A. 1.5

B. 1.6

C. 2

D. 2.4

https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6c48-c089-2897e0346506.html
点击查看答案
下程序运行后的输出结果是() 。
  #include
  main()
  { int a;
  a=(int)((double)(3/2)+0.5+(int)1.99*2);
  printf("%d\n",a);
  }

A. 3

B. 2

C. 0

D. 1

https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6478-c089-2897e0346505.html
点击查看答案
有以下程序
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
点击查看答案
下列不正确的转义字符是()。

A. \\'

B. \"

C. 074'

D. \0'

https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-4d08-c089-2897e0346501.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. char str[]={"\064"};

B. char str="kx43";

C. char str="";

D. char str[]="\0"

https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-4d08-c089-2897e034651c.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
点击查看答案
以下程序的输出结果是()。
long fun( int n)
{ long s;
if(n==1||n==2)s=2;
else s=n-fun(n-1);
return s;}
main()
{ printf("%ld\n", fun(3)); }

A. 1

B. 2

C. 3

D. 4

https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-58c0-c089-2897e034650b.html
点击查看答案
若有定义语句:int year=2009,*p=&year;,以下不能使变量year中的值增至2010的语句是()。

A. *p+=1;

B. (*p)++;

C. ++(*p);

D. *p++;

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