下面的哪些程序片断可能导致错误()
第1题:
A.s>>>=3;
B.int i=s.length();
C.s[3]=”x”;
D.String short_s=s.trim();
E.String t=”root”+s;
第2题:
下列哪个程序段可能导致错误?
A.String s="hello"; String t= "good"; String k=s+ t;
B.String s="hello"; String t; t=s[3]+"one";
C.String s="hello"; String standard=s. toUpperCase
D.String s="hello"; String t =s+ "good"
第3题:
下列程序执行后,屏幕上显示的应是 public class Testyyy {public static void main(String[]args) {char charl[]={,'t' 'e''s],'t'}; char char2[]={'t','e','s','t','1'}; String s1=new String(char1); String s2=new String(char2,0,4); System.out.println(s1.equals(s2)); } }
A.true
B.假
C.test
D.编译错误
第4题:
下面的程序执行后,屏幕上显示的应是 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.test
D.编译错误
第5题:
下列的哪个程序段可能导致错误?
A.String s = "hello"; String t = "good"; String k = s + t;
B.String s = "hello"; String t; t = s[3] + "one";
C.String s = " hello "; String standard = s.toUpperCase( );
D.String s = "hello"; String t = s + "good";
第6题:
若输入 "I am a boy!",下列程序的运行结果为______。 char connect(string1,string2,string) char string1[],string2[],string[]; { int i,j; for (i=0;stringl[i] !='\0';i++) string[i]=stringl[i]; for (j=0;string2[j] !='\0';j++) string[i+j]=string2[j]; string[i+j ] ='\0'; } main ( ) { char s1 [100] , s2 [100] , s [100]; printf ("\n 输入 string1: \n"); scanf("%s",s1); printf (" \n 输入 string2: \n" ); scanf ("%s", s2); connect (s1, s2, s); printf ("%s\n", s); }
A.I am a boy!
B.输入string2:
C.I am
D.I am a boy!
第7题:
下面的哪些程序片段可能导致错误()。
第8题:
下面哪个是对字符串String的正确定义()。
第9题:
有语句String s=”hello world”; ,以下操作哪个是不合法的()
第10题:
Which of the following fragments might cause errors?()
第11题:
String s = Gone with the wind;String t = good ;String k = s + t;
String s = Gone with the wind;String t;t = s[3] + one;
String s = Gone with the wind;String standard = s.toUpperCase();
String s = home directory;String t = s - directory;
第12题:
String s = Gone with the wind; String t = good ; String k = s + t;
String s = Gone with the wind; String t; t = s[3] + one;
String s = Gone with the wind; String standard = s.toUpperCase();
String s = home directory; String t = s - directory
第13题:
下列的哪个程序段可能导致错误? ( )
A.String s="hello"; String t="good"; String k=s+t;
B.String s="hello"; String t; t=s[3]+"one";
C.String s="hello"; String standard=s.toUpperCase();
D.String s="hello"; String t=s+"good";
第14题:
下列语句能给数组赋值而不使用for循环的是
A.myArray{[1]="One";[2]="Two";[3]="Three";}
B.String s[5]=new String[]{"Zero", "One", "Two", "There", "Four"};
C.String s[]=new String[]{"Zero", "One", "Two", "There", "Four"};
D.String s[]=new String[]=|"Zero", "One", "Two", "There", "Four"};
第15题:
下列语句能给数组赋值,而不使用for循环的是
A.myArray{[1]="One";[2]="Two";[3]="Three";}
B.String s[5]=new String[] {"Zero","One","Two","Three","Four"};
C.String s[]=new String[] {"Zero","One","Two","Three","Four"};
D.String s[]=new String[]= {"Zero","One","Two","Three","Four"};
第16题:
下列的( )程序段可能导致错误。
A.String s="hello": Sting t="good"; String k=s+t;
B.Sting s="hello"; String t; t=s [3] + "one";
C.Sting s="hello"; String standard=s.toUpperCase( );
D.String s="hello": Stringt s +"good";
第17题:
下面程序执行后,屏幕上显示的应是______。 public class Testl0 { public static void main(String[] args) { char char1[] = {'t', 'e', 's', 't'}; char char2[] = ('t', 'e', 's', 't', '1 }; String s1 = new String(char1); String s2 = new String(char2, 0, 4); System.out.println (si.equal (s2)); } }
A.true
B.假
C.test
D.编译错误
第18题:
下面哪段语法执行正确()
第19题:
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?()
第20题:
Strings="This is the";Stringt=s.concat("String.");t的内容是()
第21题:
String s= "hello"; String t = "hello"; char c[] = {’h’,’e’,’l’,’l’,’o’} ; Which return true?()
第22题:
String s = “Gone with the wind”; String t = “ good”; String k = s + t;
String s = “Gone with the wind”; String t; t = s[3] + “one”;
String s = “Gone with the wind”; String standard = s.toUpperCase();
String s = “home directory”; String t = s – “directory”;
第23题:
String s = Gone with the wind;String t = good ;String k = s + t;
String s = Gone with the wind;String t; t = s[3] + one;
String s = Gone with the wind;String standard = s.toUpperCase();
String s = home directory;String t = s - directory;