int index = 1;  boolean[] test = new Boolean[3];  boolean foo= test [index];   What is the result?()  A、 Foo has the value of 0.B、 Foo has the value of null.C、 Foo has the value of true.D、 Foo has the value of false.E、 An exception is thrown.F、 The code will not compile.

int index = 1;  boolean[] test = new Boolean[3];  boolean foo= test [index];   What is the result?()  

  • A、 Foo has the value of 0.
  • B、 Foo has the value of null.
  • C、 Foo has the value of true.
  • D、 Foo has the value of false.
  • E、 An exception is thrown.
  • F、 The code will not compile.

相关考题:

阅读以下说明和C++程序,将应填入(n)处的字句写在对应栏内。【C++程序】include include 阅读以下说明和C++程序,将应填入(n)处的字句写在对应栏内。【C++程序】include < stdio. h >include < string. h >define Max 1000class Bank{int index;char date [Max] [10]; // 记录交易日iht amount[Max]; // 记录每次交易金额,以符号区分存钱和取钱int rest[ Max]; // 记录每次交易后余额static iht sum; // 账户累计余额public:Bank( ) {index =0;}void deposit( char d[ ] , int m) //存入交易{strcpy ( date [ index ], d);amount[ index] = m;(1);rest[ index] = sum;index++;}void withdraw (char d[ ], int m) //取出交易{strcpy( date[ index] ,d);(2);(3);rest[ index] = sum;index++;}void display( );};int Bank:: sum = 0;void Bank:: display ( ) //输出流水{int i;printf("日期 存入 取出 余额\n");for (4){printf(" %8s" ,date[i] );if (5)printf(" %6d" , -amount[i] );elseprintf( "%6d ",amount[i] );printf( "% 6d\n" ,rest[i] );} }void main( ){Bank object;object. deposit ( "2006.2.5", 1 00 );object. deposit( "2006.3.2" , 200);object. withdraw( "2006.4.1", 50);object. withdraw( "2006.4.5", 80);object. display ( );}本程序的执行结果如下:日期 存入 取出 余额 2006.2.5 100 1002006.3.2 200 3002006.4.1 50 2502006.4.5 80 170

阅读以下说明和C语言函数,将应填入(n)处的字句写在对应栏内。【说明】下面一段程序从给定的数组b中找出值最小的元素,并输出该元素的数组下标、内存地址minaddr以及元素值本身。函数findmin负责在给定的数组中查找最小值,并返回最小值所在的内存地址,函数有三个参数:array是所要处理的数组;size是数组的大小;index负责从函数返回具有最大值的元素在数组中的数组下标。请填充空白,使其成为一个合乎要求的完整程序。【程序】//程序开始include<iostream.h>int *findmin(int *array, int size, int index);void main(){/****** 变量定义部分 ***********/int b[10] = {34, 34, 23, 89, 1, 2, 13, 42, 5, 54};(1);int idx;/******* 寻找最小值 ************/minaddr = findmin(b, sizeof(b)/sizeof(int), idx);/******* 输出最小值的有关信息 ************/cout << "Min value index: "<<idx<<end1<<"Min value address: "<<minaddr<<end1<<"Min value: "<<(2)<<end1;}/******* 函数findmin的定义部分 ************int *findmin(int *array, int size, int index){int min = 0;//max 是当前具有最小值的数组元素下标值for(int i = 1;(3); i++){if(array[i]<(4))min = i;}(5);return array + min;//返回最小值所在内存地址}

试题二(共15分)阅读下列说明,回答问题1至问题3,将解答填入答题纸的对应栏内。【说明】逻辑覆盖法是设计白盒测试用例的主要方法之一,它是通过对程序逻辑结构的遍历实现程序的覆盖。针对以下由C语言编写的程序,按要求回答问题。struct _ProtobufCIntRange{int start_value;unsigned orig_index;};typedef struct _ProtobufCIntRange ProtobufCIntRange;int int_range_lookup (unsigned n_ranges, const ProtobufCIntRange *ranges, int value){unsigned start,n; ∥1start=0;n=n_ranges;while(n1){ //2unsigned mid= start+ n/2;if(value ranges[mid].start_value){ //3n=mid-start; //4}else if(value=ranges[mid].start value+(int)(ranges[mid+1].orig_index-ranges[mid].orig_index){ //5unsigned new_start= mid+1; //6n=start+n-new_start,start = new_start;}else //7return (value - ranges[mid].start_value)+ ranges[mid],orig_index;}if(n0){ //8unsigned start_orig_index= ranges[start].orig_index;unsigned range_size=ranges[start+1].orig_index - start_orig_index;if (ranges[start].start_value=value value (int)(ranges[start].start_value+ range_size》 //9, 10return (value - ranges[start].start_value)+start_orig_index; //11}retum -1, //12} //13【问题1】(5分)请给出满足100%DC(判定覆盖)所需的逻辑条件。【问题2】 (7分)请画出上述程序的控制流图,并计算其控制流图的环路复杂度V(G)。【问题3】(3分)请给出【问题2】中控制流图的线性无关路径。

( 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) =

请写出如下程序的输出结果:#includeint a[]={2,4,6,8,10};int index(int i){ return a[i];}void main(){int i;index(3)=12;for (i=0;i=4;i++)cout

下面函数的作用是【 】。int index(int x,int a[],int n){for(int i=0;i<n;i++){if(a[i]==x)return i;}return i;}

intindex=1;int[]foo=newint[3];intbar=foo[index];intbaz=bar+index;Whatistheresult?() A.Bazhasthevalueof0B.Bazhasthevalueof1C.Bazhasthevalueof2D.Anexceptionisthrown.E.Thecodewillnotcompile.

请完成Java程序:本题是一个冒泡排序程序的实例。冒泡排序的含义是将相邻的两个数作比较,如果是升序排列的话,如果前边的数大,则将两个数交换。从第一个数开始两两比较一次,就可以将最大的数移动到最后。注意:请勿修改main()主方法和其他已有语句内容,仅在横线处填入适当语句。import java.io.*;public class simple{public static int[]Data=new int[10];public static void main(String[] args)int i;int Index;Index=0;InputStreamReader ir;BufferedReader in;ir=new InputStreamReader(System.in);in=new BufferedReader(ir);try{do{System.out.println("Please input the number"+Index+"you want to sort(Exit for 0):");String s=in.readLine();Data[Index]=Integer.parseInt(s);Index++;}while(Data[Index-1]!=0);}catch(IOException e){System.out.println(e.getMessage());}System.out.print("Before bubble sorting:");for(i=0; i<Index-1; i++)System.out.print(" "+Data[i]+" ");System.out.println(" ");BubbleSort(Index-1);System.out.print("After Bubble Sorting:");for(i=0; i<Index-1;i++)System.out.print(" "+Data[i]+" ");System.out.println(" ");}public static void BubbleSort(int Index){int i, j, k;boolean Change;int Temp;for(j=Index; j>1;j--){Change=false;for(i=0; i<j-1;i++){if(Data[i+1]<Data[i]){Temp=Data[i+1];Data[i+1]=Data[i];______;______;}}if(Change){System.out.print("Current Sorting Result:");for(k=0; k<Index; k++)System.out.print(" "+Data[k]+" ");System.out.println(" ");}}}}

下面程序执行后,baz的值应是______。 public class Test9 { public static void main(String[] args) { int index = 1; int fox[] = new int [3]; iht bar = fox [index]; int baz = bar + index; System.out.println(baz); } }A.0B.1C.2D.编译错误

阅读下列说明、图和C++代码,填补空缺。[说明]已知对某载客车辆(Car)进行类建模,如图12-2所示,其中类Engine表示发动机引擎,类Wheel表示车轮,类Body表示车身,类Driver表示司机,类Passenger表示乘客。const int __________ =7; //定义最多载客数const int MAX_WHEELS=5; //定义最多轮胎数class Body{ //此处代码省略 ); //车身类class Passenger{ //此处代码省略}; //乘客类Class Wheel{ //此处代码省略}; //车轮类Class Driver{ //司机类public:string name; //表示第几路公交车司机Driver(string driverName):marne( __________ ){}; //构造函数};class Engine{ //引擎类public:string engineNo; //引擎编号Engine(string engineNo){ __________ ->engineNo=engineNo; }//构造函数};Class Car{ //汽车类protected:Engine *engine; Driver *driver; Body body;Wheel *wheels[MAX_WHEELS]; Passenger *passengers[MAX_PASSENGERS];public:Car(Driver *driver)( //构造函数this->driver=driver;engine=new Engine("TX653 6型号引擎");for(int index=0; index<MAX_WHEELS; index++){wheels[index]=new Wheel( );}for(int index=0; index passengers[index]=NULL;}}virtual -Car( ){ //析构函数for (int index=0; index<MAX_WHEELS; index++)delete wheels[index];delete __________ ;}int getPassengerNumber( ){ //获取车上乘客数量//此处代码省略}void getonpassenger(Passenger *apassenger ){//乘客上车//此处代码省略}void run( ){ //开车if(driver==NULL){cout<< "司机尚未上车!"; return; }//此处代码省略}};void main( ){Driver driver("第五路公交车司机");Car car( __________ );Passenger passengers[MAX_PASSENGERS];for(int index=0; index<MAX_PASSENGERS; index++)//乘客上车处理car. getOnPasSenger(passengers[index]);car. run( );}

关于以下初始化序列的执行结果的说法正确的是( )。 int index=1; int[] foo=new int[3]; int bar=foo[index]; int baz=bar+index;A.baz的值为0B.baz的值为1C.编译通过,但产生异常D.编译不能通过

下列程序执行后,baz的值应是 int index=1; int fox[ ]=new int[3]; Int bar=fox[index]; int baz:bar+index;A.0B.1C.2D.编译错误

试题五(共 15 分)阅读下列说明、图和C++代码,将应填入 (n) 处的字句写在答题纸的对应栏内。[说明]已知对某载客车辆(Car)进行类建模,如图 5-1所示,其中类 Engine 表示发动机引擎,类 Wheel 表示车轮,类 Body 表示车身,类 Driver 表示司机,类 Passenger 表示乘客。[C++代码]const int (1) = 7; //定义最多载客数const int MAX_WHEELS = 5; //定义最多轮胎数class Body{ //此处代码省略 }; //车身类class Passenger{ //此处代码省略 }; //乘客类class Wheel{ //此处代码省略 }; //车轮类class Driver{ //司机类public:string name; //表示第几路公交车司机Driver(string driverName):name( (2) ){}; //构造函数};class Engine{ //引擎类public:string engineNo; //引擎编号Engine(string engineNo){ (3) -engineNo = engineNo; } //构造函数};class Car{ //汽车类protected:Engine * engine; Driver * driver; Body body;Wheel * wheels[MAX_WHEELS]; Passenger * passengers[MAX_PASSENGERS];public:Car(Driver *driver){ //构造函数this-driver = driver;engine = new Engine("TX6536 型号引擎");for (int index = 0; index MAX_WHEELS; index++){wheels[index] = new Wheel();}for (int index = 0; index MAX_PASSENGERS; index++){passengers[index] = NULL;}}virtual ~Car(){ //析构函数for (int index=0; index MAX_WHEELS; index++)delete wheels[index];delete (4) ;}int getPassengerNumber(){ //获取车上乘客数量//此处代码省略}void getOnPassenger(Passenger * aPassenger ){ //乘客上车//此处代码省略}void run(){ //开车if(driver == NULL){ cout "司机尚未上车!"; return; }//此处代码省略}};void main(){Driver driver("第五路公交车司机");Car car( (5) );Passenger passengers[MAX_PASSENGERS];for (int index = 0 ; index MAX_PASSENGERS; index ++) //乘客上车处理car.getOnPassenger(passengers[index]);car.run();}

int index = 1;   String test = new String;   String foo = test[index];  What is the result?()A、 Foo has the value “”B、 Foo has the value nullC、 An exception is thrownD、 The code will not compile

Table TAB1 was created using the following statement: CREATE TABLE tab1 (c1 INT, c2 INT, c3 INT, c4 INT, c5 INT); If column C1 is unique and queries typically access columns C1 and C2 together, which statement(s) will create index(es) that will provide optimal query performance? ()A、 CREATE UNIQUE INDEX xtab1 ON tab1 (c1) include (c2)B、 CREATE UNIQUE INDEX xtab1 ON tab1 (c1);  CREATE INDEX xtab2 ON tab1 (c3) INCLUDE (c2) C、 CREATE UNIQUE INDEX xtab1 ON tab1 (c2, c1)D、 CREATE UNIQUE INDEX xtab1 ON tab1 (c2) INCLUDE (c1)

StringBuffer deleteCharAt(int index)表示删除索引index-1处的字符

charAt(int index)表示从字符串中取得一个字符,该字符的位置是index

int index = 1;   boolean test = new Boolean;   boolean foo= test [index];  What is the result?()A、 Foo has the value of 0.B、 Foo has the value of null.C、 Foo has the value of true.D、 Foo has the value of false.E、 An exception is thrown.F、 The code will not compile.

int index = 1;   int foo = new int ;   int bar = foo [index];   int baz = bar + index;   What is the result?()A、 Baz has the value of 0B、 Baz has the value of 1C、 Baz has the value of 2D、 An exception is thrown.E、 The code will not compile.

int index = 1;  String [] test = new String[3];  String foo = test[index];     What is the result?()  A、 Foo has the value “”B、 Foo has the value nullC、 An exception is thrownD、 The code will not compile

单选题下列程序的功能是统计字符串中“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 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 index=-1;  String arrayStr=array;  index=text.indexOf(arrayCount);  while(index ______ 0)  {   ++arrayCount;   index+=arrayStr.length();   index=text.indexOf(arrayStr,index);   System.out.println(the text contains+arrayCount+arrays);  } }}AB=C=D=

