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

A、1

B、2

C、3

D、4

答案:D

信息技术知识竞赛c语言
若有定义:int b[5];则以下对b 数组元素的正确引用是()。
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-50f0-c089-2897e034651a.html
点击查看题目
有以下程序
#include
double f(double x);
main()
{double a=0; int i;
for(i=0;i<30;i+=10) a+=f((double)i);
printf(“%5.0f\n”,a);
}
double f(double x)
{return x*x+1;}
程序运行后的输出结果是()。
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6478-c089-2897e034650e.html
点击查看题目
若int x;且有下面的程序片断,则输出结果是() 。
for (x=3; x<6; x++)
{
printf((x%2) ? "##%d" : "**%d\n", x);
}
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6090-c089-2897e0346519.html
点击查看题目
#include "stdio.h"
void main( )
{ char str[80];
scanf("%s",str);
insert(str);
}
insert(char s[])
{
int i;
for(i=strlen(s);i>0;i--)
{ s[2*i]=s[i];
s[2*i-1]=' ';
}
printf("%s",s);
}
如果输入的字符串是abcd, 则程序的运行结果是 ( ) 。
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6860-c089-2897e0346508.html
点击查看题目
在C语言中,如果下面的变量都是int类型,则输出的结果是(  )。
sum=5,p=5;p=sum++,p++,++p;
printf("%d\n",p);
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-5ca8-c089-2897e034651a.html
点击查看题目
有以下程序
#include
main()
{int c[3]={0},k,I;
while((k=getchar())!=’\n’)
c[k-‘A’]++;
for(i=0;i<3;i++) printf(“%d”,c[i]); printf(“\n”);
}
若程序运行时从键盘输入ABCACC<回车>,则输出结果为 ( ) 。
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6478-c089-2897e034651b.html
点击查看题目
设有以下语句
int a=1,b=2,c;
c=a^(b<<2);
执行后,C的值为()。
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-50f0-c089-2897e0346501.html
点击查看题目
设有如下定义:
int (*ptr)();
则以下叙述中正确的是()。
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6090-c089-2897e0346510.html
点击查看题目
下列程序段的执行结果是输出( )。
x=3;
do

printf("%2d",x--);
} while(!x);
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-54d8-c089-2897e0346520.html
点击查看题目
有以下程序
#include
main()
{struct node{int n;struct node *next;} *p;
struct node x[3]={{2,x+1},{4,x+2},{6,NULL}};
p=x;
printf(“%d,”,p->n);
printf(“%d\n”,p->next->n);
}
程序运行后的输出结果是( )。
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6478-c089-2897e0346515.html
点击查看题目
首页
>
IT互联网
>
信息技术知识竞赛c语言
题目内容
(
单选题
)
手机预览
信息技术知识竞赛c语言

有以下程序
#include
int fun()
{static int x=1;
x*=2; return x;
}
void main()
{int i,s=1;
for (i=1;i<=2;i++) s=fun();
printf("%d\n",s);
}
执行后的输出结果是( )。

A、1

B、2

C、3

D、4

答案:D

信息技术知识竞赛c语言
相关题目
若有定义:int b[5];则以下对b 数组元素的正确引用是()。

A. *b[5]

B. b+2

C. *(*(b+2))

D. *(b+2)

https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-50f0-c089-2897e034651a.html
点击查看答案
有以下程序
#include
double f(double x);
main()
{double a=0; int i;
for(i=0;i<30;i+=10) a+=f((double)i);
printf(“%5.0f\n”,a);
}
double f(double x)
{return x*x+1;}
程序运行后的输出结果是()。

A. 503

B. 401

C. 500

D. 1404

https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6478-c089-2897e034650e.html
点击查看答案
若int x;且有下面的程序片断,则输出结果是() 。
for (x=3; x<6; x++)
{
printf((x%2) ? "##%d" : "**%d\n", x);
}

A. ##3
**4
##5

B. **3
##4
**5

C. **3
##4**5

D. ##3**4
##5

https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6090-c089-2897e0346519.html
点击查看答案
#include "stdio.h"
void main( )
{ char str[80];
scanf("%s",str);
insert(str);
}
insert(char s[])
{
int i;
for(i=strlen(s);i>0;i--)
{ s[2*i]=s[i];
s[2*i-1]=' ';
}
printf("%s",s);
}
如果输入的字符串是abcd, 则程序的运行结果是 ( ) 。

A.
a
b
c
d

B. a c b d

C. a b c d

D. d
c
b
a

https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6860-c089-2897e0346508.html
点击查看答案
在C语言中,如果下面的变量都是int类型,则输出的结果是(  )。
sum=5,p=5;p=sum++,p++,++p;
printf("%d\n",p);

A. 7

B. 6

C. 5

D. 4

https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-5ca8-c089-2897e034651a.html
点击查看答案
有以下程序
#include
main()
{int c[3]={0},k,I;
while((k=getchar())!=’\n’)
c[k-‘A’]++;
for(i=0;i<3;i++) printf(“%d”,c[i]); printf(“\n”);
}
若程序运行时从键盘输入ABCACC<回车>,则输出结果为 ( ) 。

A. 211

B. 212

C. 213

D. 214

https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6478-c089-2897e034651b.html
点击查看答案
设有以下语句
int a=1,b=2,c;
c=a^(b<<2);
执行后,C的值为()。

A. 6

B. 7

C. 8

D. 9

https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-50f0-c089-2897e0346501.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
点击查看答案
下列程序段的执行结果是输出( )。
x=3;
do

printf("%2d",x--);
} while(!x);

A. 3 2 1

B. 3

C. 2 1

D. 2 1 0

https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-54d8-c089-2897e0346520.html
点击查看答案
有以下程序
#include
main()
{struct node{int n;struct node *next;} *p;
struct node x[3]={{2,x+1},{4,x+2},{6,NULL}};
p=x;
printf(“%d,”,p->n);
printf(“%d\n”,p->next->n);
}
程序运行后的输出结果是( )。

A. 2,3

B. 2,4

C. 3,4

D. 4,6

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