委托类型DG1的定义为delegate float DG1(int a,ref double b);那么下列委托对象的创建表达式中合法的有:()。A、DG 1dg1=delegate {return 0.3;};B、DG 1dg2=delegate {return a;};C、DG 1dg3=delegate (int a,ref double b) {return a;};D、DG 1dg4=delegate (int a,ref double b) {return a/b;

题目

委托类型DG1的定义为delegate float DG1(int a,ref double b);那么下列委托对象的创建表达式中合法的有:()。

  • A、DG  1dg1=delegate {return  0.3;};
  • B、DG  1dg2=delegate {return  a;};
  • C、DG  1dg3=delegate (int  a,ref  double  b) {return  a;};
  • D、DG  1dg4=delegate (int  a,ref  double  b) {return  a/b;};

相似考题
更多“委托类型DG1的定义为delegate float DG1(int a,ref double b);那么下列委托对象的创建表达式中合法的有:()。A、DG 1dg1=delegate {return 0.3;};B、DG 1dg2=delegate {return a;};C、DG 1dg3=delegate (int a,ref double b) {return a;};D、DG 1dg4=delegate (int a,ref double b) {return a/b;};”相关问题
  • 第1题:

    若主调用函数类型为double,被调用函数定义中没有进行函数类型说明,而return语句中的表达式类型为float型,则被调函数返回值的类型是()。

    A.int型

    B.float型

    C.double型

    D.由系统当时的情况而定


    正确答案:A

  • 第2题:

    分析以下程序执行结果【】。 include int f (int x, int y){return x,y; } double f (d

    分析以下程序执行结果【 】。

    include<iostream.h>

    int f (int x, int y){

    return x,y;

    }

    double f (double x, double y) {

    return x,y;

    }

    void main() {

    int a=4, b=6;

    double c=2.6, d=7.4;

    cout<<f (a, b) <<","<<f (c, d) <<end1;

    }


    正确答案:24 19.24
    24, 19.24

  • 第3题:

    下列程序运行后的输出结果是( )。

    #include

    using namespace std;

    int fun(int x) { return x*x; }

    double fun(double x,int y=2) { return x*y; }

    int main()

    {

    int a=5;

    double b= 1.2;

    cout

    }

    A. 27.4

    B.26.44

    C. 12.4

    D.程序有误


    参考答案:A

  • 第4题:

    下列程序的输出结果是【】include using namespace std; int main() { int num=500; int

    下列程序的输出结果是【 】

    include<iostream>

    using namespace std;

    int main()

    {

    int num=500;

    int &ref=num;

    ref +=100;

    cout<<num<<end1;

    return 0;

    }


    正确答案:600
    600 解析:考核引用的使用。题中整型变量ref定义为num的引用,所以对ref的作用等同于对num的作用,所以ref加上100后, num的值也就变成了600。

  • 第5题:

    在下列方法的定义中,正确的是 ( )

    A.public double x(){..;return false;}

    B.public static int x(double y){...}

    C.void x(doubled){...;return d}

    D.public static x(double a){..}


    正确答案:D

  • 第6题:

    有下列程序: int funl(double a){return a*=a;) int fun2(double x,double y) { double a=0,b=0; a=funl(x);b=funl(y);return(int)(a+h); } main {double w;w=fun2(1.1,2.0),……) 程序执行后变量w中的值是( )。

    A.5.21

    B.5

    C.5.0

    D.0.0


    正确答案:C
    子函数fun1(doublea)的功能是返回a的平方值的整数部分。子函数fun2(doublex,doubley)的功能是返回X的平方值的整数部分与Y的平方值的整数部分的和。又因为题中变量w的定义为double型,函数fun(2)的定义为int型,按照各类数值型数据间的混合运算,整型数据被转换为实型数据。所以双精度型变量w的值为5.0。

  • 第7题:

    声明一个委托类型public delegate int myCallBack(int x); 则以下语句可以和委托myCallBack绑定的方法是()

    • A、 void myCallBack(int x)
    • B、 int receive(int num)
    • C、 string receive(int x)
    • D、 不确定的

    正确答案:B

  • 第8题:

    You work as an application developer at Certkiller .com. You have been given the responsibility of creating a class named CalcSalary that will determine the salaries of Certkiller .com’s staff. The CalcSalary class includes methods to increment and decrement staff salaries. The following code is included in the CalcSalary class: public class CalcSalary { // for promotions public static bool IncrementSalary (Employee Emp, double Amount) { if (Emp.Status == QuarterlyReview.AboveGoals) Emp.Salary += Amount; return true; } else return false; } //for demotions public static bool DecrementSalary (Employee Emp, double Amount) { if (Emp.Status == QuarterlyReview.AboveGoals) Emp.Salary -= Amount; return true; } else return false; } } You would like to invoke the IncrementSalary and DecrementSalary methods dynamically at runtime from the sales manager application, and decide to create a delegate named SalaryDelegate to invoke them. You need to ensure that you use the appropriate code to declare the SalaryDelegate delegate.What is the correct line of code?()

    • A、 public delegate bool Salary (Employee Emp, double Amount);
    • B、 public bool Salary (Employee Emp, double Amount);
    • C、 public event bool Salary (Employee Emp, double Amount);
    • D、 public delegate void Salary (Employee Emp, double Amount);

    正确答案:A

  • 第9题:

    您已创建一个名为 CalcSalary,将确定 Certkiller.com 员工的薪酬类的责任。CalcSalary 类包括员工的薪酬递增和递减的方法。下面的代码包含在 CalcSalary 类中:()public class CalcSalary {// for promotionspublic static bool IncrementSalary (Employee Emp, double Amount){if (Emp.Status == QuarterlyReview.AboveGoals)Emp.Salary += Amount;return true;

    • A、public delegate bool Salary (Employee Emp, double Amount);
    • B、public bool Salary (Employee Emp, double Amount);
    • C、public event bool Salary (Employee Emp, double Amount);
    • D、public delegate void Salary (Employee Emp, double Amount);

    正确答案:A

  • 第10题:

    单选题
    您需要写一个接收日期参数的多播委托,您应该使用哪一个代码片段() //委托就是一个方法,题目没有返回值。
    A

    public delegate int PowerDeviceOn(bool result, DateTime autoPowerOff);

    B

    public delegate bool PowerDeviceOn(object sender, EventArgs autoPowerOff);

    C

    public delegate void PowerDeviceOn(DateTime autoPowerOff);

    D

    public delegate bool PowerDeviceOn(DateTime autoPowerOff);


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

  • 第11题:

    单选题
    有以下程序 int fun1(double a) { return a*=a; } int fun2(double x,double y) { double a=0,b=0; a=fun1(x); b=fun1(y); return(int)(a+b); } main() { double w; w=fun2(1.1,2.0); } 程序执行后变量w中的值是()
    A

    5.21

    B

    5

    C

    5.0

    D

    0.0


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

  • 第12题:

    单选题
    您需要编写可接受日期时间参数并返回一个布尔值,多路广播的委托。您应该使用哪个代码段?()
    A

    public delegate int PowerDeviceOn(bool, DateTime);

    B

    public delegate bool PowerDeviceOn(Object, EventArgs);

    C

    public delegate void PowerDeviceOn(DateTime);

    D

    public delegate bool PowerDeviceOn(DateTime);


    正确答案: B
    解析: delegate关键字用于声明一个引用类型,该引用类型可用于封装命名方法或匿名方法。委托类似于C++中的函数指针;但是,委托是类型安全和可靠的。

  • 第13题:

    您需要编写可接受日期时间参数并返回一个布尔值,多路广播的委托。您应该使用哪个代码段?()

    A.public delegate int PowerDeviceOn(bool, DateTime);

    B.public delegate bool PowerDeviceOn(Object, EventArgs);

    C.public delegate void PowerDeviceOn(DateTime);

    D.public delegate bool PowerDeviceOn(DateTime);


    参考答案:D
    delegate关键字用于声明一个引用类型,该引用类型可用于封装命名方法或匿名方法。委托类似于C++中的函数指针;但是,委托是类型安全和可靠的。

  • 第14题:

    有下列程序: int funl(double a){return a*=a;} int fun2(double x,double y) {double a=0,b=0; a=funl(x);b=funl(y);return(int)(a+b); } main( ) {double w;w=fun2(1.1,2.0),……} 程序执行后变量w中的值是( )。 、

    A.5.21

    B.5

    C.5.0

    D.0.0


    正确答案:C
    子函数funl(doublea)的功能是返回a的平方值的整数部分。子函数fun2(doubleX,doubley)的功能是返回X的平方值的整数部分与Y的平方值的整数部分的和。又因为题中变量W的定义为double型,函数fun(2)的定义为int型,按照各类数值型数据间的混合运算,整型数据被转换为实型数据。所以双精度型变量w的值为5.0。

  • 第15题:

    已知:double A(double A) {return++a;}和int A(in A) {return++a;}是一个函数模板的两个实例,则该函数模板定义为【 】


    正确答案:templatetypename T> TA(TA) {return a++)
    templatetypename T> TA(TA) {return a++,) 解析:本题考核函数模板的定义。通过两个实例知道该例中只有一种数据类型,所以在定义模板时只需定义一个模板参数T。

  • 第16题:

    有以下程序:int fun1 (double a){ return a * =a;}int fun2 ( double x, double y ){ double a=0,b=0; a = fun1 (x) ;b = fun1 (y); return(int) (a + b);} main() { doublew;w=fun2(1.1,2.0);……} 程序执行后变量w中的值是( )。

    A.5.21

    B.5

    C.5

    D.0


    正确答案:C
    解析:程序调用函数fun2时,通过fun2调用函数fun1,第一次调用fun1返回的值为1,然后将1赋值给a,由于a为double型,系统自动将1转换为1.000000赋给变量a,以此类推可得b的值为4.000000;然后通过return(int)(a+b);将a+b的值强制转换为int型返给主函数,由于w为double型,所以返回的整型值5被转换为double型,故输出结果为5.0。

  • 第17题:

    有以下程序; int f1(double A) { return a*a; } int f2(double x,double y) { double a, b; a=n(x); b=f1(y); return a+b; } main() { double w; w=f2(1.1,2.0); ┇ } 变量w中的值是( )

    A.5.21

    B.5

    C.5

    D.0


    正确答案:C

  • 第18题:

    下列方法定义中,正确的是( )。

    A.int x(int a,b)

    B.double x(int a,int b) {return(a-b);){int w:w=a-b:}

    C.double x(a,b)

    D.int x (int a,int b) {return b}{return a-b;}


    正确答案:D

  • 第19题:

    You need to write a multicast delegate that accepts a DateTime argument.Which code segment should you use?()

    • A、public delegate int PowerDeviceOn(bool result,DateTime autoPowerOff);
    • B、public delegate bool PowerDeviceOn(object sender,EventArgs autoPowerOff);
    • C、public delegate void PowerDeviceOn(DateTime autoPowerOff);
    • D、public delegate bool PowerDeviceOn(DateTime autoPowerOff);

    正确答案:C

  • 第20题:

    您需要编写可接受日期时间参数并返回一个布尔值,多路广播的委托。您应该使用哪个代码段?()

    • A、public delegate int PowerDeviceOn(bool, DateTime);
    • B、public delegate bool PowerDeviceOn(Object, EventArgs);
    • C、public delegate void PowerDeviceOn(DateTime);
    • D、public delegate bool PowerDeviceOn(DateTime);

    正确答案:D

  • 第21题:

    单选题
    您已创建一个名为 CalcSalary,将确定 Certkiller.com 员工的薪酬类的责任。CalcSalary 类包括员工的薪酬递增和递减的方法。下面的代码包含在 CalcSalary 类中:()public class CalcSalary {// for promotionspublic static bool IncrementSalary (Employee Emp, double Amount){if (Emp.Status == QuarterlyReview.AboveGoals)Emp.Salary += Amount;return true;
    A

    public delegate bool Salary (Employee Emp, double Amount);

    B

    public bool Salary (Employee Emp, double Amount);

    C

    public event bool Salary (Employee Emp, double Amount);

    D

    public delegate void Salary (Employee Emp, double Amount);


    正确答案: D
    解析: status 意思 是“状态”。
    你可以用 变量 status 表示 某种状态。
    例如:
    成功,失败
    真,假 1,2,3,4,
    .. 状态1,状态2,状态3,状态4,....

  • 第22题:

    单选题
    You need to write a multicast delegate that accepts a DateTime argument.Which code segment should you use?()
    A

    public delegate int PowerDeviceOn(bool result,DateTime autoPowerOff);

    B

    public delegate bool PowerDeviceOn(object sender,EventArgs autoPowerOff);

    C

    public delegate void PowerDeviceOn(DateTime autoPowerOff);

    D

    public delegate bool PowerDeviceOn(DateTime autoPowerOff);


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

  • 第23题:

    单选题
    委托类型DG1的定义为delegate float DG1(int a,ref double b);那么下列委托对象的创建表达式中合法的有:()。
    A

    DG  1dg1=delegate {return  0.3;};

    B

    DG  1dg2=delegate {return  a;};

    C

    DG  1dg3=delegate (int  a,ref  double  b) {return  a;};

    D

    DG  1dg4=delegate (int  a,ref  double  b) {return  a/b;};


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