单选题int index = 1;   int foo = new int ;   int bar = foo [index];   int baz = bar + index;   What is the result?()A Baz has the value of 0B Baz has the value of 1C Baz has the value of 2D An exception is thrown.E The code will not compile.

单选题int index = 1;  int [] foo = new int [3];  int bar = foo [index];  int baz = bar + index;   What is the result?()A Baz has the value of 0B Baz has the value of 1C Baz has the value of 2D An exception is thrown.E The code will not compile.

单选题int index = 1;   boolean test = new Boolean;   boolean foo= test [index];  What is the result?()A Foo has the value of 0.B Foo has the value of null.C Foo has the value of true.D Foo has the value of false.E An exception is thrown.F The code will not compile.

单选题Table TAB1 was created using the following statement: CREATE TABLE tab1 (c1 INT, c2 INT, c3 INT, c4 INT, c5 INT); If column C1 is unique and queries typically access columns C1, C2 and C3 together, which statement(s) will createindex(es) that will provide optimal query performance?()ACREATE UNIQUE INDEX xtab1 ON tab1 (c1); CREATE INDEX xtab2 ON tab1 (c2) INCLUDE (c3)  BCREATE UNIQUE INDEX xtab1 ON tab1 (c1) INCLUDE (c2, c3) CCREATE UNIQUE INDEX xtab1 ON tab1 (c3, c2, c1)  DCREATE UNIQUE INDEX xtab1 ON tab1 (c2) INCLUDE (c1, c3)

判断题StringBuffer deleteCharAt(int index)表示删除索引index-1处的字符A对B错

单选题int index = 1;   String test = new String;   String foo = test[index];  What is the result?()A Foo has the value “”B Foo has the value nullC An exception is thrownD The code will not compile

单选题int index = 1;  String [] test = new String[3];  String foo = test[index];     What is the result?()A Foo has the value “”B Foo has the value nullC An exception is thrownD The code will not compile