line 21
line 23
line 27
line 29
第1题:
类Test定义如下,将下列______方法插入③行处是不合法的。 ( )①public class Test{②public float Method(float a,float b){}③④}
A.public float Method(float a,float b,float c){}
B.public float Method(float c,float d){}
C.public int Method(int a,int b){}
D.private float Method(int a,int b,int c){}
第2题:
类Test定义如下,将下列哪个方法插入③行处是不合法的( )?
① public class Test{
② public float Method(float a,float B) { }
③ ______
④ }
A.public float Method(float a,float b,float C) { }
B.public float Method(float c,float d){ }
C.public int Method(int a,int B) { }private float Method(int a,int b,int C) { }
D.private float Method(int a,int b,int C) { }
第3题:
20.publicfloatgetSalary(Employeee){21.assertvalidEmployee(e);22.floatsal=lookupSalary(e);23.assert(sal>0);24.returnsal;25.}26.privateintgetAge(Employeee){27.assertvalidEmployee(e);28.intage=lookupAge(e);29.assert(age>0);30.returnage;31.}Whichlineisaviolationofappropriateuseoftheassertionmechanism?()
A.line21
B.line23
C.line27
D.line29
第4题:
20. public float getSalary(Employee e) { 21. assert validEmployee(e); 22. float sal = lookupSalary(e); 23. assert (sal>0); 24. return sal; 25. } 26. private int getAge(Employee e) { 27. assert validEmployee(e); 28. int age = lookupAge(e); 29. assert (age>0); 30. return age; 31. } Which line is a violation of appropriate use of the assertion mechanism?()
第5题:
23.int z=5; 24. 25. public void stuff1(int x) { 26. assert (x> 0); 27. switch(x) { 28. case 2: x= 3; 29. default: assert false; } } 30. 31. private void stuff2(int y) { assert (y < 0); } 32. 33. private void stuff3() { assert (stuff4O); } 34. 35. private boolean stuff4() { z = 6; return false; } Which is true?()
第6题:
类testl定义如下: public class test1 { public float amethod(float a,float b){ } }
A.public foat amethod(float a,float b,foat c){ }
B.public float amethod(float c,float d){ }
C.public int amethod(int a,int b){ }
D.private float amethod(int a,int b,int c){ }
第7题:
Given: 1. public class Method Over { 2. public void set Var (int a, int b, float c) { 3. } 4. } Which two overload the set Var method()?
第8题:
A.All of the assert statements are used appropriately.
B.Only the assert statement on line 12 is used appropriately.
C.Only the assert statement on line 15 is used appropriately.
D.Only the assert statement on line 18 is used appropriately.
E.Only the assert statements on lines 12 and 15 are used appropriately.
F.Only the assert statements on lines 12 and 18 are used appropriately.
G.Only the assert statements on lines 15 and 18 are used appropriately.
第9题:
类Test1定义如下: 1.public class Test1{ 2. public float aMethod(float a,float b){ return 0;} 3. 4.} 将以下哪种方法插入行3是不合法的。()
第10题:
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?()