多选题Given:   11. // insert code here   12. private N min, max;   13. public N getMin() { return min; }   14. public N getMax() { return max; }   15. public void add(N added) {   16. if (min == null || added.doubleValue()  max.doubleValue())  19. max = added;   20. }   21. }   Which two, inserted at line 11, will allow the code to compile?()AABBCCDDEEFF

多选题
Given:   11. // insert code here   12. private N min, max;   13. public N getMin() { return min; }   14. public N getMax() { return max; }   15. public void add(N added) {   16. if (min == null || added.doubleValue()  max.doubleValue())  19. max = added;   20. }   21. }   Which two, inserted at line 11, will allow the code to compile?()
A

A

B

B

C

C

D

D

E

E

F

F


参考解析

解析: 暂无解析

相关考题:

●试题二阅读下列程序或函数说明和C代码,将应填入(n)处的字句写在答题纸的对应栏内。【函数2.1说明】函数strcmp()是比较两个字符串s和t的大小。若s<t函数返回负数;若s=t函数返回0;若s>t,函数返回正数。【函数2.1】int strcmp(char *s,char *t){ while(*s *t (1) ){s++;t++;}return (2) ;}【程序2.2说明】在n行n列的矩阵中,每行都有最大的数,本程序求这n个最大数中的最小一个。【程序2.2】#includestdio.h#define N 100int a[N][N];void main(){ int row ,col,max,min,n;/*输入合法n(<100),和输入n×n个整数到数组a的代码略*/for (row=0;row<n;row++){for(max=a[row][0],col=1;col<n;col++)if( (3) )max=a[row][col];if( (4) )min=max;else if( (5) )min=max;}printf ("The min of max numbers is %d\n",min);}

阅读以下说明和Java代码,将应填入(n)处的字句写在对应栏内。[说明]编写一个字符界面的Java Application 程序,接受用户输入的10个整数,并输出这10个整数的最大值和最小值。[Java 代码]import java. io.* ;public class abc{public static void main ((1)){int i, n=10, max=0, min=0, temp=0;try {BufferedReader br = new BufferedReader (new InputStreamReader ( System.in ) );max = min =Integer. parselnt ( br. readLine ( ) );}. (2) ( IOExccption e ) {} ;for ( i=2 ; i<=n ; i++ ) {try {BufferedReader br = new (3) (new InputStreamReader ( System. in ) );temp =(4) ( br. readLine ( ));if (temp>max ) max=temp;if (temp<min) (5)} catch (IOException e ) {};}System.out.println ( "max="+max+"\nmin="+min );}}

Given:11.//insertcodehere12.min.doubleValue())17.min=added;18.if(max==null||added.doubleValue()max.doubleValue())19.max=added;20.}21.}Whichtwo,insertedatline11,willallowthecodetocompile?()

在程序中,给出两个整数4和5,计算他们的和,并在屏幕上显示出来。请将程序补充完整。注意:请勿修改main()主方法和其他已有语句内容,仅在横线处填入适当语句。______Add{private int a;private int b;public Add(int n1,int n2){a=nl;b=n2;}public int getAdd(){return a +b;}}public class basic{public ______void main(String[] args){int n1=4, n2=5;Add aAddB=______Add(nl,n2);System.out.println("4+5="+aAddB.getAdd());}}

下列程序的输出结果是 #include"iostream" using namespace std; int Max(int a,int b) { if(a>b) return a; else return b; } void main( ) { int m,n; m=10,n=5; int max = Max(m,n); cout<<max<<endl; }A.10B.程序有误C.1D.0

fun函数的功能是首先对a所指的N行N列的矩阵找出各行中最大的数,再求这N个最大值中最小的那个数作为函数值返回,请填空。#include stdio.h#define N 100int fun(int(*a)[N]){ int row,col,max,min; for(row=0;rowN;row++) { for(max=a[row][0],col=1;colN;col++) if() max=a[row][col]; if(row==0) min=max; else if() min=max; } return min;}

