网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
单选题
现有代码片段: String s="123"; String sl=S+456; 请问sl的结果是哪项?()
A
123456
B
579
C
编译错误
D
运行时抛出异常
参考答案
参考解析
解析:
暂无解析
更多 “单选题现有代码片段: String s="123"; String sl=S+456; 请问sl的结果是哪项?()A 123456B 579C 编译错误D 运行时抛出异常” 相关考题
考题
下面是一个类的定义,试将程序补充完整。class A{String s;____int a=66;A(String sl){s=sl;}static int geta(){return a;}}
考题
假定有以下函数过程: 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
考题
下列给定程序中函数fun()的功能是;先将在字符串s中的字符按逆序存放到t串中,然后把s中的字符按正序连接到t串的后面。例如:当s中的字符串为ABCDE时,则t中的字符串应为EDCBAABCDE。请改正程序中的错误,使它能得出正确的结果。注意:不要改动main函数,不得增行或删行,也不得更改程序的结构。试题程序:include <conio.h>include <stdio.h>include <string.h>void fun (char *s, char *t ){int i,sl;sl=strlen(s);for (i=0;i<sl;i++)t[i]=s[sl-1];for (i=0; i<sl; i++)/*************found**************t [sl+i]=s [i];t [2*sl]-'\0';}main ( ){ char s[100], t[100];clrscr();printf("\nPlease enter string s: ");scanf ("%s", s);fun (s,t);printf ("The result is: %s\n",t);}
考题
importjava.util.*;publicclassNameList{privateListnames=newArrayList();publicsynchronizedvoidadd(Stringname){names.add(name);}publicsynchronizedvoidprintAll(){for(inti=0;iSystem.out.print(names.get(i)+);}}publicstaticvoidmain(String[]args){finalNameListsl=newNameList();for(inti=0;i2;i++){newThread(){publicvoidruin(){sl.add(”A”);sl.add(”B”);sl.add(”C”);sl.printAll();}}.start();}}}Whichtwostatementsaretrueifthisclassiscompiledandrun?()
考题
下列程序的执行结果是 public class Testff{ public static void main(String args[]){ String sl=new String("I am boy"); String s2=new String("I am boy"); System.out.println(sl==s2); } }A.真B.假C.I am boyD.都不正确
考题
下列代码的执行结果是( )。 public class Test{ public static void main String args[]){ String s1=new String("welcome"); String s2=new String("welcome"); System.out.println(s1==s2); System.out.println(s1.equals(s2)); } }A.false,falseB.false,trueC.true,trueD.true,false
考题
假定有以下函数过程: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
考题
若已包括头文件string.h且已有定义char sl [18],s2={"ABCDE")和int i,现要将字符串”ABCDE”赋给sl,下列语句错误的是( )。A.strcpy(s1,s2)B.strcpy(s1,"ABCDE");C.sl="ABCDE";D.for(i=0;i6;i++)sl[i]=s2[i]
考题
下列代码段的执行结果是( )。 public class Test { public static void main(String args[ ]) { String s1= new String("hello"); String s2= new String("hello"); System.out.println(s1==s2); System.out.println(s1.equal(s2)); } }A.true falseB.true trueC.false trueD.false false
考题
下列代码的执行结果是______。 public class ex55 { public static void main(String args[] ) { String s1=new String("hello"); String s2=new String("hello"); System.out.print (s1==s2); System.out.print (","); System.out.println (s1.equals (s2)); } }A.true, falseB.true, trueC.false, trueD.false, false
考题
下列程序的执行结果为 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
考题
下面的程序执行后,屏幕上显示的应是 public class Exam{ public static void main(String[]args){ char char1[]='t','e','s','t'}; char char2[]={'t','e','s','t','1',}; String sl=new String(char1); String s2=new String(char2,0,4); System.out.println(S1.equals(s2)); } }A.真B.假C.testD.编译错误
考题
下面程序执行后,屏幕上显示的应是( )。 public class Test{ public static void main(String[ ] args) { char ch1[]={'B','e','i','j','i','n','g'}; char ch2[]={'B','e','i','j','i','n','g','2','0','0','8'}; String s1 = new String(ch1); String s2 = new String(ch2, 0, 7); System.out.println(sl.equals(s2)); } }A.trueB.falseC.BeijingD.编译错误
考题
下列程序的执行结果为 Private Sub Commandl_Click() Dim s1 As String ,s2 As String s1= "abcd" Call Transfer(sl,s2) Print s2 End Sub Private Sub Transfer (ByVal xstr As String,ystr As String) Dim tempstr As String ystr=tempstr End SubA.dcbaB.abdcC.abcdD.dabc
考题
下述代码A和B正确的值是() Dim X As String = "123" Dim Y As Integer = 123 Dim A As String = X + Y Dim B As String = X YA“246”,“123123”B246,“123123”C“123123”,“123123”D123123,“123123”
考题
下面的哪些程序片段可能导致错误()。 A、String s = “Gone with the wind”; String t = “ good”; String k = s + t;B、String s = “Gone with the wind”; String t; t = s[3] + “one”;C、String s = “Gone with the wind”; String standard = s.toUpperCase();D、String s = “home directory”; String t = s – “directory”;
考题
下述代码A和B正确的值是() Dim X As String = "123" Dim Y As Integer = 123 Dim A As String = X + Y Dim B As String = X YA、“246”,“123123”B、246,“123123”C、“123123”,“123123”D、123123,“123123”
考题
预测以下代码片段的输出结果:() var str ; alert(typeof str);A、. string ;B、. undefined;C、. object ;D、. String;
考题
现有: import java.util.*; class ScanStuff { public static void main (String [] args) { String S= "x,yy,123"; Scanner sc = new Scanner (s); while (sc.hasNext()) System.out.print (sc.next() +" "); } } 结果是什么?() A、 x yyB、 x,yy,123C、 x yy 123D、 x,yyE、编译失败F、运行的时候有异常抛出
考题
多选题下面的哪些程序片段可能导致错误()。AString s = “Gone with the wind”; String t = “ good”; String k = s + t;BString s = “Gone with the wind”; String t; t = s[3] + “one”;CString s = “Gone with the wind”; String standard = s.toUpperCase();DString s = “home directory”; String t = s – “directory”;
考题
单选题import java.util.*; class ScanStuff { public static void main(String [] args) { String s = "x,yy,123"; Scanner sc = new Scanner(s); while (sc.hasNext()) System.out.print(sc.next() + " "); } } 结果是什么?()A
x yyB
x,yyC
x yy 123D
x,yy,123
考题
单选题下述代码A和B正确的值是() Dim X As String = "123" Dim Y As Integer = 123 Dim A As String = X + Y Dim B As String = X YA
“246”,“123123”B
246,“123123”C
“123123”,“123123”D
123123,“123123”
考题
单选题预测以下代码片段的输出结果:() var str ; alert(typeof str);A
. string ;B
. undefined;C
. object ;D
. String;
考题
单选题现有: import java.util.*; class ScanStuff { public static void main (String [] args) { String S= "x,yy,123"; Scanner sc = new Scanner (s); while (sc.hasNext()) System.out.print (sc.next() +" "); } } 结果是什么?()A
x yyB
x,yy,123C
x yy 123D
x,yyE
编译失败F
运行的时候有异常抛出
考题
单选题现有代码片段:String s="123";String sl=S+456;请问sl的结果是哪项?()A
123456B
579C
编译错误D
运行时抛出异常
热门标签
最新试卷