有如下程序段: Dim str As String * 10 Dim i str1 = "abcdefg" i = 12 len1 = Len(i) sir2 = Right(str1, 4)执行后,len1和str2的返回值分别是( )。A.12,abcdB.10,bcdeC.2,defgD.0,cdef
有如下程序段: Dim str As String * 10 Dim i str1 = "abcdefg" i = 12 len1 = Len(i) sir2 = Right(str1, 4)执行后,len1和str2的返回值分别是( )。
A.12,abcd
B.10,bcde
C.2,defg
D.0,cdef
相关考题:
( 12 ) 有以下程序#include stdio.h#include string.hvoid fun ( char *str ){ char temp;int n,i;n=strlen ( str ) ;temp=str[n-1];for ( i=n-1;i0;i-- ) str[i]=str[i-1];str[0]=temp;}main (){ char s[50];scanf ( " %s " ,s ) ; fun ( s ) ; printf ( " %s\n " ,s ) ;}程序运行后输入: abcdef 回车 ,则输出结果是 【 12 】 。
执行下列的程序,消息框里显示的结果是______。Pfivate Sub Form_Click()Dim Str As StringStr=""S="Access"For i=Len(S) To 1 Step-1Str=StrMid(S.i,1)Next IMsgBox StrEnd Sub
若输入bcdefgh、m、abcdefg,以下程序的输出结果为()。includeincludemain(){i 若输入bcdefgh、m、abcdefg,以下程序的输出结果为( )。 #include<stdio.h> #include<string.h> main() { int i; char string[20],str[3][20]; for(i=0;i<3;i++)gets(str[i]); if(strcmp(str[0],str[1])>0) strcpy(string,str[0]); else strcpy(string,str[1]); if(strcmp(str[2],string)>0) strcpy(string,str[2]); printf("%s",string); }A.bcdefghB.mC.abcdefgD.bcdefgh或abcdefg
( 34 )有如下程序:#includeusing namespace std;int main (){char str[100],*p;cout ” please input a string: ” ;cinstr;p=str;for ( int i =0;*p!= ” \0 ” ;p++, i ++ ) ;cout i ENDL;retum 0;}运行这个程序时,若输入字符串为abcdefg abcd则输出结果是A ) 7B ) 12C ) 13D ) 100
下列程序的执行结果为Private Sub Command1_Click()Dim s1 As String, s2 As Strings1= "abcd"Call Transfer(s1, s2)Print s2End SubPrivate Sub Transfer (ByVal xstr As String, ystr As String)Dim tempstr As Stringi=Len(xstr)Do While i =1tempstr=tempstr + Mid(xstr, i, 1)i=i - 1Loopystr=te mpstrEnd Sub( )。A.dcbaB.abdcC.abcdD.dabc
单击窗体时,下列程序的执行结果是Private Sub Invert(ByVal xstr As String, ystr As String)Dim tempstr As StringDim I As IntegerI=Len(xstr)Do While I =1tempstr=tempstr + Mid(xstr, I, 1)I=I - 1Loopystr=tempstrEnd SubPrivate Sub Form_Click()Dim s1 As String, s2 As Strings1= "abcdef"Invert s1, s2Print s2End Sub( )。A.abcdefB.afbecdC.fedcbaD.defabc
(33)假定有以下函数过程:Function Fun(S As String)As StringDim s1 As StringFor i=1 To Len(S)s1=LCase(Mid(S, i, 1))+s1Next iFun=s1End Function在窗体上画一个命令按钮,然后编写如下事件过程:Private Sub Command1_Click( )Dim Str1 As String, Str2 As StringStr1=InputBox("请输入一个字符串")Str2=Fun(Str1)Print Srt2End Sub程序运行后,单击命令按钮,如果在输入对话框中输入字符串“abcdefg”,则单击“确定”按钮后在窗体上的输出结果为( )。A)ABCDEFGB)abcdefgC)GFEDCBAD)gfedcba
设有如下程序:Private Sub Form_Click()Dim i As Integer,x As String,Y As Stringx=”ABCDEFG”For i=4 To 1 Step-1y=Mid(x,i,i)+yNext iPrint yEnd Sub程序运行后,单击窗体,输出结果为A.ABCCDEDEFGB.AABBCDEFGC.ABCDEFGD.AABBCCDDEEFFGG
假定有以下函数过程: Function Fun(S As String) As String Dim sl As String For i=1 To Len(S) s1=UCase (Mid(S,i,1))+s1 Next i Fun=s1 End Function则Str2=Fun("abcdefg”)的输出结果为( )。A.abcdefgB.ABCDEFGC.gfedcbaD.GFEDCBA
阅读以下程序说明和C程序,将应填入(n)处的子句,写在对应栏内。【程序说明】函数int commstr(char * str1,char * str2,int * sublen)从两已知字符串str1和str2中,找出它们的所有最长的公共子串。如果最长公共子串不止1个,函数将把它们全部找出并输出。约定空串不作为公共子串。函数将最长公共子串的长度送入由参数sublen所指的变量中,并返回字符串str1和str2的最长公共子串的个数。如果字符串str1和str2没有公共子串,约定最长公共子串的个数和最长公共子串的长度均为0。【程序】int strlen(char * s){char *t=s;while( * ++);return t-s-1;}int commstr(char) *str1,char *str2,int *sublen{ char*s1, *s2;int count=0,len1 ,len2,k,j,i,p;len1:=strlen(str1)len2 = strlen(str2);if(len1>len2){s1=str1 ;s2=str2;}else {len2 = len1;s1 = str2;s2 = str1;}for(j=len2;j>0;j--) /*从可能最长子串开始寻找*/{for(k=0;(1)<:len2;k++) /*k为子串s2的开始位置*/{for(i=0;s1[(2)]!='\0';i++;) /*i为子串s1的开始位置*/{ /*s1的子串与s2的子串比较*/for (p=0;p<j)(3);p++);if ((4)) /*如果两子串相同*/{for(p=0);p<j;p++} /*输出子串*/printf ("%c",s2[k+p]);printf ("\n");count++;/*计数增1 */}}}if (count>0) break;*sublen=(count>0)?(5):0;return count;}
设有如下程序: Private Sub Form. Click( ) Dim i As Integer,x As String,y As String x="ABCDEFG" For i=4 To 1Step-1 y=Mid(X,i,i)+y Next i Print y End Sub 程序运行后,单击窗体,输出结果为( )。A.ABCCDEDEFGB.AABBCDEFGC.ABCDEFGD.AABBCCDDEEFFGG
运行下面程序,其输出结果(str2的值)为【 】。Dim str1,str2 As StringDim i As Integerstrl="abcdef"For i=1 To Len(str1) Step2str2=UCase(Mid(str1,i,1))+str2NextMsgBox str2
假定有以下函数过程: Function Fun(S As String) As String Dim s1 As String For i=1 To Len(S) s1 = UCase(Mid(S, i, 1)) +s1 Next i Fun =s1 End Function 在窗体上画一个命令按钮,然后编写如下事件过程: Private Sub Command1_Click() Dim Str1 As String, Str2 As String Strl = InputBox(“请输入一个字符串”) Str2=Fun(Str1) Print Str2 End Sub 程序运行后,单击命令按钮,如果在输入对话框中输入字符串“abcdefg”,则单击“确定” 按钮后在窗体上的输出结果为,A.abcdefgB.ABCDEFGC.gfedcbaD.GFEDCBA
以下程序段运行后消息框的输出结果为______。s="Access"Dim str As StringFor i=1 To Len(s)str=UCase(Mid(S,I,I))+strNext iMsgBox str
假定有以下函数过程:Function Fun(S As String)As StringDim Sl AS StringFor i=1 TO Len(S)sl=UCase(Mid(S,i,1))+slNext iFun=s1End Function则Str2= Fun("abcdefg")的输出结果为( )。A. abcdefg B.ABCDEFGC.gfedcba D.GFEDCBA
编写如下事件过程: Private sub sub1 (ByVal x1 As String, y1 As String) Dim xt As String Dim i As Integer i = Len(x1) Do While i>= 1 xt = xt + Mid(x1, i, 1) i=i-1 Loop y1 = xt End Sub Private Sub Form. Click() Dim s1 As String, s2 As String s1= "teacher" sub1 s1, s2 Print s2 End Sub 程序运行后,单击窗体,则窗体上显示的内容是A.rehcaetB.tahreeeC.themeeD.eerthea
执行下面的程序,消息框里显示的结果是( )。Private Sub Form_Click()Dim Str As String,S As String,k As IntegerS=StrFor k=Len(Str) To 1 Step -1S=S (Mid(Str,k,1)Next kEnd Sub
执行下面的程序,单击窗体后在窗体上显示的结果是 ______。Private Sub form_ Click() Dim Str1 As String, Str2 As String Dim Str3 As String, I As Integer Str1 = "e" for I = t To 2 Str2 = Ucase (Str1) Str1 = Str2 Str1 Str3 = Str3 Str1 str1 = Chr (Asc(Str1) + I) Next I Print Str3End SubA.EeFFB.eEfFC.EEFFD.eeFF
下列程序段运行后消息框的输出结果为______。s="Access"Dim Str As StringFor i=1 To Len(s)str=UCase(Mid(S,i,1) ) +strNext IMsgBox str
单击窗体时,下列程序的执行结果是 Private Sub Invert(By Val xstr As String,ystr As String) Dim tempstr AS String Dim I AS Integer I=Len(xstr) Do While I>=1 tempstr=tempstr + Mid(xstr,I,1) I=I - 1 Loop ystr=tempStr End Sub Private Sub Form_Click( ) Dim s1 As String,s2 As String S1="abcdef" Invert S1,S2 Print S2 End SubA.abcdefB.afbecdC.fedcbaD.defabc
函数过程如下: FUNCTION FUN( N AS STRING)AS STRING DIM N1 AS STRING FOR I=1 TO LEN(N) N1 =UCASE(MID(N,I, 1)) + N1 NEXT I FUN: N1 END FUNCTION 则S=FUN("uvwxyz")的输出结果为( )。A.uvwxyzB.zyxwvuC.UVWXYZD.ZYXWVU
有如下程序段: Dim str As String*10 Dim i Strl="abcdefg" i=12 lenl=Len(i) str2=Right(str1,4) 执行后,len1和str2的返回值分别是______。A.12,abcdB.10,bcdeC.2,defgD.0,cdef
下列程序的执行结果为 Private Sub Command1_C1ick( ) Dim sl As String,s2 AS String s1="abcdef" Call lnvert(s1,s2) Print s2 End Sub Private Sub lnvert(ByVal xstr As String,ystr As String) Dim tempstr As Stdng i=Len(xstr) Do While i>=1 tempstr=tempstr+Mid(xstr,i,1) i=i-1 Loop ystr=tempstr End SubA.fedcbaB.abcdefC.afbecdD.defabc
下列程序的执行结果为 Ptivate Sub Commandl_Click() Dim FirStr As String FirStr="abcdef" Print Pct (FirStr) End Sub Private Function Pct(xStr As String)As String Dim tempStr As String,strLen As Integer tempStr="" strLen=Len(xStr) i=1 Do While i<=Len(xStr)-3 tempStr=tempStr + Mid(xStr,i,l) + Mid(xStr,strLen - i+i ,1) i=i + 1 Loop Pct=tempStr End FunCtionA.abcdefB.afbecdC.fedcbaD.defabc
假定有以下函数过程: Function Fun(S As String) As String Dim s1 As String For i=1 To Len(S) s1=UCase(Mid(S,i,1))+s1 Next i Fun=S1 End Function 在窗体上画一个命令按钮,然后编写如下事件过程: Private Sub Command1_Click( ) Dim Str1 As String,Str2 As String Str1=Input Box(“请输入一个字符串”) Str2=Fun(Str1) Print Str2 End Sub 程序运行后,单击命令按钮,如果在输入对话框中输入字符串“abcdefg”,则单击“确定”按钮后在窗体上的输出结果为A.abedergB.ABCDEFGC.gfedcbaD.GFEDCBA
下列程序的执行结果为 Private Sub Command1_Click() Dim s1 As String,s2 As String S1;="abcdef" Call Invert(s1,s2) Print s2 End Sub Private Sub Invert (ByVal xstr As String,ystr As String) Dim tempstr As String i=Len(xstr) Do While i=1 tempstr=tempstr+Mid(xstr,i,1) i=i-1 Loop ystr=tempstr End SubA.fedcbaB.abcdefC.afbecdD.defabc
有如下程序段: Dim str As String*10 Dim i Str1="abcdefg" i=12 len1=Len(i) str2=Right(str1,4) 执行后,len1和str2的返回值分别是______。A.12,abcdB.10,bcdeC.2,defgD.0,cdef