下列程序执行的结果为( )。 A = "HELLOCANIHELPYOU" B = "WANGCHANGLI" C = Left(A,5) +"!" D = Right(A, 7) E = Mid(A, 6,

admin2009-01-19  31

问题 下列程序执行的结果为(    )。     A = "HELLOCANIHELPYOU"     B = "WANGCHANGLI"     C = Left(A,5) +"!"     D = Right(A, 7)     E = Mid(A, 6, 4)     F = Mid(B, Len(B)  -6) + "!"     G = E+ " " + D + " ! "     H = C +" " + F     Print H + " " + G   

选项 A、HELLO! CHANGLI! CANIHELPYOU!
B、HELLO! WANG! CANIHELPYOU
C、HELLO! CANIHELPYOUI
D、HELLO! CHANG! CANIHELPYOU!

答案1

解析 本题D=Right(A,7)="HELPYOU", Mid(Str,Start,[Length])返回字符串Str从位置Start开始长度为Length的字符串。如果Start大于Str的长度,则返回空值。参数Length可忽略,此时返回自Start位置以后的所有字符。如果Length大于自Start位置以后的所有字符数,则等同于该参数忽略,本题中:
   E=Mid(A, 6, 4)= "CANI";
   F = Mid(B, Len(B) - 6) + "!"  = "CHANGLI!";
   G = E + " " + D +" !" = "CANIHELPYOU!";
   H = C+ " " + F = "HELLO! CHANGLI!";
   H + " " + G = "HELLO! CHANGLI! CANIHELPYOU!"
转载请注明原文地址:https://kaotiyun.com/show/NJ5p777K
0

最新回复(0)