已知String 对象s="abcdefg",则s.substring(2, 5)的返回值为?() A."bcde"B. "cde"C."cdef"D."def"
已知String 对象s="abcdefg",则s.substring(2, 5)的返回值为?()
A."bcde"
B. "cde"
C."cdef"
D."def"
相关考题:
请编写一个函数int compare(char *s,char *t)), 该函数的功能是对两个字符串进行比较。当s所指字符串和t所指字符串相等时,返回值为0;当s所指字符串大于是t指字符串时,返回值大于0;当s所指字符串小于t所指字符串时,返回值小于0。注意:部分源程序已存在文件PROC8.cpp中。文件PROC8.cpp的内容如下://PROC8.cppinclude <iostream>include <string>using namespace std;int compare(char *s,char *t){//* * * * * * * * *}int main (){char str1[100],str2[100];int result;cout<<"Input the first string\n";cin>>str1;cout<<"Input the second string\n";cin>>str2;result=compare(str1,str2);if (result==0)cout<<"string1=string2 ! \n";else if (result>0)cout<<"string1>string2 ! \n";elsecout<<"string1<string2 ! \n";return 0;}
若输入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
已知String str=new String ("Luck");,则下列关于str的操作中不合法的是( )。A.String s=str. toUpperCase()B.int i=Str. length;C.char s=str. charAt(2);D.String s="Good" +str;
假定有以下函数过程: 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
publicclassTestString3{publicstaticvoidmain(String[]args){//insertcodehereSystem.out.println(s);}}Whichtwocodefragments,insertedindependentlyatline3,generatetheoutput4247?() A.Strings=“123456789”;s=(s-”123”).replace(1,3,”24”)-“89”;B.StringBuffers=newStringBuffer(”123456789”);s.delete(0,3).replace(1,3,“24”).delete(4,6);C.StringBuffers=newStringBuffer(”123456789”);s.substring(3,6).delete(1,3).insert(1,“24”);D.StringBuilders=newStringBuilder(”123456789”);s.substring(3,6).delete(1,2).insert(1,“24”);E.StringBuilders=newStringBuilder(”123456789”);s.delete(0,3).delete(1,3).delete(2,5).insert(1,“24”);
publicStringmakinStrings(){Strings=Fred”;s=s+47”;s=s.substring(2,5);s=s.toUpperCase();returns.toString();}HowmanyStringobjectswillbecreatedwhenthismethodisinvoked?() A.1B.2C.3D.4E.5F.6
设字符串s1='ABCDEFG',s2='PQRST',则运算s=CONCAT(SUB(s1,2,LEN(s2)),SUB(s1,LEN(s2,2))后的串值为(65)。A.'ABCDEFEF'B.'BCDEFG'C.'BCPQRST'D.'BCQR'
假定有以下函数过程: 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
假定有以下函数过程: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
有如下程序段: 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
有如下程序段: 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
执行下列两条语句后,结果s2的值为() string s=“abcdefgh”; string s2=s.Substring(2,3);A、 “bc”B、 “cd”C、 “bcd”D、 “cde”
public class TestString3 { public static void main(String[] args) { // insert code here System.out.println(s); } } Which two code fragments, inserted independently at line 3, generate the output 4247?()A、 String s = “123456789”; s = (s-”123”).replace(1,3,”24”) - “89”;B、 StringBuffer s = new StringBuffer(”123456789”); s.delete(0,3).replace( 1,3, “24”).delete(4,6);C、 StringBuffer s = new StringBuffer(”123456789”); s.substring(3,6).delete( 1 ,3).insert(1, “24”);D、 StringBuilder s = new StringBuilder(”123456789”); s.substring(3,6).delete( 1 ,2).insert( 1, “24”);E、 StringBuilder s = new StringBuilder(”123456789”); s.delete(0,3).delete( 1 ,3).delete(2,5).insert( 1, “24”);
public String makinStrings() { String s = “Fred”; s = s + “47”; s = s.substring(2, 5); s = s.toUpperCase(); return s.toString(); } How many String objects will be created when this method is invoked?() A、 1B、 2C、 3D、 4E、 5F、 6
设String对象s="H",运行语句System.out.println(s.concat("ello!"));后String对象s的内容为"Hello!",所以语句输出为"Hello!"。
String date="Today is Sunday.";String str2=data.CharAt(s.length( )-1);则str2为()A、yB、.C、nullD、false
单选题public String makinStrings() { String s = “Fred”; s = s + “47”; s = s.substring(2, 5); s = s.toUpperCase(); return s.toString(); } How many String objects will be created when this method is invoked?()A 1B 2C 3D 4E 5F 6
多选题public class TestString3 { public static void main(String[] args) { // insert code here System.out.println(s); } } Which two code fragments, inserted independently at line 3, generate the output 4247?()AString s = “123456789”; s = (s-”123”).replace(1,3,”24”) - “89”;BStringBuffer s = new StringBuffer(”123456789”); s.delete(0,3).replace( 1,3, “24”).delete(4,6);CStringBuffer s = new StringBuffer(”123456789”); s.substring(3,6).delete( 1 ,3).insert(1, “24”);DStringBuilder s = new StringBuilder(”123456789”); s.substring(3,6).delete( 1 ,2).insert( 1, “24”);EStringBuilder s = new StringBuilder(”123456789”); s.delete(0,3).delete( 1 ,3).delete(2,5).insert( 1, “24”);
判断题设String对象s="H",运行语句System.out.println(s.concat("ello!"));后String对象s的内容为"Hello!",所以语句输出为"Hello!"。A对B错
单选题执行下列两条语句后,结果s2的值为() string s=“abcdefgh”; string s2=s.Substring(2,3);A “bc”B “cd”C “bcd”D “cde”