下列程序段执行后的结果是()。
String s = new String("abcdefg");
for (int i=0; iSystem.out.print(s.charAt(i));
}
String s = new String("abcdefg");
for (int i=0; i
}
举一反三
- 下面的表达式( )是错误的。 A: String s=null; int i=(s!=null)&&(s.length()>0)?s.length():0; B: String s="你好";int i=3; if(i==s){ s+=i}; C: String s="你好";int i=3; s=i+s; D: String s="你好";int i=3; s+=i;
- 下面的代码片段中正确的是那一项? A: String s=″你好″;int i=3;i+=s; B: String s=″你好″;int i=3;if(i==s){s+=i}; C: String s=″你好″;int i=3;s=i+s; D: String s=″你好″;int i=3;s=i+;
- 执行语句: int i=0 , s=0 ; for( ; i<=10 ; i+=2 ) s+=i ; 后变量s的值是( )
- 以下程序执行结果是________。 string = ["PHP", "Python", "C", "C++", "Java"] for item in string: item_temp = item.lower() for i in range(len(item)): if item_temp[i] in 'aeiou': string.remove(item) break print(string) s = sorted(string, reverse = True) print(s)[/i]
- 有如下程序段:s = 0For i = 1 To 10 s = s + iNext iPrint s与上述程序段输出结果相同的程序段为( )。 A: s = 0: i = 0 While i <= 10 i = i + 1 s = s + i Wend Print s B: s = 0: i = 1 While i < 10 i = i + 1 s = s + i Wend Print s C: s = 0: i = 1 Do s = s + i i = i + 1 Loop While i < 10 Print s D: s = 0: i = 1 Do s = s + i i = i + 1 Loop Until i > 10 Print s