有以下程序 void swap(Char *x,Char *y) {Char t; t=*x;*x=*y;*y=t; } main( ) {Char *s1=”abc”,*s2=”123”; swap(sl,s2); printf(”%s,%s/n”,s1,s2); } 程序执行后的输出结果是()
第1题:
以下程序的输出结果是______
# include
main()
{char *s1,*s2,m;
s1=s2=(char*)malloc(sizeof(char));
*s1=15;
*s2=20;
m=*s1+*s2;
printf(“%d\n”,m);
}
35
第2题:
设已包含头文件<string.h>,下列程序段的运行结果是( )。 char s1[]={"ACDEF"}; char s2[]="ABC"; strcpy(s1,s2); printf("%d",strlen(s1));
A.3
B.4
C.6
D.5
第3题:
以下程序的输出结果是 【 18 】 。
# include <stdlib.h>
main( )
{ char *s1,*s2,m;
s1=s2=(char*)malloc(sizeof(char));
*s1=15; *s2=20; m=*s1+*s2;
printf("%d\n",m);
}
第4题:
下列程序的运行结果是( )。
#include<stdio.h>
#include<string.h>
main()
{ char*s1="abDuj";
char*s2="ABdUG";
int t;
t=strcmp(s1,s2) ;
printf("%d",t);
}
A.正数
B.负数
C.零
D.不确定的值
第5题:
下列程序的运行结果是( )。#include<stdio.h>#include<string.h>main(){ char*s1="ahDuj"; char*s2="ABdUG": int t; t=strcmp(s1,s2); printf("%d", t);}
A.正数
B.负数
C.零
D.不确定的值
第6题:
下面程序的输出结果是( )。#include "string.h"fun(char*w,int n){ char t,*s1,*s2;s1=w; s2=w+n-1;while(s1<s2){ t=*s1++;*s1=*s2--;*s2=t;}}main(){ static char p[]="1234567";fun(p,strlen(p));printf("%s",p);}A.7654321 B.1717171 C.7171717 D.1711717
第7题:
下面的程序执行后,屏幕上显示的应是 public class Exam{ public static void main(String[]args){ char char1[]={'t','e','s','t'}; char char2[]={'t','e','S','t','1'}; String s1=new String(char1); String s2=new String(char2,0,4); System.out.println(s1.equals(s2)); } }
A.true
B.false
C.test
D.编译错误
第8题:
有以下程序
void swap(char *x,char *y)
{ char t;
t=*x; *x=*y; *y=t;
}
main()
{ char *s1="abc",*s2="123";
swap(s1,s2);printf(" % s, % s\n",s1,s2);
}
程序执行后的输出结果是
A)123,abc
B)abc,123
C)1bc,a23
D)321,cba
第9题:
有以下程序 并include<stdio.h> #include<string.h> fun(char * w,int n) { char t,*s1,*s2; s1=w; s2=w+n-1; while(s1<s2) { t=*s1++; * s1=*s2--; * s2=t; } } main() { char p[]="1234567"; fun(p,strlen(p)); puts(p); } 程序运行后的输出结果是( )
A.1234567
B.7654321
C.1711717
D.7177171
第10题:
以下程序的输出结果是______。 #include<stdio.h> #include<string.h> fun(char*w,int n) { char t,*s1,*s2; s1=w;s2=w+n-1; while(s1<s2) { t=*s1++; *s1=*s2-; *s2=t; } } main() { char*p; p="1234567"; fun(p,strlen(p)); puts(p); }
A.1234567
B.7654321
C.1711717
D.7177171