下列程序的输出结果为【 】。ineludeint max(int x, int y){return (x 下列程序的输出结果为【 】。inelude<iostream. h>int max(int x, int y){return (x>y? x: y); }void main() {int n=3, m=12;max(m, n)++cout<<"m="<<m<<", n= "<<n<<end1;}

有以下程序:includeusing namespace std;Class sample{private:int n;public:sample( 有以下程序: #include<iostream> using namespace std; Class sample { private: int n; public: sample(){} sample(int m) { n=m; } sample add(sample s1,samplc s2) { this-->n=s1.n+s2.n; return(*this); } void disp(A.n=10B.n=5C.n=20D.n=15

11. public void testIfA() {  12. if(testIfB(”True”)) {  13. System.out.println(”True”);  14. } else {  15. System.out.println(”Not true”);  16. }  17. }  18. public Boolean testIfB(String str) {  19. return Boolean.valueOf(str);  20. }  What is the result when method testIfA is invoked?() A、 TrueB、 Not trueC、 An exception is thrown at runtime.D、 Compilation fails because of an error at line 12.E、 Compilation fails because of an error at line 19.

10. interface Foo { int bar(); }  11. public class Sprite {  12. public int fubar( Foo foo) { return foo.bar(); }  13. public void testFoo() {  14. fubar(  15. // insert code here  16.);  17. }  18. }  Which code, inserted at line 15, allows the class Sprite to compile?() A、 Foo { public int bar() { return 1; } }B、 new Foo { public int bar() { return 1; } }C、 newFoo() { public int bar(){return 1; } }D、 new class Foo { public int bar() { return 1; } }

11. public class Counter {  12. public static void main(String[] args) {  13. int numArgs = /* insert code here */;  14. }  15. }  and the command line: java Counter one fred 42 Which code, inserted at line 13, captures the number of arguments passed into the program?() A、 args.countB、 args.lengthC、 args.count()D、 args.length()E、 args.getLength()

10. abstract public class Employee {  11. protected abstract double getSalesAmount();  12. public double getCommision() {  13. return getSalesAmount() * 0.15;  14. }  15. }  16. class Sales extends Employee {  17. // insert method here  18. }  Which two methods, inserted independently at line 17, correctly complete the Sales class?()A、 double getSalesAmount() { return 1230.45; }B、 public double getSalesAmount() { return 1230.45; }C、 private double getSalesAmount() { return 1230.45; }D、 protected double getSalesAmount() { return 1230.45; }

public class X {  public X aMethod() { return this;}  }  public class Y extends X {  }  Which two methods can be added to the definition of class Y?()A、 public void aMethod() {}B、 private void aMethod() {}C、 public void aMethod(String s) {}D、 private Y aMethod() { return null; }E、 public X aMethod() { return new Y(); }

public class Score implements Comparable {  private int wins, losses;  public Score(int w, int 1) { wins = w; losses = 1; }  public int getWins() { return wins; }  public int getLosses() { return losses; }  public String toString() {  return ““ + wins + “,“ + losses + “”; }  // insert code here  }  Which method will complete this class?() A、 public int compareTo(Object o) {/*mode code here*/}B、 public int compareTo(Score other) {/*more code here*/}C、 public int compare(Score s1,Score s2){/*more code here*/}D、 public int compare(Object o1,Object o2){/*more code here*/}

11. public class Test {  12. public void foo() {  13. assert false;  14. assert false;  15. }  16. public void bar(){  17. while(true){  18. assert false;  19. }  20. assert false;  21. }  22. }  What causes compilation to fail?()  A、 Line 13B、 Line 14C、 Line 18D、 Line 20

11. class Payload {  12. private int weight;  13. public Payload(int wt) { weight = wt; }  13. public void setWeight(mt w) { weight = w; }  15. public String toString { return Integer.toString(weight); }  16. }  17.  18. public class TestPayload {  19. static void changePayload(Payload p) { 20. /* insert code here */ 21. }  22.  23. public static void main(String[] args) {  24. Payload p = new Payload();  25. p.setWeight(1024);  26. changePayload(p);  27. System.out.println(”The value of p is “+ p);  28. }  29. }  Which statement, placed at line 20, causes the code to print “The value of p is 420.”?() A、 p.setWeight(420);B、 p.changePayload(420);C、 p = new Payload(420);D、 Payload.setWeight(420);E、 p = Payload.setWeight(420);F、 p = new Payload(); p.setWeight(420);

interface A { public int getValue() }  class B implements A {  public int getValue() { return 1; }  }  class C extends B {  // insert code here  }  Which three code fragments, inserted individually at line 15, make use of polymorphism?()A、 public void add(C c) { c.getValue(); }B、 public void add(B b) { b.getValue(); }C、 public void add(A a) { a.getValue(); }D、 public void add(A a, B b) { a.getValue(); }E、 public void add(C c1, C c2) { c1.getValue(); }

10. public class Foo implements java.io.Serializable {  11. private int x;  12. public int getX() { return x; }  12.publicFoo(int x){this.x=x; }  13. private void writeObject( ObjectOutputStream s)  14. throws IOException {  15. // insert code here  16. }  17. }  Which code fragment, inserted at line 15, will allow Foo objects to be correctly serialized and deserialized?() A、 s.writeInt(x);B、 s.serialize(x);C、 s.writeObject(x);D、 s.defaultWriteObject();

10. class Inner {  11. private int x;  12. public void setX( int x) { this.x = x; }  13. public int getX() { return x; }  14. }  15.  16. class Outer {  17. private Inner y;  18. public void setY( Inner y) { this.y = y; }  19. public Inner getY() { return y; }  20. }  21.  22. public class Gamma {  23. public static void main( String[] args) { 24. Outer o = new Outer(); 25. Inner i = new Inner();  26.int n=10;  27. i.setX(n);  28. o.setY(i);  29. // insert code here  30. System.out.println( o.getY().getX());  31. }  32. }  Which three code fragments, added individually at line 29, produce the output 100?()A、 n = 100;B、 i.setX( 100);C、 o.getY().setX( 100);D、 i = new Inner(); i.setX( 100);E、 o.setY( i); i = new Inner(); i.setX( 100);F、 i = new Inner(); i.setX( 100); o.setY( i);

10. class Line {  11. public class Point { public int x,y; }  12. public Point getPoint() { return new Point(); }  13. }  14. class Triangle {  15. public Triangle() {  16. // insert code here  17. }  18. }  Which code, inserted at line 16, correctly retrieves a local instance of a Point object?() A、 Point p = Line.getPoint();B、 Line.Point p = Line.getPoint();C、 Point p = (new Line()).getPoint();D、 Line.Point p = (new Line()).getPoint();

Given:   10. class One {   11. void foo() { }   12. }   13. class Two extends One {   14. //insert method here   15. }   Which three methods, inserted individually at line 14, will correctly complete class Two?()A、 public void foo() { /* more code here */ }B、 private void foo() { /* more code here */ }C、 protected void foo() { /* more code here */ }D、 int foo() { /* more code here */ }  E、 void foo() { /* more code here */ }

多选题10. class Inner {  11. private int x;  12. public void setX( int x) { this.x = x; }  13. public int getX() { return x; }  14. }  15.  16. class Outer {  17. private Inner y;  18. public void setY( Inner y) { this.y = y; }  19. public Inner getY() { return y; }  20. }  21.  22. public class Gamma {  23. public static void main( String[] args) { 24. Outer o = new Outer(); 25. Inner i = new Inner();  26.int n=10;  27. i.setX(n);  28. o.setY(i);  29. // insert code here  30. System.out.println( o.getY().getX());  31. }  32. }  Which three code fragments, added individually at line 29, produce the output 100?()An = 100;Bi.setX( 100);Co.getY().setX( 100);Di = new Inner(); i.setX( 100);Eo.setY( i); i = new Inner(); i.setX( 100);Fi = new Inner(); i.setX( 100); o.setY( i);

单选题11. public class Counter {  12. public static void main(String[] args) {  13. int numArgs = /* insert code here */;  14. }  15. }  and the command line: java Counter one fred 42 Which code, inserted at line 13, captures the number of arguments passed into the program?()A args.countB args.lengthC args.count()D args.length()E args.getLength()

多选题Given:   11. // insert code here   12. private N min, max;   13. public N getMin() { return min; }   14. public N getMax() { return max; }   15. public void add(N added) {   16. if (min == null || added.doubleValue()  max.doubleValue())  19. max = added;   20. }   21. }   Which two, inserted at line 11, will allow the code to compile?()AABBCCDDEEFF

单选题10. class Line {  11. public class Point { public int x,y; }  12. public Point getPoint() { return new Point(); }  13. }  14. class Triangle {  15. public Triangle() {  16. // insert code here  17. }  18. }  Which code, inserted at line 16, correctly retrieves a local instance of a Point object?()A Point p = Line.getPoint();B Line.Point p = Line.getPoint();C Point p = (new Line()).getPoint();D Line.Point p = (new Line()).getPoint();

单选题11. public void testIfA() {  12. if(testIfB(”True”)) {  13. System.out.println(”True”);  14. } else {  15. System.out.println(”Not true”);  16. }  17. }  18. public Boolean testIfB(String str) {  19. return Boolean.valueOf(str);  20. }  What is the result when method testIfA is invoked?()A TrueB Not trueC An exception is thrown at runtime.D Compilation fails because of an error at line 12.E Compilation fails because of an error at line 19.

多选题10. abstract public class Employee {  11. protected abstract double getSalesAmount();  12. public double getCommision() {  13. return getSalesAmount() * 0.15;  14. }  15. }  16. class Sales extends Employee {  17. // insert method here  18. }  Which two methods, inserted independently at line 17, correctly complete the Sales class?()Adouble getSalesAmount() { return 1230.45; }Bpublic double getSalesAmount() { return 1230.45; }Cprivate double getSalesAmount() { return 1230.45; }Dprotected double getSalesAmount() { return 1230.45; }

单选题11. class Payload {  12. private int weight;  13. public Payload(int wt) { weight = wt; }  13. public void setWeight(mt w) { weight = w; }  15. public String toString { return Integer.toString(weight); }  16. }  17.  18. public class TestPayload {  19. static void changePayload(Payload p) { 20. /* insert code here */ 21. }  22.  23. public static void main(String[] args) {  24. Payload p = new Payload();  25. p.setWeight(1024);  26. changePayload(p);  27. System.out.println(”The value of p is “+ p);  28. }  29. }  Which statement, placed at line 20, causes the code to print “The value of p is 420.”?()A p.setWeight(420);B p.changePayload(420);C p = new Payload(420);D Payload.setWeight(420);E p = Payload.setWeight(420);F p = new Payload(); p.setWeight(420);