APP下载
首页
>
文学知识
>
C语言程序设计题库
搜索
C语言程序设计题库
题目内容
(
单选题
)
6.C语言规定,在一个源程序中main()函数的位置( )。

A、 必须在程序的最前面

B、 必须在程序的最后面

C、 必须在预处理命令的后面

D、 可以在其他函数之前或之后

答案:空

C语言程序设计题库
30.当一个函数无返回值时,定义时函数的类型应是________。
https://www.shititong.cn/cha-kan/shiti/0005e1ec-b3f5-2440-c003-bc7499099f01.html
点击查看题目
17.以下程序运行时输出结果是________。
#include
int main( )
{int a=0, b=0, c=0;
if ( intf( );
https://www.shititong.cn/cha-kan/shiti/0005e1ec-b3f0-e268-c003-bc7499099f02.html
点击查看题目
1.下面叙述正确的是()。
https://www.shititong.cn/cha-kan/shiti/0005e1ec-b3ef-34b8-c003-bc7499099f00.html
点击查看题目
5.执行“printf( ) ;”后在屏幕上将输出()个整数。
https://www.shititong.cn/cha-kan/shiti/0005e1ec-b3ef-f420-c003-bc7499099f00.html
点击查看题目
13.本程序的功能是:将数组a和数组b中相同的数复制到数组c中。例如,如果数组a中的数据是{8,5,7,1,6,4,9},数组b中的数据是{2,9,3,7,4,5,6},则数组c中的数据是{9,7,4,5,6}。
#include
int search( )
{int i;
for(i=0; i<n; i++)
if(( (35) ))return 1;
return 0;
}
int main()
{ int a[7]={8, 5, 7, 1, 6, 4, 9}, b[7]={2, 9, 3, 7, 4, 5, 6}, c[7]={0}, i, j=0;
printf( );
for(i=0;i<7;i++)
printf("%2d",a[i]);
printf( );
for(i=0;i<7;i++)
printf("%2d",b[i]);
for(i=0; i<7; i++)
if(( (36) ))
c[j++]=b[i];
printf( );
for(i=0; ( (37) ); i++)
printf("%2d", c[i]);
return 0;
}
https://www.shititong.cn/cha-kan/shiti/0005e1ec-b3f6-9b40-c003-bc7499099f00.html
点击查看题目
20.本程序的功能是:求数组中前4个元素之和及后6个元素之和。
#include
int sum( )
{ int i, sum=0;
for(i=0;i<n; i++)
( (53) );
return( );
}
int main()
{ int a[15]={1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,15},sumh, sumt;
sumh=sum(a, 4);
sumt=sum(( (54) ),6);
printf( );
return 0;
}
https://www.shititong.cn/cha-kan/shiti/0005e1ec-b3f7-00d0-c003-bc7499099f00.html
点击查看题目
9.在定义任何一个函数时,下列选项中不可缺少的是( )。
https://www.shititong.cn/cha-kan/shiti/0005e1ec-b3f4-f560-c003-bc7499099f01.html
点击查看题目
7.本程序的功能是:将一维数组中的所有素数移到该数组的前端部分。
#include
#include
#define N 10
int main()
{int i,j,k,d=0,t, a[N]={ 21,13,6,5,3,17,23,15,9,19};
for(i=0;i<N;i++)
{k=sqrt( );
for(j=2;j<=k;j++)
if(a[i]%j==0)( (16) );
if( )
{t=a[i];
for(j=i-1;j>=d;j--)( (17) );
a[d]=t;
( (18) );}
}
for(i=0;i<N;i++)printf("%4d",a[i]);
return 0;
}
https://www.shititong.cn/cha-kan/shiti/0005e1ec-b3f3-a188-c003-bc7499099f00.html
点击查看题目
32.下列程序运行时的输出结果是________。
#include
long f( )
{ switch( )
{case 0: return(0);
case 1:
case 2: return(2);}
printf( );
return ( f(n-1) + f(n-2) );
}
int main()
{ long k;
k=f(4);
printf( ); return 0;
}
https://www.shititong.cn/cha-kan/shiti/0005e1ec-b3f5-dbd8-c003-bc7499099f00.html
点击查看题目
15.要调用数学函数时,在#include命令行中应包含( )。
https://www.shititong.cn/cha-kan/shiti/0005e1ec-b3f0-2eb8-c003-bc7499099f00.html
点击查看题目
首页
>
文学知识
>
C语言程序设计题库
题目内容
(
单选题
)
手机预览
C语言程序设计题库

6.C语言规定,在一个源程序中main()函数的位置( )。

A、 必须在程序的最前面

B、 必须在程序的最后面

C、 必须在预处理命令的后面

D、 可以在其他函数之前或之后

答案:空

分享
C语言程序设计题库
相关题目
30.当一个函数无返回值时,定义时函数的类型应是________。

A.  任意

B.  int

C.  void

D.  无

https://www.shititong.cn/cha-kan/shiti/0005e1ec-b3f5-2440-c003-bc7499099f01.html
点击查看答案
17.以下程序运行时输出结果是________。
#include
int main( )
{int a=0, b=0, c=0;
if ( intf( );
https://www.shititong.cn/cha-kan/shiti/0005e1ec-b3f0-e268-c003-bc7499099f02.html
点击查看答案
1.下面叙述正确的是()。

A.  C程序在运行时总是从main()函数开始逐条执行语句的

B.  main()函数是系统库函数

C.  main()函数中每行只能出现一条语句

D.  main()函数必须出现在所有其他函数之前

https://www.shititong.cn/cha-kan/shiti/0005e1ec-b3ef-34b8-c003-bc7499099f00.html
点击查看答案
5.执行“printf( ) ;”后在屏幕上将输出()个整数。
https://www.shititong.cn/cha-kan/shiti/0005e1ec-b3ef-f420-c003-bc7499099f00.html
点击查看答案
13.本程序的功能是:将数组a和数组b中相同的数复制到数组c中。例如,如果数组a中的数据是{8,5,7,1,6,4,9},数组b中的数据是{2,9,3,7,4,5,6},则数组c中的数据是{9,7,4,5,6}。
#include
int search( )
{int i;
for(i=0; i<n; i++)
if(( (35) ))return 1;
return 0;
}
int main()
{ int a[7]={8, 5, 7, 1, 6, 4, 9}, b[7]={2, 9, 3, 7, 4, 5, 6}, c[7]={0}, i, j=0;
printf( );
for(i=0;i<7;i++)
printf("%2d",a[i]);
printf( );
for(i=0;i<7;i++)
printf("%2d",b[i]);
for(i=0; i<7; i++)
if(( (36) ))
c[j++]=b[i];
printf( );
for(i=0; ( (37) ); i++)
printf("%2d", c[i]);
return 0;
}
https://www.shititong.cn/cha-kan/shiti/0005e1ec-b3f6-9b40-c003-bc7499099f00.html
点击查看答案
20.本程序的功能是:求数组中前4个元素之和及后6个元素之和。
#include
int sum( )
{ int i, sum=0;
for(i=0;i<n; i++)
( (53) );
return( );
}
int main()
{ int a[15]={1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,15},sumh, sumt;
sumh=sum(a, 4);
sumt=sum(( (54) ),6);
printf( );
return 0;
}
https://www.shititong.cn/cha-kan/shiti/0005e1ec-b3f7-00d0-c003-bc7499099f00.html
点击查看答案
9.在定义任何一个函数时,下列选项中不可缺少的是( )。

A.  函数名前的数据类型

B.  函数名后的一对圆括号

C.  形参声明

D.  函数体中的语句

https://www.shititong.cn/cha-kan/shiti/0005e1ec-b3f4-f560-c003-bc7499099f01.html
点击查看答案
7.本程序的功能是:将一维数组中的所有素数移到该数组的前端部分。
#include
#include
#define N 10
int main()
{int i,j,k,d=0,t, a[N]={ 21,13,6,5,3,17,23,15,9,19};
for(i=0;i<N;i++)
{k=sqrt( );
for(j=2;j<=k;j++)
if(a[i]%j==0)( (16) );
if( )
{t=a[i];
for(j=i-1;j>=d;j--)( (17) );
a[d]=t;
( (18) );}
}
for(i=0;i<N;i++)printf("%4d",a[i]);
return 0;
}
https://www.shititong.cn/cha-kan/shiti/0005e1ec-b3f3-a188-c003-bc7499099f00.html
点击查看答案
32.下列程序运行时的输出结果是________。
#include
long f( )
{ switch( )
{case 0: return(0);
case 1:
case 2: return(2);}
printf( );
return ( f(n-1) + f(n-2) );
}
int main()
{ long k;
k=f(4);
printf( ); return 0;
}
https://www.shititong.cn/cha-kan/shiti/0005e1ec-b3f5-dbd8-c003-bc7499099f00.html
点击查看答案
15.要调用数学函数时,在#include命令行中应包含( )。

A.  stdio.h

B.  string.h

C.  math.h

D.  ctype.h

https://www.shititong.cn/cha-kan/shiti/0005e1ec-b3f0-2eb8-c003-bc7499099f00.html
点击查看答案
试题通小程序
试题通app下载