试题通
试题通
APP下载
首页
>
IT互联网
>
信息技术知识竞赛c语言
试题通
搜索
信息技术知识竞赛c语言
题目内容
(
单选题
)
main()
{ int x=3,i;
for(i=0;i<3;i++) printf("%d",f(x));
}
int f(int a)
{ int b=0;
static c=3;
b++;c++;
return(a+b+c);
}
执行此程序后屏幕上显示的结果是()。

A、8 10 10

B、7 9 10

C、8 9 11

D、8 9 10

答案:D

试题通
信息技术知识竞赛c语言
试题通
对以下for循环,叙述正确的是()。
for(x=0,y=0;(y!=123)&&(x<4);x++,y++);
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-54d8-c089-2897e034651e.html
点击查看题目
若有说明语句:double *p,a;则能通过scanf语句正确给输入项读入数据的程序段是()。
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-4d08-c089-2897e0346528.html
点击查看题目
#include
void disp(char *string)
{
if(*string)
{
disp( string+1);
putchar (*string);
}
}
void main()
{
disp("abcdefg");
}
程序的运行结果是( )。
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6860-c089-2897e0346506.html
点击查看题目
若有如下定义变量:
int k=7,x=12; 则能使值为3的表达式是
()。
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-4920-c089-2897e0346508.html
点击查看题目
if语句的基本形式是:if(表达式)语句,以下关于“表达式”值的叙述中正确的是( )。
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-50f0-c089-2897e0346526.html
点击查看题目
#include
int streql(char *str1,char *str2)
{ while((*str1==*str2)&&(*str1))
{
str1++;
str2++;
}
return((*str1==NULL)&&(*str2==NULL));
}
void main()
{
printf("%d",streql("abc","Abc"));
}
程序的运行结果是 ( ) 。
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6860-c089-2897e0346509.html
点击查看题目
有以下程序
#include "stdio.h"
main()
{ int a,b,c=246;
a=c/100%9;
b=(-1)&&(-1);
printf("%d,%d\n",a,b);
}
输出结果是()。
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-5ca8-c089-2897e0346515.html
点击查看题目
阅读下面的程序,运行结果是()。
main()
{
char *str="ABCabcd";
bubble(str,5);
printf("\n%s",str);
}

bubble(str,count)
char *str;
int count;
{
int i,j=count;
char tmp;
while(j-->1)
for(i=0;i if(str[i] {
tmp=str[i];
str[i]=str[i+1];
str[i+1]=tmp;
}
}
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-5ca8-c089-2897e0346517.html
点击查看题目
有以下程序段
  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);
  }
以下关于程序段执行情况的叙述,正确的是( )。
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6090-c089-2897e034651c.html
点击查看题目
设有如下定义:
int (*ptr)();
则以下叙述中正确的是()。
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6090-c089-2897e0346510.html
点击查看题目
首页
>
IT互联网
>
信息技术知识竞赛c语言
题目内容
(
单选题
)
手机预览
试题通
信息技术知识竞赛c语言

main()
{ int x=3,i;
for(i=0;i<3;i++) printf("%d",f(x));
}
int f(int a)
{ int b=0;
static c=3;
b++;c++;
return(a+b+c);
}
执行此程序后屏幕上显示的结果是()。

A、8 10 10

B、7 9 10

C、8 9 11

D、8 9 10

答案:D

试题通
试题通
信息技术知识竞赛c语言
相关题目
对以下for循环,叙述正确的是()。
for(x=0,y=0;(y!=123)&&(x<4);x++,y++);

A. 是无限循环

B. 循环次数不定

C. 执行了4次

D. 执行了3次

https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-54d8-c089-2897e034651e.html
点击查看答案
若有说明语句:double *p,a;则能通过scanf语句正确给输入项读入数据的程序段是()。

A. *p=a;
scanf("%1f",p);

B. *p=a;
scanf("%f",p);

C. p=a;
scanf("%1f",*p);

D. p=&a;
scanf("%1f",p);

https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-4d08-c089-2897e0346528.html
点击查看答案
#include
void disp(char *string)
{
if(*string)
{
disp( string+1);
putchar (*string);
}
}
void main()
{
disp("abcdefg");
}
程序的运行结果是( )。

A. abcdefg

B. gfedcba

C. abcd

D. dcba

https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6860-c089-2897e0346506.html
点击查看答案
若有如下定义变量:
int k=7,x=12; 则能使值为3的表达式是
()。

A. x%=(k%=5)

B. x%=(k-k%5)

C. x%=k-k%5

D. (x%=k)-(k%=5)

https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-4920-c089-2897e0346508.html
点击查看答案
if语句的基本形式是:if(表达式)语句,以下关于“表达式”值的叙述中正确的是( )。

A. 必须是逻辑值( )。

B. 必须是整数值

C. 必须是正数

D. 可以是任意合法的数值

https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-50f0-c089-2897e0346526.html
点击查看答案
#include
int streql(char *str1,char *str2)
{ while((*str1==*str2)&&(*str1))
{
str1++;
str2++;
}
return((*str1==NULL)&&(*str2==NULL));
}
void main()
{
printf("%d",streql("abc","Abc"));
}
程序的运行结果是 ( ) 。

A. 0

B. 1

C. 2

D. 3

https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6860-c089-2897e0346509.html
点击查看答案
有以下程序
#include "stdio.h"
main()
{ int a,b,c=246;
a=c/100%9;
b=(-1)&&(-1);
printf("%d,%d\n",a,b);
}
输出结果是()。

A. 2,1

B. 3,2

C. 4,3

D. 2,-1

https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-5ca8-c089-2897e0346515.html
点击查看答案
阅读下面的程序,运行结果是()。
main()
{
char *str="ABCabcd";
bubble(str,5);
printf("\n%s",str);
}

bubble(str,count)
char *str;
int count;
{
int i,j=count;
char tmp;
while(j-->1)
for(i=0;i if(str[i] {
tmp=str[i];
str[i]=str[i+1];
str[i+1]=tmp;
}
}

A. bacdCBA

B. baCBAcd

C. cdbaCBA

D. bCBAacd

https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-5ca8-c089-2897e0346517.html
点击查看答案
有以下程序段
  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时结束程序运行

https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6090-c089-2897e034651c.html
点击查看答案
设有如下定义:
int (*ptr)();
则以下叙述中正确的是()。

A. ptr是指向一维组数的指针变量

B. ptr是指向int型数据的指针变量

C. ptr是指向函数的指针,该函数返回一个int型数据

D. ptr是一个函数名,该函数的返回值是指向int型数据的指针

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