Java认证考试

12. Date date = new Date();  13. df.setLocale(Locale.ITALY);  14. String s = df.format(date);  The variable df is an object of type DateFormat that has been initialized in line 11. What is the result if this code is run on December 14, 2000?() A、 The val

题目

12. Date date = new Date();  13. df.setLocale(Locale.ITALY);  14. String s = df.format(date);  The variable df is an object of type DateFormat that has been initialized in line 11. What is the result if this code is run on December 14, 2000?() 

  • A、 The value of s is 14-dic-2004.
  • B、 The value of s is Dec 14, 2000.
  • C、 An exception is thrown at runtime.
  • D、 Compilation fails because of an error in line 13.
参考答案和解析
正确答案:D
如果没有搜索结果,请直接 联系老师 获取答案。
相似问题和答案

第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题:

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

第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题:

设有如下变量声明: 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。

第5题:

有以下程序: 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;时,系统用返回初始化一个匿名对象时使用了拷贝构造函数。

第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题:

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

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

B.<Date( )-10

C.>Date( )-10

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


正确答案:B

第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题:

在VFP的命令窗口中进行日期的设置,要求以MM-DD-YY形式显示日期“11-15- 05”,应使用命令(57)。

A.SET DATE TO MDY ? DATE()&&显示"11-15-05"

B.SET DATE TO MDY DATE( )&& ,显示" 11 - 15 -05"

C.SET DATE TO MDY ? DATE( )显示" 11 - 15 -05"

D.SET DATE TO MDY ? DATE( )显示" 11 - 15 - 05"


正确答案:A
解析:注意实现该命令的语法。

第10题:

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

A. Between Date(1 And Date0—30

B. Between Date一30 And Date

C. <=Date-30

D. <Date0-30


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

更多相关问题