APP下载
首页
>
IT互联网
>
信息技术知识竞赛c语言
搜索
信息技术知识竞赛c语言
题目内容
(
单选题
)
有以下程序段
  int i,n;
  for(i=0;i<8;i++)
  { n=rand()%5;
  switch (n)
  { case 1:
  case 3:printf("%d\n",n); break;
  case 2:
  case 4:printf("%d\n",n); continue;
  case 0:exit(0);
  }
  printf("%d\n",n);
  }
以下关于程序段执行情况的叙述,正确的是( )。

A、for循环语句固定执行8次

B、当产生的随机数n为4时结束循环操作

C、当产生的随机数n为1和2时不做任何操作

D、当产生的随机数n为0时结束程序运行

答案:D

信息技术知识竞赛c语言
在以下给出的表达式中,与while(E)中的(E)不等价的表达式是()。
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-4d08-c089-2897e0346525.html
点击查看题目
有以下程序,若运行时从键盘输入:18,11<回车>,则程序的输出结果是( ) 。
main()
{ int a,b;
printf("Enter a,b:"); scanf("%d,%d",&a,&b);
while(a!=b)
{ while(a>b) a -= b;
while(b>a) b -= a;
}
printf("%3d%3d\n",a,b);
}
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6c48-c089-2897e0346514.html
点击查看题目
以下程序运行后的输出结果是( ) 。
#include
void fun(int x)
{if(x/5>0) fun(x/5);
printf(“%d”,x);
}
main()
{fun(11); printf(“\n”);}
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6478-c089-2897e034651a.html
点击查看题目
以下不合法的用户标识符是()。
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-4d08-c089-2897e034651a.html
点击查看题目
若有以下程序段,输出结果是( )。
char s[ ]="\\141\141abc\t";
printf ("%d\n",strlen(s));
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-50f0-c089-2897e0346521.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
点击查看题目
有以下程序
main()
{int a=0,b=0,c=0,d=0;
if(a=1) b=1;c=2;
else d=3;
printf("%d,%d,%d,%d\n",a,b,c,d);
}
程序输出()。
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-58c0-c089-2897e0346511.html
点击查看题目
定义struct st
{int x;
float y;
double z;
} b;
则b是字节数 。
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-54d8-c089-2897e0346511.html
点击查看题目
有以下程序
#include
int f(int m)
{static int n=0;
n+=m;
return n;
}
main()
{int n=0;
printf(“%d,”,f(++n));
printf(“%d\n”,f(n++));
}
程序运行后的输出结果是()。
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6478-c089-2897e0346512.html
点击查看题目
有以下程序
#include
Main()
{int a=1,b=0;
if(--a) b++;
else if(a==0) b+=2;
else b+=3;
printf(“%d\n”,b);
}
程序运行后的输出结果是()。
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6090-c089-2897e034651b.html
点击查看题目
首页
>
IT互联网
>
信息技术知识竞赛c语言
题目内容
(
单选题
)
手机预览
信息技术知识竞赛c语言

有以下程序段
  int i,n;
  for(i=0;i<8;i++)
  { n=rand()%5;
  switch (n)
  { case 1:
  case 3:printf("%d\n",n); break;
  case 2:
  case 4:printf("%d\n",n); continue;
  case 0:exit(0);
  }
  printf("%d\n",n);
  }
以下关于程序段执行情况的叙述,正确的是( )。

A、for循环语句固定执行8次

B、当产生的随机数n为4时结束循环操作

C、当产生的随机数n为1和2时不做任何操作

D、当产生的随机数n为0时结束程序运行

答案:D

信息技术知识竞赛c语言
相关题目
在以下给出的表达式中,与while(E)中的(E)不等价的表达式是()。

A. (!E==0)

B. (E>0‖E<0)

C. (E==0)

D. (E!=0)

https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-4d08-c089-2897e0346525.html
点击查看答案
有以下程序,若运行时从键盘输入:18,11<回车>,则程序的输出结果是( ) 。
main()
{ int a,b;
printf("Enter a,b:"); scanf("%d,%d",&a,&b);
while(a!=b)
{ while(a>b) a -= b;
while(b>a) b -= a;
}
printf("%3d%3d\n",a,b);
}

A. 1 1

B. 2 1

C. 2 2

D. 3 3

https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6c48-c089-2897e0346514.html
点击查看答案
以下程序运行后的输出结果是( ) 。
#include
void fun(int x)
{if(x/5>0) fun(x/5);
printf(“%d”,x);
}
main()
{fun(11); printf(“\n”);}

A. 211

B. 212

C. 213

D. 214

https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6478-c089-2897e034651a.html
点击查看答案
以下不合法的用户标识符是()。

A. j2_KEY

B. Double

C. 4d

D. _8_

https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-4d08-c089-2897e034651a.html
点击查看答案
若有以下程序段,输出结果是( )。
char s[ ]="\\141\141abc\t";
printf ("%d\n",strlen(s));

A. 9

B. 12

C. 13

D. 14

https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-50f0-c089-2897e0346521.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
点击查看答案
有以下程序
main()
{int a=0,b=0,c=0,d=0;
if(a=1) b=1;c=2;
else d=3;
printf("%d,%d,%d,%d\n",a,b,c,d);
}
程序输出()。

A. 0,1,2,0

B. 0,0,0,3

C. 1,1,2,0

D. 编译有错

https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-58c0-c089-2897e0346511.html
点击查看答案
定义struct st
{int x;
float y;
double z;
} b;
则b是字节数 。

A. 4

B. 8

C. 10

D. 16

https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-54d8-c089-2897e0346511.html
点击查看答案
有以下程序
#include
int f(int m)
{static int n=0;
n+=m;
return n;
}
main()
{int n=0;
printf(“%d,”,f(++n));
printf(“%d\n”,f(n++));
}
程序运行后的输出结果是()。

A. 1,2

B. 1,1

C. 2,3

D. 3,3

https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6478-c089-2897e0346512.html
点击查看答案
有以下程序
#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

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