网友您好, 请在下方输入框内输入要搜索的题目:

朝鲜韩国的政治与对外关系网课答案.docx

有以下程序:includeincludeincludevoid f(char*s,char*t){char k;k=*s; *

有以下程序: #include<stdio.h> #include<string.h> #include void f(char*s,char*t) { char k; k=*s; *s=*t; *t=k; s++;t--; if(*s)f(s,t): } main() {char str[10]="abcdefg",*P; P=str+strlen(str)/2+1: f(p,p-2); printf("%s\n",str); } 程序运行后的输出结果是( )。

A.abcdefg

B.gfedcba

C.gbcdefa

D.abedcfg


正确答案:B


对下述程序的判断中,正确的是()。includevoid main(){char *P,s[256];p=s;while(strcmp

对下述程序的判断中,正确的是( )。 #include<stdio.h> void main() {char *P,s[256]; p=s; while(strcmp(s,"the end")) {printf("Input the string:"); gets(s); while(*P) putchar(*p++);}}

A.此程序循环接收字符串并输出,直到接收到字符串“the end”为止

B.此程序循环接收字符串,接收到字符串“the end”则输出,否则程序终止

C.此程序循环接收字符串并输出,直到接收字符串“the end”为止,但因为代码有错误,程序不能正常工作

D.此程序循环接收字符串并将其连接在一起,直到接收字符串“the end”为止,输出连接在一起的字符串


正确答案:A
解析:strcmp(str1,str2)是比较字符串str1和sir2,当两字符串相等时,返回值为0,不相等时返回值为非0;所以此段程序的功能是在未接收到字符串“the end”时,读入字符并输出。


下列程序的输出结果是______。 includef(char 8s){char *p=s;while(*p!='\0')p++;retur

下列程序的输出结果是______。# include<stdio.h>f(char 8s){ char *p=s; while(*p!='\0')p++; return(p-s);}main(){ printf("%d\n",f("ABCDEF"));}

A.3

B.6

C.8

D.0


正确答案:B


以下程序的输出结果是()。includecharcchar(chareh){if(ch>='A,&&ch<='Z')ch=c

以下程序的输出结果是( )。 #include <stdio.h> charcchar(char eh) { if(ch>='A,&&ch<='Z') ch=ch-'A'+'a'; return ch; } main() { char s[]="ABC+abc=defDEF",*p=s; while(*p) { *p=cchsr(*p); p++; } printf("%s\n",s); }

A.abc+ABC=DEFdef

B.abc+abc=defdef

C.abcABCDEFdef

D.abcabcdefdef


正确答案:B
解析:本题中cchar函数的作用是:如果参数ch是大写字母,则将它转换成小写字母,而对大写字母以外的字符不起作用。


有以下程序并includeincludefun(char * w,int n){char t,*s1,*s2; s1=w;s2=

有以下程序 并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


正确答案:C


摘要:朝鲜韩国的政治与对外关系网课答案问:对下述程序的判断中,正确的是().#include"stdio.h"voidmain(){char*p,s[128];p=s;while(strcmp(s,"End"))串:");gets(s);while(*p){printf("请输入一个字符putchar(*p++);}}答:此程序循环接收字符串并输出,直到接收字符串"End"为止问:若有定义和语句int*point,a=4;point=&a;下面均代表地址的一组选项是().答:&a,&*point,point问:现有如下定义:inta,b,*p,*q;,则下列赋值语句错误的是().答:p=a;问:有以下程序voidfun(char*t,char*s){while(*t!=0)t++;while((*t++=*s++)!=0);}main(){charss[10]="acc",aa[10]="bbxxyy";fun(ss,aa);printf("%s,%s\n",ss,aa);}程序的运行结果是().答:accbbxxyy,bbxxyy 问:有以下函数intaaa(char*s){char*t=s;while(*t++);t--;return(t-s);}以下关于aaa函数的功能的叙述正确的是().答:求字符串s的长度问:有以下语句,则对a数组元素的引用不正确的是()(0≤i≤9)inta[10]={0,1,2,3,4,5,6,7,8,9},*p=a;答:*(*(a+i))问:有以下函数intfun(char*s){char*t=s;while(*t)t++;re


下面程序的运行结果是includemain(){int a=28,b;char s[10],*p;p=s;do{b=a%16;if(b<10

下面程序的运行结果是 #include<stdio.h> main() {int a=28,b; char s[10],*p; p=s; do{b=a%16; if(b<10) *p=b+48; else*p=b+55; p++;a=a/5;}while(a>0); *p='\0';puts(s);}

A.10

B.C2

C.C51

D.\0


正确答案:C


有以下程序: include void funl (char * p){char * q; q=p; while( *q! ='\0') } (*q)

有以下程序: #include <stdio.h>void funl (char * p){ char * q; q=p; while( *q! ='\0') } (*q) ++;q++;}mains( ){ char a[ ] = { "Program" } , * p; p = &a[3]; fun1 (p); printf("% s \n" ,a);}程序执行后的输出结果是( )。

A.Prohsbn

B.Prphsbn

C.Progsbn

D.Program


正确答案:A
解析:在main函数中,p=&a[3]说明指针p指向a数组的第4个字符(即字符'g');fun1中的q=p意味着指针q也指向了a数组的第4个字符。执行while语句,表达式(*q)++使'g'+1,使'g'变成了'h';表达式q++使q指向a[4]的起始地址。继续执行while语句,直到遇到'\0'结束循环,返回形参。最终得到的结果是从字符串"Program'的第4个字符开始,每个字符加1。


有以下程序 include void fun(char **p) { ++p; printf("%s\n",*p);

有以下程序 #include <stdio.h> void fun(char **p) { ++p; printf("%s\n",*p); } main() { char *a[]={"Moming","Afternoon","Evening","Night"}; fun(a); } 程序的运行结果是

A.Afternoon

B.fternoon

C.Morning

D.orning


正确答案:A
解析:本题主函数中定义了一个指针数组a,可以将它看成一个以字符指针为元素的一维数组。和—般的一维数组名能赋给同类型指针变量一样,该字符指针数组也可以赋给指向字符指针的指针(即字符型二级指针),所以数组名a可以用作函数fun()的实参。


以下程序的输出结果是______。includeincludefun(char*w,int n){ char t,*s

以下程序的输出结果是______。 #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


正确答案:C
解析:在子函数fun中,s1为字符串w的起始地址,s2为字符串的结束地址(字符'\0'除外),当执行循环结束循环, w="1711717"。


有以下程序: include main( ) {char s[ ] ="159" , * p;p=s;printf( "% c", * p + +

有以下程序: #include <stdio.h> main( ) { char s[ ] ="159" , * p; p=s; printf( "% c", * p + + ); printf("%~", * p++);}程序运行后的输出结果是( )。

A.15

B.16

C.12

D.59


正确答案:A
解析:语句p=s将指针变量p指向字符数组s,第一次输出时,由于++和*为同一优先级,而结合方向为自右向左,所以,*p++相于*(p++)。但又因为“++”在p的右侧,所以,先输出*p,得到s[0]的值,然后P++,P指向s[1],故第二次输出时,输出s[1]的值,所以输出结果为15。


更多 “朝鲜韩国的政治与对外关系网课答案.docx” 相关考题
考题 请读程序: includde include void fun(char * s) {char a[10]; str 请读程序: # includde<stdio.h> # include<string.> void fun(char * s) {char a[10]; strcpy(a,"STRING"); s=a; } main() { char*p; fun(p); print{("%s\n",p); } 上面程序的输出结果(表示空格) ( )A.STRINGB.STRINGC.STRINGD.不确定的值 正确答案:D

考题 以下程序运行后的输出结果是【】。 include void main(){char s[]=“123456”,*p;for(p=s 以下程序运行后的输出结果是【 】。include<iostream.h>void main(){char s[]=“123456”,*p;for(p=s; p<s+2; p++)cout<<p<<end1;} 正确答案:123456 23456123456 23456

考题 对下述程序的判断中,正确的是#includestdio.hvoid main(){ char*p,s[128];p=s;while(strcmp(s,"End")){ printf("Input a string:");gets(s);while(*p)putchar(*p++); } }A.此程序循环接收字符串并输出,直到接收字符串"End"为止B.此程序循环接收字符串,接收到字符串"End"则输出,否则程序终止C.此程序循环接收字符串并输出,直到接收字符串"End"为止,但因为代码有错误,程序不能正常工作D.此程序循环接收字符串并将其连接在一起,直到接收字符串"End"为止,输出连接在一起的字符串 正确答案:B解析:此题考查了字符串输入函数gets和字符串比较函数strcmp,另外还有字符输出函数putchar。gets从标准输入设备中读入全部字符,包括空格,直到遇到回车符为止。strcmp是字符串比较函数,即strcmp(字符串1,字符串2),如果字符串1=字符串2,则函数值为0;如果字符串1字符串2,则函数值为一正整数;如果字符串1字符串2,则函数值为一负整数。putchar(c)函数将字符c输出到标准输出设备上。

考题 下面程序的运行结果是includemain(){ int a=28,b; char s[10],*p; p=s; do{b=a%16; if( 下面程序的运行结果是 include<stdio.h> main() { int a=28,b; char s[10],*p; p=s; do{b=a%16; if(b<10) *p=b+48; else*p=b+55; p++; a=a/5; }while(a>0); *p='\0'; puts(s);}A.10B.C2C.C51D.\0 正确答案:C解析:语句“p=s;”是使指针p指向字符数组s。*p则引用了p所指位置的数组元素。注意:通过指针来引用一维数组元素。

考题 对下述程序的判断中,正确的是includevoid main(){char*p,s[128];p=S;while(strcmp(s," 对下述程序的判断中,正确的是 #include<stdio.h> void main() { char*p,s[128]; p=S; while(strcmp(s,"End")) { printf("Input a string:");gets(s); while(*p) putchar(*p++);}}A.此程序循环接收字符串并输出,直到接收字符串"End"为止B.此程序循环接收字符串,接收到字符串"End"则输出,否则程序终止C.此程序循环接收字符串并输出,直到接收字符串"End"为止,但因为代码有错误,程序不能正常工作D.此程序循环接收字符串并将其连接在一起,直到接收字符串"End"为止,输出连接在一起的字符串 正确答案:B解析: 此题考查了字符串输入函数gets和字符串比较函数strcmp,另外还有字符输出函数putchar。gets从标准输入设备中读入全部字符,包括空格,直到遇到回车符为止。strcmp是字符串比较函数,即strcmp(字符串1,字符串2),如果字符串1=字符串2,则函数值为0;如果宇符串1,字符串2,则函数值为一正整数;如果字符串1字符串2,则函数值为一负整数。putchar(c)函数将字符c输出到标准输出设备上。

考题 下列程序的运行结果是()。      #include   #include   FUN(char *w,int n)  {   char temp,*s1,*s2; s1=w;  s2=w+n-1;  while(s1temp=*s1++;  *s1=*s2--;  *s2=temp;  }  }      main( )  {   char *p;  p=“1234567”;  FUN(p,strlen(p));  puts(p);  }正确答案:1711717

考题 请读程序: includef(char * s){cahr * p=s;while(* p!='\0')p++;return(p-s);}main(){ 请读程序: # include<stdio.h> f(char * s) {cahr * p=s; while(* p!='\0')p++; return(p-s); } main() {printf("%d\n”,f("ABCDEF"));} 上面程序的输出结果是 ( )A.3B.6C.8D.0 正确答案:B

考题 以下程序运行后,输出结果是()includess(char*s){char*p=s; while(*p)p++ return(p-s); 以下程序运行后,输出结果是( ) #include<stdio.h> ss(char *s) { char*p=s; while(*p) p++ return(p-s); } main() { char *a="abded" int i; i=ss(a) ; printf("%d\n",i); }A.8B.7C.6D.5 正确答案:D

考题 以下程序的输出结果是_______。includeincludefun(char*w,int n){char t,*s 以下程序的输出结果是_______。 #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++: *sl=*s2-; *s2=t; } } main() { char*p; p="1234567"; fun(p,strlen(p)); puts(p); }A.1234567B.7654321C.1711717D.7177171 正确答案:C解析:在于函数fun中,s1为字符串w的起始地址,s2为字符串的结束地址(字符'\0'除外),当执行循环结束循环,w="1711717"。

考题 请读程序:includeincludemain(){char*s1="AbCdEf',*s2="aB"; s1++;s2++; p 请读程序: #include<stdio.h> #include<string.h> main() { char*s1="AbCdEf',*s2="aB"; s1++;s2++; printf("%d\n",strcmp(s1,s2)); } 上面程序的输出结果是_______。A.正数B.负数C.零D.不确定的值 正确答案:A解析:函数strcmp的功能是比较字符串s1和s2,如果s1>s2,则返回个正数;如果s1s2,则返回负数,否则返回零。由于本题中小写字母b的ASCII码值大于大写字母D,故s1>s2,所以函数的值为正数。