己知字符串 s='(X+Y)*Z' ,其中,单引号不是字符串的内容, 经过以下运

最全题库2022-08-02  35

问题 己知字符串 s='(X+Y)*Z' ,其中,单引号不是字符串的内容, 经过以下运算后,t3 的值是(     )。t1=SubString(s ,3,1)t2=Concat('XY'  ,t1)t3=Replace(s,SubString(s,1,5),t2)注: SubString(s,k,n)表示从串 s的第 k 个字符开始取出长度为 n 的子串, Concat(s,t)表示将串 t 连接在 s 之后, Replace(s,t,r)表示用 r 替换串 s 中的子串 t。A.;XY Z*’B.'(X Z)*Y'C.'XYZ *’D.'XY+*Z’

选项 A.;XY Z*’
B.'(X Z)*Y'
C.'XYZ *’
D.'XY+*Z’

答案 D

解析 本题考查数据结构基础知识。
t1=SubString(s ,3,1)=SubString('(X+Y)*Z',3,1)= '+'
t2=Concat('XY', t1 )=Concat('XY' ,'+' )='XY+'
t3=Replace(s,SubString(s,1,5),t2)=Replace('(X+Y)*Z','(X+Y)','XY+')='XY+*Z'
转载请注明原文地址:https://tihaiku.com/congyezige/2427124.html

最新回复(0)