有以下程序
#include
void fun(char *s)
{ while(*s)
{ if (*s%2==0) printf("%c",*s);
s++;
}
}
void main()
{
char a[]={"good"};
fun(a);
printf("\n");
}
执行后的输出结果是( )。
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6c48-c089-2897e0346503.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
点击查看答案
有以下程序
int add(int a,int b){return+b};}
main()
{int k,(*f)(),a=5,b=10;
f=add;
... }则以下函数调用语句错误的是()。
A. k=(*f)(a,b);
B. k=add(a,b);
C. k=*f(a,b);
D. k=f(a,b);
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-5ca8-c089-2897e0346504.html
点击查看答案
有以下程序段
#include
main()
{ …
while( getchar()!='\n');
…
}
以下叙述中正确的是( )。
A. 此while语句将无限循环
B. getchar()不可以出现在while语句的条件表达式中
C. 当执行此while语句时,只有按回车键程序才能继续执行
D. 当执行此while语句时,按任意键程序就能继续执行
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-54d8-c089-2897e0346500.html
点击查看答案
以下不合法的用户标识符是()。
A. j2_KEY
B. Double
C. 4d
D. _8_
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-4d08-c089-2897e034651a.html
点击查看答案
以下程序输出结果是 。
#include "stdio.h"
void f ();
main()
{int a;
for(a=1;a<=3;a++)
fun();
}
void fun()
{static int i=1;
i+=3;
printf("%2d",i);
}
A. 4 7 10
B. 4 4 4
C. 4 5 6
D. 4 6 8
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-54d8-c089-2897e0346513.html
点击查看答案
以下函数的功能是:通过键盘输入数据,为数组中的所有元素赋值。
#include
#define N 10
void fun(int x[N])
{ int i=0;
while (i scanf("%d",______);
}
在程序中下划线处应填入的是( )。
A. x+i
B. &x[i+1]
C. x+(i++)
D. &x[++i]
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6090-c089-2897e0346520.html
点击查看答案
有以下程序
#include
void main()
{
int j,a[]={1,3,5,7,9,11,13,15},*p=a+5;
for(j=3;j;j--)
{
switch(j)
{
case 1:
case 2:printf("%d",*p++);
case 3:printf("%d",*(--p));
}
}
}
执行后的输出结果是( )。
A. 9911
B. 79911
C. 99999
D. 991113
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6860-c089-2897e0346522.html
点击查看答案
判断两个字符串是否相等,正确的表达方式是( )。
A. while(s1==s2)
B. while(s1=s2)
C. while(strcmp(s1,s2)==0)
D. while(strcmp(s1,s2)=0)
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-50f0-c089-2897e034651f.html
点击查看答案
设有int x,y; 以下语句判断x和y是否相等,正确的说法是该语句()。
if (x=y) printf(" x is equal to y.");
A. 语法错
B. 不能判断x和y是否相等
C. 编译出错
D. 能判断x和y是否相等
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-50f0-c089-2897e034651b.html
点击查看答案