单项选择题有以下程序:
# include <stdio.h>
main()
{int a,b,k,m,*p1,*p2;
k=1,m=8;
p1=&k,p2=&m;
a=/*p1-m;b=*p1+*p2+6;
printf("%d",a); printf("%d\n",b);
}
编译时编译器提示错误信息,你认为出错的语句是______。
# include <stdio.h>
main()
{int a,b,k,m,*p1,*p2;
k=1,m=8;
p1=&k,p2=&m;
a=/*p1-m;b=*p1+*p2+6;
printf("%d",a); printf("%d\n",b);
}
编译时编译器提示错误信息,你认为出错的语句是______。
A.a=/*p1-m;
B.b=*p1+*p2+6;
C.k=1,m=8;
D.p1=&k,p2=&m;
延伸阅读
你可能感兴趣的试题
1.单项选择题数据库系统的三级模式不包括______。
A.概念模式
B.内模式
C.外模式
D.数据模式
2.单项选择题若有以下函数首部
int fun(double x[10], int*n)
则下面针对此函数的函数声明语句中正确的是______。
int fun(double x[10], int*n)
则下面针对此函数的函数声明语句中正确的是______。
A.int fun(double *, int*);
B.int fun(double, int);
C.int fun(double *x, int n);
D.int fun(double x, int*n);
3.单项选择题有以下计算公式
若程序前面已在命令行中包含math.h文件,不能够正确计算上述公式的程序段是______。
若程序前面已在命令行中包含math.h文件,不能够正确计算上述公式的程序段是______。
A.if(x>=0) y=sqrt(x);else y=sqrt(-x);
B.y=sqrt(x);if(x<0) y=sqrt(-x);
C.if(x>=0) y=sqrt(x);if(x<0) y=sqrt(-x);
D.y=sqrt(x>=0 x:-x);
4.单项选择题有以下函数:
int aaa(char*s)
{char*t=s;
while(*t++);
t--;
return(t-s);
}
以下关于aaa函数功能叙述正确的是______。
int aaa(char*s)
{char*t=s;
while(*t++);
t--;
return(t-s);
}
以下关于aaa函数功能叙述正确的是______。
A.将串s复制到串t
B.比较两个串的大小
C.求字符串s的长度
D.求字符串s所占字节数
5.单项选择题有以下程序
#include <stdio.h>
void fun(int a[],int n)
{ int i,t;
for(i=0;i<n/2;i++) {t=a[i];a[i]=a[n-1-i];a[n-1-i]=t;}
main()
{ int k[10]={1,2,3,4,5,6,7,8,9,10},i;
fun(k,5);
for(i=2;i<8;i++) printf("%d",k[i]);
printf("\n");
}
程序的运行结果是______。
#include <stdio.h>
void fun(int a[],int n)
{ int i,t;
for(i=0;i<n/2;i++) {t=a[i];a[i]=a[n-1-i];a[n-1-i]=t;}
main()
{ int k[10]={1,2,3,4,5,6,7,8,9,10},i;
fun(k,5);
for(i=2;i<8;i++) printf("%d",k[i]);
printf("\n");
}
程序的运行结果是______。
A.321678
B.876543
C.1098765
D.345678
6.单项选择题有以下程序
#include<stdio.h>
int f(int x);
main()
{ int a,b=0;
for(a=0;a<3;a+=1)
{b+=f(a);putchar("A"+b);}
}
int f(int x)
( return x*x+1;}
程序运行后输出结果是______。
#include<stdio.h>
int f(int x);
main()
{ int a,b=0;
for(a=0;a<3;a+=1)
{b+=f(a);putchar("A"+b);}
}
int f(int x)
( return x*x+1;}
程序运行后输出结果是______。
A.BDI
B.BCD
C.ABE
D.BCF
7.单项选择题有以下程序:
#include<stdio.h>
main()
{int a1,a2;char c1,c2;
scanf("%d%c%d%c",&a1,&c1,&a2,&c2);
printf("%d,%c,%d,%c",a1,c1,a2,c2);
}
若想通过键盘输入,使得a1的值为12,a2的值为34,c1的值为字符a,c2的值为字符b,程序运行后的输出结果是:12,a,34,b。则正确的输入格式是(以下
代表空格,<CR>代表回车)______。
#include<stdio.h>
main()
{int a1,a2;char c1,c2;
scanf("%d%c%d%c",&a1,&c1,&a2,&c2);
printf("%d,%c,%d,%c",a1,c1,a2,c2);
}
若想通过键盘输入,使得a1的值为12,a2的值为34,c1的值为字符a,c2的值为字符b,程序运行后的输出结果是:12,a,34,b。则正确的输入格式是(以下
代表空格,<CR>代表回车)______。
A.
B.
C.12,a,34,b <CR>
D.12a34b<CR>
8.单项选择题下面程序段的运行结果是( )。
char a[]="abcdefgh";
char *p=a;
p+=3;
printf("%d\n",strlen(strcpy(p,"ABCD")));
char a[]="abcdefgh";
char *p=a;
p+=3;
printf("%d\n",strlen(strcpy(p,"ABCD")));
A.8
B.12
C.4
D.7
9.单项选择题下列程序段的输出结果是
int n="c";
switch(n++)
{default: printf("error");break;
case "a": case "A": case "b": case "B": printf("good");break;
case "c": case "C": printf("pass");
case "d": case "D": printf("warn");
}
int n="c";
switch(n++)
{default: printf("error");break;
case "a": case "A": case "b": case "B": printf("good");break;
case "c": case "C": printf("pass");
case "d": case "D": printf("warn");
}
A.passwarn
B.passerror
C.goodpasswarn
D.pass
10.单项选择题有以下程序
#include<stdio.h>
main()
{int i,j,m=1;
for(i=1;i<3;i++)
{for(j=3;j>0;j--)
{if(i*j>3)break;
m*=i*j;
}
}
printf("m=%d\n",m);
}
程序运行后的输出结果是______。
#include<stdio.h>
main()
{int i,j,m=1;
for(i=1;i<3;i++)
{for(j=3;j>0;j--)
{if(i*j>3)break;
m*=i*j;
}
}
printf("m=%d\n",m);
}
程序运行后的输出结果是______。
A.m=4
B.m=2
C.m=6
D.m=5
热门相关试卷
最新相关试卷