1. class A {&ens

题目

1. class A {  2. public byte file Number ( ) { 3. return l;  4. }  5. }  6.  7. Class B extends A {  8. public short getNumber( ) {  9.  return 2;  10. }  11.  12. public short getNumber( ) {  13. B b = new B( );  14. System.out.printIn(b.getNumber( ));  15. }  16. }   What is the result()?  

  • A、 Compilation succeeds and l is printed.
  • B、 Compilation succeeds and 2 printed.
  • C、 An error at line 8 cause compilation to fail.
  • D、 An error at line 14 cause complication to fail.
  • E、 Complication succeeds but an exception is thrown at line 14.
参考答案和解析
正确答案:C
如果没有搜索结果或未解决您的问题,请直接 联系老师 获取答案。
相似问题和答案

第1题:

下面程序输出的结果为

#include"iostream.h"

class A

{

public:

A( ){cout<<"CLASS A"<<endl;}

~A( ){}

};

class B:public A

{

public:

B( ){cout<<"CLASS B"<<endl;}

~B( ){}

};

void main( )

{

A*p;

p=new B;

B *q;

q=new B;

}

A.CLASS A CLASS B

B.CLASS A CLASS B CLASS B

C.CLASS A CLASS B CLASS A CLASS B

D.CLASS A CLASS B CLASS B CLASS B


正确答案:C
解析:每实例化一个类就要调用其构造函数,结束运行该实例后调用析构函数。注意:类的实例化和构造函数、析构函数的调用方式和何时调用。

第2题:

下面程序输出的结果为( )。 #inClUde”iostream.h” Class A {public: A(){cout<<“CLASS A”<<endl;} ~A()<)}; class B:public A {public: B(){cout<<”CLASSB”<<endl;} ~B(){}}; void main() {A*p; p=new B; B *q; q=new B;}

A.CLASS A CLASS B

B.CLASS A CLASS B CLASS B

C.CLASS A ClASS B

D.CLASS A CLASS B CLASS A CLASS B CLASS B CLASS B


正确答案:C
解析: 本题考查类的继承、类的实例化和构造函数、析构函数的调用方式和何时调用。每实例化一个类就要调用其构造函数,结束运行该实例后调用析构函数。

第3题:

1. Everyone in our class ________ .

A. like singing

B. likes play football

C. like watch TV

D. likes playing games


正确答案:D
1.D【解析】主语是everyone按单数对待,所以 A、C不符合题意,like doing sth.表示“喜欢做某事”,是固定结构.

第4题:

1. public class Target {  2. private int i = 0;  3. public int addOne() {  4. return ++i;  5. }  6. }  And:  1. public class Client {  2. public static void main(String[] args) {  3. System.out.println(new Target().addOne());  4. }  5. }  Which change can you make to Target without affecting Client?() 

  • A、 Line 4 of class Target can be changed to return i++;
  • B、 Line 2 of class Target can be changed to private int i = 1;
  • C、 Line 3 of class Target can be changed to private int addOne() {
  • D、 Line 2 of class Target can be changed to private Integer i = 0;

正确答案:D

第5题:

Alloftheclientcomputersinyourcompany’s&ens

Alloftheclientcomputersinyourcompany’snetworkareWindows2000portablecomputers.AusernamedMariastoresSalesfilesinherMyDocumentsfolder.Sheusesthesefileswhenshetravels.

Mariainformsyouthatwhenshetakesherportablecomputertotradeshows,shecanaccesssomeoftheSalesfilesbutnotallofthem.Whenherportablecomputerisconnectedtothenetworkattheoffice,shecanaccessallofthefiles.YouneedtoenableMariatoaccessallofthefilesinherMyDocumentsfolderwhensheisworkingremotely.

Whatshouldyoudo?()


参考答案:C

TogiveMariaaccesstothefileswhensheisworkingremotely,thefolderneedstobeenabledforofflineaccessandmustbeconfiguredtomaketheentirecontentsofthefolderavailableoffline.

第6题:

下面程序输出的结果为 #include"iostream.h” class A { public: A(){cout<<"CLASSA"<<endl;} ~A() {} }; class B:public A { public: B(){cout<<"CLASS B"<<endl;} ~B(){} }; void main() { A*p; p=new B;

A.CLASS A CLASS B CLASS B CLASS B

B.CLASS A CLASS B CLASS A CLASS B

C.CLASS A CLASS B CLASS B

D.CLASS A CLASS B


正确答案:C

第7题:

YouareaExamSheetInc.consultantwhousesa&ens

YouareaExamSheetInc.consultantwhousesaWindows2000Professionalportablecomputer.YourdomainuseraccountisamemberofthelocalAdministratorgroup.

Fromyourportablecomputer,youmapadrivetoasharedfoldernamedConsultMerticsona

computernamedServer1.YouconfigureConsultMerticstobeavailableoffline.Whenyoulogoftheportablecomputer,youreceivethefollowingerrormessage.

Youneedtosuccessfullysynchronizetheofflinefiles.Whatshouldyoudo?()


参考答案:D

第8题:

Youarecreatinganonlinecatalogapplicationthat&ens

YouarecreatinganonlinecatalogapplicationthatwilldisplayproductinformationonthecompanyWebsite.TheproductdataisstoredinaSQLServer2005database.ThedataisstoredasrelationaldatabutmustbepassedtotheapplicationasanXMLdocumentbyusingFORXML.YoutestyourapplicationandnoticethatnotalloftheitemsmatchingyourqueryappearintheXMLdocument.Onlythoseproductsthathavevaluesforallelementsintheschemaappear.

YouneedtomodifyyourTransact-SQLstatementsothatallproductsmatchingyourqueryappearintheXMLdocument.

Whatshouldyoudo?()


参考答案:B

第9题:

YouareaWindowsServer2008systemsadministrator&ens

YouareaWindowsServer2008systemsadministratorresponsibleforprovidingaccesstoalargevolumeofvideofilestoregisteredusersofyourorganization??spublicWebsite.Allthevideofilesarelocated withintheD:\Public\Videosfolder.Contentproducersoftencreateandmodifythesevideos.Recently,usershavecomplainedthattheyareexperiencingpoorperformancewhenaccessingvideosduringbusytimes.Duringtheseimages,theWindowsMediaServicesserverthathoststhecontentisexperiencinghighCPUandnetworkbandwidthuse.Youwanttominimizetheadministrativetimeandeffortrequiredtoincreaseperformance.

Whichofthefollowingactionsshouldyoutaketoresolvetheproblem?()


参考答案:B

第10题:

1. public interface A {  2. public void doSomething(String thing);  3. }  1. public class AImpl implements A {  2. public void doSomething(String msg) { }  3. }  1. public class B {  2. public A doit() {  3. // more code here  4. }  5.  6. public String execute() { 7. // more code here  8. }  9. }  1. public class C extends B {  2. public AImpl doit() {  3. // more code here  4. }  5.  6. public Object execute() {  7. // more code here  8. }  9. }  Which statement is true about the classes and interfaces in the exhibit?() 

  • A、 Compilation will succeed for all classes and interfaces.
  • B、 Compilation of class C will fail because of an error in line 2.
  • C、 Compilation of class C will fail because of an error in line 6.
  • D、 Compilation of class AImpl will fail because of an error in line 2.

正确答案:C

更多相关问题