在C#中下列表达式不正确的是()。A、double a,double b=2,int c=3,a=b+cB、short a,byte b=2,byte c=3,a=b+cC、string a,string b=”1” string c=”2” a=b+cD、bool a,bool b=true,bool c=false a=b==c

题目

在C#中下列表达式不正确的是()。

  • A、double a,double b=2,int c=3,a=b+c
  • B、short a,byte b=2,byte c=3,a=b+c
  • C、string a,string b=”1” string c=”2” a=b+c
  • D、bool a,bool b=true,bool c=false a=b==c

相似考题
更多“在C#中下列表达式不正确的是()。A、double a,double b=2,int c=3,a=b+cB、short a,byte b=2,byte c=3,a=b+cC、string a,string b=”1” string c=”2” a=b+cD、bool a,bool b=true,bool c=false a=b==c”相关问题
  • 第1题:

    使用函数bool()判别以下哪一个值结果为true。()

    A.bool('')

    B.bool(1)

    C.bool(0)

    D.bool([])


    参考答案:B

  • 第2题:

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

    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→float→long→byte, short, char


    正确答案:A

  • 第3题:

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

    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

  • 第4题:

    下面均为Java关键字的一组是()

    A、boolean,byte,long,true

    B、byte, long,true,goto

    C、goto ,Boolean,byte,true

    D、bool, long,true,auto


    答案:A

  • 第5题:

    有如下代码段 public class OperatorAndExceptions { public static void main(String args[]) { int i=10,j=15; System.out.println(i==j); String s1=new String("how are you!"); String s2=new String("how are you!"); System.out.println(s1==s2); } } 其输出为( )。

    A.true false

    B.true true

    C.false true

    D.false false


    正确答案:D
    解析:本题考查比较运算符=的使用。比较运算符不仅可以用于基本数据类型的数据之间的比较,还可以用于复合数据类型的数据之间的比较。题中整型数i和j的值不同,故其==比较的结果为false。s1和s2的值虽然都是“howareyou!”,但是由于它们是不同的对象,因此运算后的结果为false。如果需要比较两个对象的值是否相同,则可以调用equals()方法。

  • 第6题:

    下面程序的结果为______。include void main() { int 3=1,b=2; bool c=1; if(a>b)||c

    下面程序的结果为______。

    include<iostream.h>

    void main()

    {

    int 3=1,b=2;

    bool c=1;

    if(a>b)||c)cout<<“true”<<endl;

    else

    cout<<“false”<<endl;

    }


    正确答案:true。
    true。 解析: 本题考查的是对于逻辑运算符号的理解,”||”运算符的任何一边取值为真,则整个运算结果为真。

  • 第7题:

    D3DPRESENT_PARAMETERS参数很多,关于其中参数之一windowed的理解正确的是()

    • A、取值FALSE则渲染全屏
    • B、取值TRUE则渲染窗口
    • C、int类型
    • D、BOOL类型
    • E、double类型

    正确答案:A,B,D

  • 第8题:

    如果已经定义了方法int f(bool b, int i),则以下方法中,哪一个不是合法的重载方法()。

    • A、double f(bool b, int i)
    • B、int f(double d, int i)
    • C、int f(bool b,int i, double d)
    • D、double f(bool d, int j)

    正确答案:D

  • 第9题:

    有如下程序段:int a = b = 5;String s1 = "祝你今天考出好成绩!";String s2 = s1; 则表达式a == b与s2 == s1的结果分别是()

    • A、true与true
    • B、false与true
    • C、true与false
    • D、false与false

    正确答案:A

  • 第10题:

    假设变量bool_x是一个布尔型(逻辑型)的变量,则下面正确的赋值语句是()

    • A、bool_x="False"
    • B、bool_x=.FalsE.
    • C、bool_x=#False#
    • D、bool_x=False

    正确答案:D

  • 第11题:

    您已创建一个名为 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

  • 第12题:

    单选题
    在C#中下列表达式不正确的是()。
    A

    double a,double b=2,int c=3,a=b+c

    B

    short a,byte b=2,byte c=3,a=b+c

    C

    string a,string b=”1” string c=”2” a=b+c

    D

    bool a,bool b=true,bool c=false a=b==c


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

  • 第13题:

    下面程序的结果为_____。 include void main( ) { int a=1,b=2; bool c=1; if((a>b)

    下面程序的结果为_____。

    include<iostream.h>

    void main( )

    {

    int a=1,b=2;

    bool c=1;

    if((a>b) | | c) cout < < "tree" < < endl;

    else

    cout < < "false" < < endl;

    }


    正确答案:true
    true 解析:本题考查的是对于逻辑运算符号的理解,“ || ”运算符的任何一边取值为真,则整个运算结果为真。

  • 第14题:

    下列代码的执行结果是( )。 public class Test{ public static void main String args[]){ String s1=new String("welcome"); String s2=new String("welcome"); System.out.println(s1==s2); System.out.println(s1.equals(s2)); } }

    A.false,false

    B.false,true

    C.true,true

    D.true,false


    正确答案:B

  • 第15题:

    若已经声明了函数原型“void fun(int a,double b=0.0);”,则下列重载函数声明中正确的是

    A.void fun(int a=90,double b=0.0);

    B.int fun(int a,double B) ;

    C.void fun(double a,intB) ;

    D.bool fun(int a,double b=0.0);


    正确答案:C

  • 第16题:

    基本数据类型精度从低到高排列正确的是()

    A.byte short int float double

    B.byte short int double float

    C. short byte int float double

    D. short byte int double float


    正确答案:A

  • 第17题:

    以下代码中变量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
     

  • 第18题:

    试题六(共 15 分)阅读下列说明和 C++代码,填补代码中的空缺,将解答填入答题纸的对应栏内。【说明】以下 C++代码实现一个简单客户关系管理系统(CrM)中通过工厂(Customerfactory)对象来创建客户(Customer)对象的功能。客户分为创建成功的客户(realCustomer)和空客户(NullCustomer)。空客户对象是当不满足特定条件时创建或获取的对象。类间关系如图6-1 所示。

    【C++代码】#include#includeusing namespace std; class Customer{protected:string name;public:(1) boll isNil()=0;(2) string getName()=0;﹜; class realCustomer (3){public:realCustomer(string name){this->name=name;﹜bool isNil(){ return false;﹜string getName(){ return name;﹜﹜; class NullCustomer (4) {public:bool isNil(){ return true;﹜string getName(){ return 〝Not Available in Customer Database〞; ﹜﹜;class Customerfactory{public:string names[3]={〝rob〞, 〝Joe〞,〝Julie〞﹜;public:Customer*getCustomer(string name){for (int i=0;i<3;i++){if (names[i].(5) ){return new realCustomer(name);﹜﹜return (6);﹜﹜; class CrM{public:void getCustomer(){Customerfactory*(7);Customer*customer1=cf->getCustomer(〝rob〞);Customer*customer2=cf->getCustomer(〝Bob〞);Customer*customer3=cf->getCustomer(〝Julie〞);Customer*customer4=cf->getCustomer(〝Laura〞); cout<<〝Customers〞<getName() <getName() <getName() <getName() <getCustomer();delete crs;return 0;﹜ /*程序输出为:CustomersrobNot Available in Customer DatabaseJulieNot Available in Customer Database*/


    答案:
    解析:
    1)virtual2)virtual3):public Customer4):public Customer5)compare(name)==06)new Null Customer()7)cf=New CustomerFactory();
    【解析】

    本题考察使用C++代码实现实际问题。在C++中,动态绑定是通过虚函数来实现的。此题中用到了虚函数,所以要在成员函数原型缺钱加一个关键字virtual。类RealCustomer和类NullCustomer是类Customer的派生类,因此3、4空都填public Customer。进行对比数据库中的人名compare(name)==0第6空与前面语句是相反的,一个是返回new RealCustomer(name),那么此处应填:new Null Customer()第7空,用工厂创建对象,cf=New CustomerFactory();

  • 第19题:

    在C#中下列表达式不正确的是()。

    • A、double a,double b=2,int c=3,a=b+c
    • B、short a,byte b=2,byte c=3,a=b+c
    • C、string a,string b=”1” string c=”2” a=b+c
    • D、bool a,bool b=true,bool c=false a=b==c

    正确答案:A

  • 第20题:

    假设变量$x=5,则表达式“$x<>4”的返回值类型是()。

    • A、bool(false)
    • B、bool(true)
    • C、int(1)
    • D、int(0)

    正确答案:B

  • 第21题:

    bool类型只有2种值,为真(true)和假(false)。()


    正确答案:正确

  • 第22题:

    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

  • 第23题:

    单选题
    您已创建一个名为 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,....

  • 第24题:

    单选题
    如果已经定义了方法int f(bool b, int i),则以下方法中,哪一个不是合法的重载方法()。
    A

    double f(bool b, int i)

    B

    int f(double d, int i)

    C

    int f(bool b,int i, double d)

    D

    double f(bool d, int j)


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