题目详情
当前位置:首页 > 职业培训考试
题目详情:
发布时间:2023-12-06 22:01:22

[单项选择]下面程序的功能是统计字符串中“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. >=

更多"下面程序的功能是统计字符串中“array”的个数,在程序的空白处应填入"的相关试题:

[单项选择]下面程序的功能是统计字符串中“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. >=
[单项选择]下列程序的功能是统计字符串中“array”的个数,在程序的空白处应填入的正确选项是( )。
public class FindKeyWords
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(arravStr);
While(index______0)
++arrayCount;
Index+=arrayStr.length( );
Index=text.indexof(arrayStr,index);

System.out.println
("the text contains"+arrayCount+"arrays");


A. <
B. =
C. <=
D. >=
[单项选择]下列程序的功能是统计字符串中“array”的个数,在程序的空白处应填入的正确选项是______。
public class FindKeyWords
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. >=
[填空题]【说明】
下面的程序功能的功能是以行为单位对字符串按下面的条件进行排序。排序条件为:从字符串中间一分为二,右边部分按字符的ASCII值降序排序,排序后左边部分与右边部分进行交换。如果原字符串长度为奇数,则最中间的字符不参加排序,字符仍放在原位置上
例如:位置:0 1 2 3 4 5 6 7
源字符串:h g f e a b c d
则处理后字符串:d c b a h g f e
函数ReadDat( )实现从文件in.dat中读取数据(每行字符串长度均小于80),函数WriteDat( )把结果dat输出到文件out.dat中。
#include<stdio.h>
#include<siring.h>  
#include<conio.h>
char dat[20] [80];
void jsSort( )

int i,j,k,strl;
char ch;
for(i=0;i<20;i++)
strl=strlen(date[i]);
for(j= (1) ;j<strl;j++) /*对后半部分的字符串进行排序*/
for(k=j+1;k<strl;k++)
if( (2) )

ch=dat[i] [j];
dot[i] [j]=dat[i] [k];
dat[i] [k]=ch;

for(j=0; (3) j++) /*前后两部分进行交换*/

ch = date [i] [j];
dote [i] [j] = date [i] [(strl+1)/2+j];
dat [i] [(strl+1)/2+j]=ch;



void main( )

reodDat( );
isSort( );
writeDot( 
[填空题]下面程序的功能是统计字符串中“i”的个数请填空。 Sub COU( ) Dim n As Integer a$ =" Beijing University of Technology" n = Len(a$) For i = 1 To n b$ = 【15】 If b$ ="i" Then x=x+1 Next Print" x="; x End Sub
[填空题]下面程序的功能是统计字符串中“i”的个数,请填空。 Sub COU( ) Dim n As Integer a$ = "Beijing University of Technology" n = Len(a$ ) For i = 1 To n b$ =Mid$(a$,i, 1) If 【11】 Then x=x + 1 Next Print "x ="; x End Sub
[填空题]下面程序的功能是统计字符串中“i”的个数请填空。
Sub COU( )
Dim n As Integer
a$ =" Beijing University of Technology"
n = Len(a$)
For i = 1 To n
b$ = 【15】
If b$ ="i" Then x=x+1
Next
Print" x="; x
End Sub
[简答题]分析两个字符串,分别输出每个字符串的单词并统计出单词个数。阅读程序,填写空行。 注意:不改动程序结构,不得增行或删行。 import java.util.*; public class ex2 { public static void main(String args[]) { String s1="I am Chinese,she is my girlfriend"; String s2="Oh,really,fine"; StringTokenizer fenxi_1=new StringTokenizer(s1,","); StringTokenizer fenxi_2=new StringTokenizer(s2,","); int n1=fenxi_1.countTokens( ); int n2=fenxi_2.countTokens( ); while(fenxi_1.hasMoreTokens( )) { String s=fenxi_1.nextToken( ); System.out.println(s); } System.out.println("s1单词:"+n1+"个"); while(fenxi_1.hasMoreTokens( )) { String s=______; System.out.println(s); } System.out.println("s2单词:"+n2+"个"); } }
[填空题]以下程序的功能是统计字符串A中出现字符串B的次数,然后输出,请在填空[9]处填入适当的程序完成功能。
[简答题]分析两个字符串,分别输出每个字符串的单词并统计出单词个数。阅读程序,填写空行。
注意:不改动程序结构,不得增行或删行。
import java.util.*;
public class ex2

public static void main(String args[])

String s1="I am Chinese,she is my girlfriend";
String s2="Oh,really,fine";
StringTokenizer fenxi_1=new StringTokenizer(s1,",");
StringTokenizer fenxi_2=new StringTokenizer(s2,",");
int n1=fenxi_1.countTokens( );
int n2=fenxi_2.countTokens( );
while(fenxi_1.hasMoreTokens( ))

String s=fenxi_1.nextToken( );
System.out.println(s);

System.out.println("s1单词:"+n1+"个");
while(fenxi_1.hasMoreTokens( ))

String s=______;
System.out.println(s);

System.out.println("s2单词:"+n2+"个");


[填空题]下面程序的功能是统计字符串中“广的个数,请填空。   Sub COU( )     a$="Beijing University of Technology"     Dim n AS Integer     n=Len(a$)     For i=1 To n     b$=【 】     If 【 】 Then x=x+1    Next i    Print "x=";x   End Sub
[填空题]下面程序的功能是统计字符串中“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

我来回答:

购买搜题卡查看答案
[会员特权] 开通VIP, 查看 全部题目答案
[会员特权] 享免全部广告特权
推荐91天
¥36.8
¥80元
31天
¥20.8
¥40元
365天
¥88.8
¥188元
请选择支付方式
  • 微信支付
  • 支付宝支付
点击支付即表示同意并接受了《购买须知》
立即支付 系统将自动为您注册账号
请使用微信扫码支付

订单号:

请不要关闭本页面,支付完成后请点击【支付完成】按钮
恭喜您,购买搜题卡成功
重要提示:请拍照或截图保存账号密码!
我要搜题网官网:https://www.woyaosouti.com
我已记住账号密码