16. Date d =&ens

题目

16. Date d = new Date(0L);  17. String ds = “December 15, 2004”;  18. // insert code here  What updates d‟s value with the date represented by ds?()

  • A、 18. d = df.parse(ds);
  • B、 18. d = df.getDate(ds);
  • C、 18. try {     19. d = df.parse(ds);      20. } catch(ParseException e) { };
  • D、 18. try {      19. d = df.getDate(ds);       20. } catch(ParseException e) { };
参考答案和解析
正确答案:C
如果没有搜索结果或未解决您的问题,请直接 联系老师 获取答案。
相似问题和答案

第1题:

查询十天前的记录应使用()作为准则。A.Between Date() And Date()-10B.Date()-10D.B

查询十天前的记录应使用( )作为准则。

A.Between Date() And Date()-10

B.<Date()-10

C.>Date()-10

D.Between Date()-10 And Date()


正确答案:B

第2题:

Youarecreatinganonlinecatalogapplicationthat&ens

YouarecreatinganonlinecatalogapplicationthatwilldisplayproductinformationonthecompanyWebsite.TheproductdataisstoredinaSQLServer2005database.ThedataisstoredasrelationaldatabutmustbepassedtotheapplicationasanXMLdocumentbyusingFORXML.YoutestyourapplicationandnoticethatnotalloftheitemsmatchingyourqueryappearintheXMLdocument.Onlythoseproductsthathavevaluesforallelementsintheschemaappear.

YouneedtomodifyyourTransact-SQLstatementsothatallproductsmatchingyourqueryappearintheXMLdocument.

Whatshouldyoudo?()


参考答案:B

第3题:

The liability for a dividend is recorded on which of the following dates?()

A、the date of record

B、the date of payment

C、the date of announcement

D、the date of declaration


正确答案:D

第4题:

有以下程序: class Date { public: Date(int y,int m,int D) ; { year =y; month=m; day=d; } Date(int y=2000) { year=y; month=10; day=1; } Date(Date &D) { year=d.year; month=d.month; day=d.day; } void print () { cout<<year<<"."<<month<<"."<<day<<end1; } private: int year,month,day; }; Date fun(Date D) { Date temp; temp=d; return temp; } int main() { Date date1(2000,1,1),date2(0,0,0); Date date3(date1); date2=fun(date3); return 0; } 程序执行时,Date类的拷贝构造函数被调用的次数是

A.2

B.3

C.4

D.5


正确答案:B
解析:本题考核拷贝构造函数。上述程序中,拷贝构造函数一共被调用了3次:第一次是在执行语句Datedate3(date1);时,用已经建立的对象date1对正在建立的对象date3进行初始化:第二次是在调用fun函数时,由于是传值调用,因此实参对象date3要对形参对象d进行初始化;第三次是在执行fun函数中的返回语句returntemp;时,系统用返回初始化一个匿名对象时使用了拷贝构造函数。

第5题:

Examine the description of the STUDENTS table:Which two aggregate functions are valid on the START_DATE column?()

A. SUM(start_date)

B. AVG(start_date)

C. COUNT(start_date)

D. AVG(start_date, end_date)

E. MIN(start_date)

F. MAXIMUM(start_date)


参考答案:C, E

第6题:

有以下程序:

class Date

{

public:

Date(int y,int m,int d);

{

year=y;

month=m

day=d;

}

Date(int y=2000)

{

year=y;

month=10;

day=1;

}

Date(Date &d)

{

year=d.year;

month=d.month;

day=d.day;

}

void print( )

{

cout<<year<<"."<<month<<"."<<day<<endl;

}

private:

int year,month,day;

};

Date fun(Date d)

{

Date temp;

temp=d;

return temp;

}

int main( )

{

Date datel(2000,1,1),date2(0,0,0);

Date date3(datel);

date2=fun(date3);

return 0;

}

程序执行时,Date类的拷贝构造函数被调用的次数是

A.2

B.3

C.4

D.5


正确答案:B
解析:本题考核拷贝构造函数。上述程序中,拷贝构造函数一共被调用了3次:第一次是在执行语句Date dare3(datel);时,用已经建立的对象datel对正在建立的对象date3进行初始化;第二次是在调用fun函数时,由于是传值调用,因此实参对象date3要对形参对象d进行初始化;第三次是在执行fun函数中的返回语句return temp;时,系统初始化一个匿名对象时使用了拷贝构造函数。

第7题:

DateFormatdf;15.Datedate=newDate();16.//insertcodehere17.Strings=df.format(date);Whichtwo,insertedindependentlyatline16,allowthecodetocompile?()

A.df=newDateFormat();

B.df=Date.getFormatter();

C.df=date.getFormatter();

D.df=date.getDateFormatter();

E.df=DateFormat.getDateInstance();

F.df=DateFormat.getInstance();


参考答案:E, F

第8题:

查询最近30天的记录应使用( )作为准则。

A.Between Date()And Date()-30

B.Between Date()-30 And Date()

C.<=Date()-30

D.<Date()-30


正确答案:B
解析: 本题考查查询准则的知识。获得当前日期可以使用系统函数Date(),而当前日期的30天前就是日期Date()-30。最近30天内的记录,也就是日期在这个区间内的记录,使用关键字Between…And…来表示在区间内,注意先写下限后写上限。

第9题:

查询十天前的记录应使用( )作为准则。

A.Between Date( )And Date( )-10

B.<Date( )-10

C.>Date( )-10

D.Between Date( )-10 And Date( )


正确答案:B

第10题:

设有如下变量声明: Dim Test Date AS Date 为变量Test Date正确赋值的表达式是( )。

A.Test Date=#1/1/2002#

B.TestDate#"1/1/2002"#

C.Test Date=date("1/1/2002")

D.Test Date=Format("m/d/yy","1/1/2002")


正确答案:A
解析:本题考查日期型数据的用法,题目难度较小。解答本题首先应该注意日期型数据单独存在时前后需要用#号,选项B书写错误: Date函数不能带参数,选项C错误;Format函数可以将字符串数据转换为日期形式,但是该函数的格式是:Format(expressionLformat]- Lfirstofweek[,firstweekofye盯)D,即选项D中两个参数的顺序出现错误。答案为A。

更多相关问题