itgle.com

单选题33. Date d = new Date(0);  34. String ds = “December 15, 2004”;  35. // insert code here  36. try {  37. d = df.parse(ds);  38. }  39. catch(ParseException e) {  40. System.out.println(”Unable to parse “+ ds);  41. }  42. // insert code here too  Which

题目
单选题
33. Date d = new Date(0);  34. String ds = “December 15, 2004”;  35. // insert code here  36. try {  37. d = df.parse(ds);  38. }  39. catch(ParseException e) {  40. System.out.println(”Unable to parse “+ ds);  41. }  42. // insert code here too  Which will create the appropriate DateFormat object and add a day to the Date object?()
A

 35. DateFormat df= DateFormat.getDateFormat(); 42. d.setTime( (60 * 60 * 24) +d.getTime());

B

 35. DateFormat df= DateFormat.getDateJnstance(); 42. d.setTime( (1000 * 60 * 60 * 24) + d.getTime());

C

 35. DateFormat df= DateFormat.getDateFormat(); 42. d.setLocalTime( (1000*60*60*24) + d.getLocalTime());

D

 35. DateFormat df= DateFormat.getDateJnstance(); 42. d.setLocalTime( (60 * 60 * 24) + d.getLocalTime());


相似考题
更多“33. Date d = new Date(0);  34. String ds = “December 15, 200”相关问题
  • 第1题:

    Inthevideoform.theOrderDatefield(WhichshowsWhenthevideomaybeordered)iscalculatedbasedontheDatefield(Whichdisplaysthereleasedate).Theorderdateis30dayspriortothereleasedate.WhichonethefollowingformulaswillcalculatetheOrderDatevalue?()

    A.@Number(Date)-30

    B.@Adjust(Date;0;0;30;0;0;0)

    C.@Adjust(Date;0;0;-30;0;0;0)

    D.@If(Date!="";Date-30;@Failure(Thereisnocurrentreleasedate"))


    参考答案:C

  • 第2题:

    在下列程序的空白处,应填入的正确选项是( )。 Import java.io.*; Pulilc class ObjectStreamTest{ Publilc static void main(string args[])throws IOEx- ception{ OhiectOutputStream os=new OhjectOutputStream (new FileOutputStream("serial.bin")); Java.util.Date d=new Java.util.Date; Oos (d); ObjectInputStream is= new OhjectlnputStream(new FileOutputStream("serial. bin")); try{ java.util.date restoredDate= (Java.util.Date)ois.readObject; System.out.println ("read object back from serial.bin file:" +restoredDate); } Catch(ClassNotFoundException cnf){ System.out.println("class not found"); } }

    A.WriterObject

    B.Writer

    C.BufferedWriter

    D.writerObject


    正确答案:D
    D。【解析】本题考查的是输入/输出及文件操作,writerObject方法是向数据流中写入数据。

  • 第3题:

    下列方法中,用于返回当前日期的方法是?()

    A.Date()

    B. Date(int year, int month, int date)

    C.Date(String s)

    D.Date(long date)


    答案:A

  • 第4题:

    ( 11 )请在下列程序的空白处,填上适当的内容:

    Import java. awt. *;

    Import java. util. *;

    Class BufferTest{

    Public static void main(string args[])

    Throws IOException{

    FileOutputStream unbuf=

    new FileOutputStream( “ test.one ” ) ;

    BufferedOutputStream buf=

    new 【 11 】 (new FileOutputStream( “ test.two ” ));

    System.out.println

    ( “ write file unbuffered: ” + time(unbuf) + “ ms ” );

    System.out.println

    ( “ write file buffered: ” + time(buf) + “ ms ” );

    }

    Static int time (OutputStream os)

    Throws IOException{

    Date then = new Date();

    for (int i=0; i<50000; i++){

    os.write(1);

    }

    }

    os.close();

    return(int)(()new Date()).getTime() - then.getTime());

    }


    正确答案:

  • 第5题:

    产生当前日期的方法是()。

    • A、Now()
    • B、Date()
    • C、new Date()
    • D、new Now()

    正确答案:C

  • 第6题:

    Which SQL statement displays the date March 19, 2001 in a format that appears as "Nineteenth of March 2001 12:00:00 AM"?()

    • A、SELECT TO_CHAR(TO_DATE('19-Mar-2001', 'DD-Mon-YYYY'), 'fmDdspth "of" Month YYYY fmHH:MI:SS AM') NEW_DATE FROM dual;
    • B、SELECT TO_CHAR(TO_DATE('19-Mar-2001', 'DD-Mon-YYYY'), 'Ddspth "of" Month YYYY fmHH:MI:SS AM') NEW_DATE HH:MI:SS AM') NEW _ DATE FROM dual;
    • C、SELECT TO_CHAR(TO_DATE('19-Mar-2001', 'DD-Mon-YYYY'), 'fmDdspth "of" Month YYYY NEW _ DATE FROM dual;
    • D、SELECT TO_CHAR(TO_DATE('19-Mar-2001', 'DD-Mon-YYYY), 'fmDdspth "of" Month YYYYfmtHH:HI:SS AM')NEW_DATE FROM dual;

    正确答案:A

  • 第7题:

    Given: 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-2000.
    • 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

  • 第8题:

    单选题
    In the video form. the OrderDate field (Which shows When the video may be ordered)is calculated based on the Date field (Which displays the release date ). The order date is 30 days prior to  the release date. Which one the following formulas will calculate the OrderDate value?()
    A

    @Number(Date)-30       

    B

    @Adjust(Date;0;0;30;0;0;0) 

    C

    @Adjust(Date;0;0;-30;0;0;0) 

    D

    @If(Date!=;Date-30;@Failure(There is no current release date)) 


    正确答案: B
    解析: 暂无解析

  • 第9题:

    单选题
    在下列程序的空白处,应填入的正确选项是(  )。import java.io.*; public class ObjectStreamTest{ public static void main(string args[])throws IOException{ ObjectOutputStream oos=new ObjectOutputStream(new FileOutputStream("serial.bin")); Java.until.Date d=new Java.until.Date(); oos.______(); ObjectInputStream ois=new ObjectlnputStream(new FileOutputStream("serial.bin")); try{ java.until.date restoredDate=(Java.until.Date)ois.readObject(); System.out.println("read object back from serial.bin file:"+restoredDate); } catch(ClassNotFoundException cnf){ System.out.println("class not found"); } }
    A

    readObject

    B

    Writer

    C

    BufferedWriter

    D

    writeObject


    正确答案: A
    解析:
    java.io包中,提供了0bjectInputStream和ObjectOutputStream将数据流功能扩展至可读写对象。在ObjectInputStream中用readObject()方法可以直接读取一个对象,0bjectOutputStream中用writeObject()方法可以直接将对象保存到输出流中。B项和C项,Writer和BufferedWriter都为java.io包中的类。

  • 第10题:

    单选题
    33. Date d = new Date(0);  34. String ds = “December 15, 2004”;  35. // insert code here  36. try {  37. d = df.parse(ds);  38. }  39. catch(ParseException e) {  40. System.out.println(”Unable to parse “+ ds);  41. }  42. // insert code here too  Which will create the appropriate DateFormat object and add a day to the Date object?()
    A

     35. DateFormat df= DateFormat.getDateFormat(); 42. d.setTime( (60 * 60 * 24) +d.getTime());

    B

     35. DateFormat df= DateFormat.getDateJnstance(); 42. d.setTime( (1000 * 60 * 60 * 24) + d.getTime());

    C

     35. DateFormat df= DateFormat.getDateFormat(); 42. d.setLocalTime( (1000*60*60*24) + d.getLocalTime());

    D

     35. DateFormat df= DateFormat.getDateJnstance(); 42. d.setLocalTime( (60 * 60 * 24) + d.getLocalTime());


    正确答案: B
    解析: 暂无解析

  • 第11题:

    单选题
    以下哪个语句能正确弹出结果:()
    A

    alert(new Date(2011 , 12 , 25).getDay());

    B

    alert(new Date(2011 , 12 , 25 , 5).getDay());

    C

    alert(new Date(2011 , 12 , 25 , 5 , 5 , 9).getDay());

    D

    以上三个结果都正确


    正确答案: C
    解析: 暂无解析

  • 第12题:

    单选题
    Which SQL statement displays the date March 19, 2001 in a format that appears as "Nineteenth of March 2001 12:00:00 AM"? ()
    A

    SELECT TO_CHAR(TO_DATE('19-Mar-2001', 'DD-Mon-YYYY'), 'fmDdspth of Month YYYY fmHH:MI:SS AM') NEW_DATE FROM dual;

    B

    SELECT TO_CHAR(TO_DATE('19-Mar-2001', 'DD-Mon-YYYY'), 'Ddspth of Month YYYY fmHH:MI:SS AM') NEW_DATE HH:MI:SS AM') NEW _ DATE FROM dual;

    C

    SELECT TO_CHAR(TO_DATE('19-Mar-2001', 'DD-Mon-YYYY'), 'fmDdspth of Month YYYY NEW _ DATE FROM dual;

    D

    SELECT TO_CHAR(TO_DATE('19-Mar-2001', 'DD-Mon-YYYY), 'fmDdspth of Month YYYYfmtHH:HI:SS AM')NEW_DATE FROM dual;


    正确答案: B
    解析: 暂无解析

  • 第13题:

    下列程序将Date对象写入文件file42.txt中,选择正确的语句填入下列程序中的横线处。 package ch1; impbrt java. io. *; import java. util. *; public class ex42 { static String fileName = "ch1\\file42.txt"; static Date date = null; public static void main(String[] args) { date = new Date(); try { FileOutputStream fos = new FileOutputStream(file Name); ObjectOutStream os = new ObjectOutputStream(fos); oos.______; oos.close(); fos.close(); System.out.println(date.toString()); } catch(Exception e) { System.out.println(e.getMessage()); } } }

    A.writeObject()

    B.writeObject(date)

    C.write(date)

    D.writeByte(date)


    正确答案:B

  • 第14题:

    有以下程序: 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 = a.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 date 1 (2000,1,1),date2(0,0,0); Date date3(date 1); 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;时,系统用返回初始化一个匿名对象时使用了拷贝构造函数。

  • 第15题:

    以下可以获取系统当前日期的是( )

    A.var k = new Date( );

    B.Date k = new Date( )

    C.var k = new date( )

    D.以上说法均不对


    正确答案:A

  • 第16题:

    In the video form. the OrderDate field (Which shows When the video may be ordered)is calculated based on the Date field (Which displays the release date ). The order date is 30 days prior to  the release date. Which one the following formulas will calculate the OrderDate value?()

    • A、@Number(Date)-30       
    • B、@Adjust(Date;0;0;30;0;0;0) 
    • C、@Adjust(Date;0;0;-30;0;0;0) 
    • D、@If(Date!="";Date-30;@Failure(There is no current release date")) 

    正确答案:C

  • 第17题:

    14. DateFormat df;  15. Date date = new Date();  16. //insert code here  17. String s = df.format( date);  Which two,inserted independently at line 16, allow the code to compile?()

    • A、 df= new DateFormat();
    • B、 df= Date.getFormatter();
    • C、 df= date.getFormatter();
    • D、 df= date.getDateFormatter();
    • E、df = DateFormat.getDateInstance();
    • F、 df= DateFormat.getInstance();

    正确答案:E,F

  • 第18题:

    Which SQL statement displays the date March 19, 2001 in a format that appears as "Nineteenth of March 2001 12:00:00 AM"?()

    • A、SELECT TO_CHAR(TO_DATE('19-Mar-2001', 'DD-Mon-YYYY'), 'fmDdspth "of" Month YYYY fmHH:MI:SS AM') NEW_DATE FROM dual;
    • B、SELECT TO_CHAR(TO_DATE('19-Mar-2001', 'DD-Mon-YYYY'), 'Ddspth "of" Month YYYY fmHH:MI:SS AM') NEW_DATE FROM dual;
    • C、SELECT TO_CHAR(TO_DATE('19-Mar-2001', 'DD-Mon-YYYY'), 'fmDdspth "of" Month YYYY HH:MI:SS AM') NEW_DATE FROM dual;
    • D、SELECT TO_CHAR(TO_DATE('19-Mar-2001', 'DD-Mon-YYYY'), 'fmtDdspth "of" Month YYYY fmtHH:MI:SS AM') NEW_DATE FROM dual;

    正确答案:A

  • 第19题:

    Given a valid DateFormat object named df,and 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

  • 第20题:

    多选题
    14. DateFormat df;  15. Date date = new Date();  16. //insert code here  17. String s = df.format( date);  Which two,inserted independently at line 16, allow the code to compile?()
    A

    df= new DateFormat();

    B

    df= Date.getFormatter();

    C

    df= date.getFormatter();

    D

    df= date.getDateFormatter();

    E

    df = DateFormat.getDateInstance();

    F

    df= DateFormat.getInstance();


    正确答案: E,F
    解析: 暂无解析

  • 第21题:

    单选题
    Given: 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-2000.

    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.


    正确答案: C
    解析: 暂无解析

  • 第22题:

    单选题
    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.


    正确答案: B
    解析: 暂无解析

  • 第23题:

    单选题
    Given a valid DateFormat object named df,and 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) { };


    正确答案: D
    解析: 暂无解析

  • 第24题:

    单选题
    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) { };


    正确答案: D
    解析: 暂无解析