程序中若要使用printf()函数就必须引用头文件”stdio.h”。
第1题:
以下四个程序中,完全正确的是( )。
A.#include <stdio.h> main( ); { /* programmlng* / printf( "programming! \n" ); }
B.#include <stdio.h> main( ) { /*/programming printf("programming! \n"); }
C.#include <stdio.h> main( ) { /*programming* / printf( "programming! \n" ); }
D.include <stdio.h> main ( ) { /*/* programming*/*/ printf( "programming! \n" ); }
第2题:
此题为判断题(对,错)。
第3题:
请编写函数fun(),它的功能是:求出ss所指字符串中指定字符的个数,并返回此值。
例如,若输入字符串123412132,输入字符1,则输出3。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。
试题程序:
include<coio.h>
include<stdio.h>
define M 81
int fun(char *ss,char c)
{
}
main()
{ char a[M],ch;
clrscr();
printf("\nPlease enter a string:");
gets(a);
printf("\nPlease enter a char:");
ch=getchar();
printf("\nThe number of the char is:%d \n",fun(a,ch));
}
第4题:
若要在程序文件中进行标准输入输出操作,则必须在开始的 include命令中使用头文件______。
第5题:
给定程序中,函数fun()的功能是:使数组中的元素的值缩小5倍。
请改正程序中的错误,使它能得出正确的结果。
注意:不要改动main函数,不得增行或删行,也不得更改程序的结构。
试题程序:
include<stdio.h>
include<conio.h>
float m[10];
/*************found**************/
int fun (void)
{
int j;
printf("In subfunc after calling\n");
for(j=O;j<lO;j++)
{
;
/*************found**************/
print ("%f ",m[j]%5);
}
}
main()
{
int i;
printf ("In main before calling\n");
for (i=0;i<10;i++)
{
m[i]=i+20;
printf("%f ",m[i]);
}
fun();
printf("\nIn main after calling\n");
for(i=O; i<10;i++)
printf("%f ",m[i]/5);
}
第6题:
以下4个程序中,完全正确的是
A.#include <stdio.h> main(); {/*programming*/ printf("programming!\n");}
B.#include <stdio.h> main(); {/*/ programming /*/ printf("programming!\n");}
C.#include <stdio.h> main() {/*/*programming*/*/ printf("programming!\n");}
D.include <stdio.h> main() {/*programming*/ printf("programming!\n");}
第7题:
strlen()是一个计算字符串长度的这么一个库函数,这个库函数是定义在string.h这个头文件里的,要想使用这个库函数就必须调用预处理命令将string.h添加到当前的代码中,可是为什么在调用string.h这个头文件的基础上还要调用stdio.h这个头文件呢?stdio.h只是一个输入输出函数的这么一个头文件,跟strlen()库函数有什么关系,,,求解。
第8题:
Astdio.h文件中包含标准输入输出函数的函数说明,通过引用此文件以便能正确使用prinff、scanf等函数
B将stdio.h中标准输入输出函数链接到编译生成的可执行文件中,以便能正确运行
C将stdio.h中标准输入输出函数的源程序插入到引用处,以便进行编译链接
D将stdio.h中标准输入输出函数的二进制代码插入到引用处,以便进行编译链接
答案:A
第9题:
在一个C语言程序文件中,若要包含另外一个头文件或程序文件,则应使用的预处理命令为()。
#include
略
第10题:
若程序中使用了库函数toupper、strcpy,那么在预处理命令中必须写入的头文件名为()
第11题:
printf函数是一个标准库函数,它的函数原型在头文件"string.h"中。
第12题:
当在程序的开头包含头文件stdio.h时,可以给指针变量赋NULL
函数可以返回地址值
改变函数形参的值,不会改变对应实参的值
可以给指针变量赋一个整数作为地址值
第13题:
请补充函数fun(),函数fun()的功能是求7的阶乘。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun()的横线上填入所编写的若干表达式或语句。
试题程序:
include<stdio.h>
long fun(int n)
{
if(【 】)
return(n*fun(【 】);
else if(【 】)
return 1;
}
main()
{
int k=7;
printf("%d!=%ld\n", k, fun(k));
}
第14题:
此题为判断题(对,错)。
第15题:
请将以下程序中的函数声明语补充完整。
include<stdio.h>
int【 】
main()
{ int x,y,(*p)();
sccanf("%d%d",&x,&y);
p=max;
printf(%d\n",(*p)(x,y));
}
int max(int a,int b)
{return(a>b?a:b);}
第16题:
请编写函数fun(),它的功能是计算:s=(1-In(1)-In(2)-In(3)-…-1n(m))2
s作为函数值返回。
在C语言中可调用log(n)函数求In(n)。log函数的引用说明是double log(double x)。
例如,若m的值为15,则fun()函数值为723.570801。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。
试题程序:
include <conio.h>
include <stdio.h>
include <math.h>
double fun(int m)
{
}
main()
{
clrscr();
printf("%f\n",fun(15));
}
第17题:
请补充函数fun(char *s),该函数的功能是把字符串中的内容逆置。
例如:字符串中原有的字符串为abcde,则调用该函数后,串中的内容变为edcba。
注意;部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun()的横线上填入所编写的若干表达式或语句。
试题程序:
$include<string.h>
include<conio.h>
include<stdio.h>
define N 81
void fun(char*s)
{
int i=0,t,n=strlen(s);
for(;【 】;i++)
{
t=*(s+i);
【 】;
【 】;
}
}
main()
{
char a[N];
clrscr();
printf("Enter a string:");
gets(a);
printf("The original string is:");
puts(a);
fun(a);
printf("\n");
printf("The string after modified:");
puts(a);
}
第18题:
下面程序段的输出为( )。 #include "stdio.h" main { printf("%d\n",12<<2); }
A.0
B.47
C.48
D.24
第19题:
下列给定程序中,函数fun的功能是按以下递归公式求函数值。

例如:当给n输入5时,函数值为240;当给n输入3时,函数值为60。
请改正程序中的错误,使它能得到正确结果。
注意;不要改动main函数,不得增行或删行,也不得更改程序的结构。
试题程序:
include <stdio.h>
/*************found****+*******/
fun(int n);
{
int c;
/*************found********+*****/
if(n=1)
c=15;
else
c=fun(n-1)*2;
return(c);
}
main()
{
int n;
printf("Enter n:");
scanf("%d",&n);
printf("The result:%d\n\n",fun(n));
}
第20题:
在一个程序文件中,若要使用#include命令包含一个用户定义的头文件,则此头文件所使用的起止定界符为一对()。
A尖括号
B双引号
C单引号
D花括号
第21题:
getchar函数的原型声明包括在头文件()中
第22题:
使用putchar函数时,必须在之前包含头文件stdio.h
第23题:
第24题:
stdio.h文件中包含标准输入输出函数的函数说明,通过引用此文件以便能正确使用prinff、scanf等函数
将stdio.h中标准输入输出函数链接到编译生成的可执行文件中,以便能正确运行
将stdio.h中标准输入输出函数的源程序插入到引用处,以便进行编译链接
将stdio.h中标准输入输出函数的二进制代码插入到引用处,以便进行编译链接