更多“methodA(byte x,double y){return (short)x/y*2;}下划线上应填写的关键字是( )。A、byteB、doubleC、shortD、float”相关问题
  • 第1题:

    下列函数值的类型是( )。 fun(double x) { float y; y=3*x-4; return y; }

    A.int

    B.不确定

    C.void

    D.float


    正确答案:A
    解析:本题考查默认函数的函数值的类型。在函数调用时,尽管y的类型是float,x的类型是double,但是因为函数定义时省去类型说明,系统默认函数值的类型为int型,所以计算后的y的类型是int型。

  • 第2题:

    自动类型转换规定的优先次序是( )。

    A.short,byte,char→long→int→float→double

    B.short,byte,char→int→long―float→double

    C.byte,short,char→long→int→float→double

    D.byte,short,char→int→long→float→double


    正确答案:D

  • 第3题:

    自动类型转换是按优先关系从低级数据转换成高级数据,规定的优先次序是( )。

    A.byte,short,char→int→long→float→double

    B.float→int→long→byte,short,char→double

    C.int→long→float→double←byte,short,char

    D.double→int→folat→long→byte,short,char


    正确答案:A

  • 第4题:

    以下代码中变量result的可能类型有哪些?byte b = 11;short s = 13;result = b * ++s;

    A.byte, short, int, long, float, double

    B.boolean, byte, short, char, int, long, float, double

    C.byte, short, char, int, long, float, double

    D.byte, short, char

    E.int, long, float, double


    正确答案:E
     

  • 第5题:

    有以下方法的定义,请选择该方法的返回类型()。ReturnType method(bytex,doubley){return(short)x/y*2;}

    • A、byte
    • B、short
    • C、int
    • D、double

    正确答案:D

  • 第6题:

    有以下方法的定义,请选择该方法的返回类型()。 ReturnType  method(byte x, double y){ return  (short)x/y*2;}

    • A、byte
    • B、short
    • C、int
    • D、double

    正确答案:D

  • 第7题:

    如果定义有double,x;float,y;int,m,则表达式x*y-m的类型为()

    • A、double
    • B、float
    • C、int
    • D、short

    正确答案:A

  • 第8题:

    1. public class returnIt (  2. returnType methodA(byte x, double y) (  3. return (short) x/y * 2;  4. )  5. )   What is the valid returnType for methodA in line 2?()  

    • A、 Int
    • B、 Byte
    • C、 Long
    • D、 Short
    • E、 Float
    • F、 Double

    正确答案:F

  • 第9题:

    public class returnIt (    returnType methodA(byte x, double y) (   return (short) x/y * 2;   )  )   What is the valid returnType for methodA in line 2?()

    • A、 Int
    • B、 Byte
    • C、 Long
    • D、 Short
    • E、 Float
    • F、 Double

    正确答案:F

  • 第10题:

    单选题
    1. public class returnIt (  2. returnType methodA(byte x, double y) (  3. return (short) x/y * 2;  4. )  5. )   What is the valid returnType for methodA in line 2?()
    A

     Int

    B

     Byte

    C

     Long

    D

     Short

    E

     Float

    F

     Double


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

  • 第11题:

    单选题
    1. public class ReturnIt {  2. return Type methodA(byte x, double y) {  3. return (short)x / y * 2;  4. }  5. }  What is the narrowest valid returnType for methodA in line2?()
    A

     int

    B

     byte

    C

     long

    D

     short

    E

     float

    F

     double


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

  • 第12题:

    单选题
    public class returnIt (    returnType methodA(byte x, double y) (   return (short) x/y * 2;   )  )   What is the valid returnType for methodA in line 2?()
    A

     Int

    B

     Byte

    C

     Long

    D

     Short

    E

     Float

    F

     Double


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

  • 第13题:

    下列函数的类型是( )。

    fun(double x) { float y;y=3*x-4;return y; }

    A.int

    B.不确定

    C.void

    D.float


    正确答案:A
    本题考查函数值的类型。在函数调用时,尽管Y的类型是float.x的类型是double,但是因为函数定义时没有指定类型说明,系统默认函数值的类型为int型,所以计算后Y的类型是int型。

  • 第14题:

    在同一可访问区内有如下8个函数:

    ①double calculate(double x)

    ②double calculate(double x, double y);

    ③double calculate(double x. int y);

    ④double calculate(int x, double y);

    ⑤double calculate(int x);

    ⑥float calculate(float x);

    ⑦float calculate(double x);

    ⑧float calculate(int x,double y)。

    那么关于函数重载的说法中,不正确的是(63)。

    A.②③④⑤中任两个函数均构成重载

    B.①③构成重载

    C.②⑧肯定构成重载,⑥⑦也肯定构成重载

    D.④⑧构成重载


    正确答案:D
    解析:“overload”翻译过来就是:超载,或过载,或重载,即超出标准负荷。在日常生活中我们经常要清洗一些东西,比如洗车、洗衣服。尽管我们说话的时候并没有明确地说用洗车的方式来洗车,或者用洗衣服的方式来洗一件衣服,但是谁也不会用洗衣服的方式来洗一辆车,否则等洗完时车早就散架了。我们并不要那么明确地指出来就心知肚明,这就有重载的意思了。对于同一可访问区内被声明的几个具有不同参数列的(参数的类型、个数、顺序不同)同名函数,程序会根据不同的参数列来确定具体调用哪个函数,这种机制叫重载。重载不关心函数的返回值类型。

  • 第15题:

    假设有函数模板定义如下,下列各选项中正确的是( )。 Template T Max(T a,T b,T

    假设有函数模板定义如下,下列各选项中正确的是( )。 Template <class T> T Max(T a,T b,T c) { if(a<b) {if(b<c) return c; else return b;} else {if(a<c) return c; else return a;} }

    A.float x,y,z;float max;max=Max(x,y,z);

    B.float x;int y,z;float max;max=Max(x,y,z);

    C.float x;double y,z;float max;max=Max(x,y,z);

    D.三个选项都正确


    正确答案:A
    解析:使用函数模板,要求形参必须为相同类型。

  • 第16题:

    (12)有以下程序,请在 【12】 处填写正确语句,使程序可正常编译运行。

    #include <stdio.h>

    【12】 ;

    main()

    { double x,y,(*p)();

    scanf("%lf%lf",&x,&y);

    p=avg;

    printf("%f\n",(*p)(x,y));

    }

    double avg(double a,double b)

    { return((a+b)/2);}


    正确答案:
    (12)double avg(double a,double b);

  • 第17题:

    1. public class ReturnIt {  2. return Type methodA(byte x, double y) {  3. return (long)x / y * 2;  4. }  5. }  What is the narrowest valid returnType for methodA in line2?()  

    • A、 int
    • B、 byte
    • C、 long
    • D、 short
    • E、 float
    • F、 double

    正确答案:F

  • 第18题:

    ______methodA(bytex,doubley){?return(short)x/y*2;?}下划线上应填写的关键字是()

    • A、byte
    • B、double
    • C、short
    • D、float

    正确答案:B

  • 第19题:

    有以下方法的定义,ReturnTypemethod(bytex,floaty){return(short)x/y*2;}请选择该方法的返回类型()。

    • A、byte
    • B、short
    • C、int
    • D、float

    正确答案:B

  • 第20题:

    1. public class ReturnIt {  2. return Type methodA(byte x, double y) {  3. return (short)x / y * 2;  4. }  5. }  What is the narrowest valid returnType for methodA in line2?()  

    • A、 int
    • B、 byte
    • C、 long
    • D、 short
    • E、 float
    • F、 double

    正确答案:F

  • 第21题:

    单选题
    ______methodA(bytex,doubley){?return(short)x/y*2;?}下划线上应填写的关键字是()
    A

    byte

    B

    double

    C

    short

    D

    float


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

  • 第22题:

    单选题
    有以下方法的定义,请选择该方法的返回类型()。 ReturnType  method(byte x, double y){ return  (short)x/y*2;}
    A

    byte

    B

    short

    C

    int

    D

    double


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

  • 第23题:

    单选题
    1. public class ReturnIt {  2. return Type methodA(byte x, double y) {  3. return (long)x / y * 2;  4. }  5. }  What is the narrowest valid returnType for methodA in line2?()
    A

     int

    B

     byte

    C

     long

    D

     short

    E

     float

    F

     double


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