题目
下面程序的功能是统计字符串中“array”的个数,在程序的空白处应填入的正确选项是 public class FindKeyWords{ public static void main(String[]args) { String text="An array is a data structur that stores a collection of" +"values of the same type. You access each indMdual value" +"through an integer index. For example,if a is an array" +"of inergers,then a[i]is the ith integer in the array."; int arrayCount=0; int index=-1; String arrayStr="array"; index=text.indexOf(arrayStr); while(index>=0) { ++arrayCount; index+=arrayStr.length(); index=text.indexOf(arrayStr,index); } System.out.println("the text contains"+arrayCount+"arrays"); } }
A.<
B. =
C.<=
D.>=
第2题
下列程序的功能是统计字符串中“array”的个数,在程序的空白处应填入的正确选项是()。 publicclassFindKeyWords{ publicstaticvoidmain(sring[]args){ stingtext= “Anarrayisadatastructurthatstoresacollectionof” +“valuesofthesametype.YOUaccesseachindividualvalue'’ +“throughanintegerindex.Forexample,ifaiSanarray” +“of inergers,thena[i]iSthe ith integer in thearray.”; In tarrayCount=0; Intidex=-1; Sting arrarStr=“array”; IndeX=text.indexof(arrayStr); While(index______0){ ++arrayCount; Index+=arrayStr.length(); IndeX=text.indexof(arrayStr,indeX); } SyStem.out.phntln (“thetextcontains”+arrayCount+“arrays”); } }
A.<
B.=
C.<=
D.>=
第3题
(30 )下列程序的功能是统计字符串中 “ array ” 的个数,在程序的空白处应填入的正确选项是
public class FindKey Word s{
public static void main(sring[] args){
sting text=
“ An array is a data structur that stores a collection of ”
+ “ values of the same type . You access each individual value ”
+ “ through an integer index . For example,if a is an array ”
+ “ of inergers, then a[i] is the ith integer in the array. ” ;
Int arrayCount =0;
Int idex = -1;
Sting arrarStr = ” array ” ;
Index = text.indexof(arrayStr);
While(index______ 0) {
++arrayCount;
Index += arrayStr.length();
Index = text.indexof(arrayStr,index);
}
System.out.println
(“ the text contains ” + arrayCount + “ arrays ” );
}
}
A) <
B) =
C) <=
D) >=
第4题
A.<
B.=
C.<=
D.>=
第5题
下面程序的功能是统计字符串中"i"的个数,请填空。
Sub COU()
a$="Beijing University of Technology"
Dim n As Integer
n=Len(a$)
For i=1 To n
b$= 【12】
If 【13】 Then x=x + 1
Next i
Print "x="; x
End Sub
第6题
下面程序的功能是统计字符串中"i"的个数,请填空。
Sub COU()
Dim n As Integer
a$=" Beijing University of Technology"
n=Len(a$)
For i=1 To n
b$=【 】
If b$="i" Then x=x+1
Next
Print"x=" ; x
End Sub
第7题
下面程序的功能是()。 #include <iostream> #include <string> using namespace std; int main () { int i=1, n=0; char s[80],*p; p=s; strcpy(p,"It is a book.."); for (; *p !=' \0' ;p++) { if(*p=='') i=0; else if (i==0) { n++; i=1; } } cout<<"n=" <<n<<end1; return 0; }
A.统计字符串中的单词个数
B.统计字符串中的空格个数
C.统计字符串中的字母个数
D.统计字符串中的全部字符个数
第8题
下面这个Sub过程的功能是统计字符串中“a”的个数,请在空白处填上合适的代码完成程序。
Private Sub numCount()
Dim hum As Integer
s$ = "software And hardware"
num = Len(s$)
For i = 1 To hum
b$=______
If b$ = "a" Then x = x+1
Next i
Print "x="; x
End Sub
第9题
假设ES段中有一个字符串“12FG3LM5C”,其名为ARRAY,下面程序段执行后,CX的值是______。
CLD
LEA DI, ES:ARRAY
MOV AL, 'G'
MOV CX, 9
REPNE SCASB
HLT
A.9 B.5 C.4 D.0
第10题
A.A.3
B.B.4
C.C.5
D.D.2
为了保护您的账号安全,请在“赏学吧”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!