对于元组valt=(1,3.14,"Fred")说法错误的是?()A、t._0?等于1B、t的类型为Tuple3[Int,Double,java.lang.String]C、val(first,second,_)=t?//second等于3.14D、t._0无法访问,会抛出异常

题目

对于元组valt=(1,3.14,"Fred")说法错误的是?()

  • A、t._0?等于1
  • B、t的类型为Tuple3[Int,Double,java.lang.String]
  • C、val(first,second,_)=t?//second等于3.14
  • D、t._0无法访问,会抛出异常

相似考题
参考答案和解析
正确答案:A
更多“对于元组valt=(1,3.14,"Fred")说法错误的是?()A、t._0?等于1B、t的类型为Tuple3[Int,Double,java.lang.String]C、val(first,second,_)=t?//second等于3.14D、t._0无法访问,会抛出异常”相关问题
  • 第1题:

    下面程序的输出结果是【】。 include using namespace std; int x; void funA(int&,i

    下面程序的输出结果是【 】。

    include<iostream>

    using namespace std;

    int x;

    void funA(int&,int);

    void funB(int,int&);

    int main()

    {

    int first;

    int second=5;

    x=6;

    funA(first,seconD) ;

    fimB(first,seconD) ;

    cout<<first<<" "<<second<<" "<<x<<end1;

    return 0;

    }

    void funA(int &a,int B)

    {

    int first;

    first=a+b;

    a=2*b;

    b=first+4;

    }

    void funB(int u,int &v)

    {

    int second;

    second=x;

    v=second+4;

    x=u+v;

    }


    正确答案:10 10 20
    10 10 20 解析:本题考核函数的引用传递。“引用”实际上是给一个已知变量起个别名,对引用的操作也就是对被它引用的变量的操作。函数funA的功能是将第二个实参的值乘以2再赋值给第一个实参(通过引用传递实现),函数funB的功能是将全局变量 x加上4再赋值给第二个实参,同时x等于第一个实参与第二个实参相加的和。

  • 第2题:

    为了使程序的输出的正确结果为: Now is 2004.7.10 10:10:10. 那么应在下列程序划线处填入的正确语句是( )。 那么应在下列程序划线处填入的正确语句是( )。 #include <iostream> using namespace std; class TIME; class DATE { public: DATE(int y=2004,int m=1,int d=1) { year=y; month=m; day=d; } friend void DateTime(DATE &d, TIME &t); private: int year, month, day; }; class TIME { public: TIME(iht h=0, int m=0,int s=0) { hour=h; minute=m; second=s; } friend void DateTime(DATE &d,TIME &t); private: int hour,minute, second; }; ______________________ //函数 DateTime 的首部 { cout<<"Now is"<<d.year<<'.'<<d.month<<'.'<<d.day<< ' '<<t.hour<<":"<<t.minute<<':'<<t.second<<'.'<<end1; } int main ( ) { DATE d(2004,7,10); TIME t(10, 10, 10); DateTime(d,t); return 0; }

    A.void DateTime(DATE &d,TIME &t)

    B.void TIME::DateTime(DATE &d,TIME &t) const

    C.friend void DateTime(DATE &d,TIME &t)

    D.void DATE::DateTime(DATE &d,TIME &t)


    正确答案:A
    解析:本题程序中,分别在类DATE和TIME中将普通函数DateTime声明为友元函数,但该友元函数的定义是在类体外进行的。友元函数是一个普通函数,它虽然可以访问类对象的私有成员,但它毕竟不是类中的成员函数,因此在类体外定义友元函数时,不需要像成员函数一样在函数名前加上“类名::”。函数首部的其他定义照抄类中友元函数的声明。所以函数DateTime的首部为voidDateTime(DATE&d;TIME&t),即选项A。

  • 第3题:

    在下面的类定义中,横线处应填入的内容是 class Fred { public: void print () { cout<<data<<end1;} void setData (double D) {data=d; static int count; private: double data; };______count=0; //静态数据成员的定义

    A.int

    B.static int

    C.int Fred::

    D.static int Fred::


    正确答案:C
    解析:本题考核静态数据成员的定义。题中数据成员count被定义成了静态的,其初始化的格式为:类型>类名>::静态数据成员 =常量值;,所以横线处应填入的为“int Fred”。

  • 第4题:

    有如下程序:includeusing namespace std;int main(){void function(double val);doub

    有如下程序: #include<iostream> using namespace std; int main() { void function(double val); double val; function(val); cout<<val; return 0; } void function(double val) { val= 3; } 编译运行这个程序将出现的情况是( )。

    A.编译出错,无法运行

    B.输出:3

    C.输出:3.0

    D.输出一个不确定的数


    正确答案:D

  • 第5题:

    ______, the second one will start automatically.

    A.If the first stand-by set failed

    B.If the first stand-by set fails

    C.If the first stand-by set will fail

    D.If the first stand-by set doesn’t fail


    正确答案:B

  • 第6题:

    对于元组valt=(1,3.14,"Fred")说法不正确的是?()

    • A、t._0等于1
    • B、t的类型为Tuple3[Int,Double,java.lang.String]
    • C、val(first,second,_)=t//second等于3.14
    • D、t._0无法访问,会抛出异常

    正确答案:A

  • 第7题:

    若t为double类型,表达式t=l,t+5,l++的值是()

    • A、1
    • B、1.0
    • C、2.0
    • D、4

    正确答案:B

  • 第8题:

    变量x、f、d分别为int,float,double类型的,除了f和d不能等于无穷大和NAN以外值可以任意选取,下面表达式为真的是()

    • A、x==(int)(double)x
    • B、x==(int)(float)x
    • C、d==(double)(float)d
    • D、(f+d)-f==d

    正确答案:A

  • 第9题:

    若t为double类型,表达式t=1,t+5,t++的值是()。

    • A、1
    • B、6.0
    • C、2.0
    • D、1.0

    正确答案:D

  • 第10题:

    填空题
    In order to acquire a second language, learners will subconsciously use their first language knowledge in learning a second language. This is know as language t().

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

  • 第11题:

    单选题
    (), the second one will start automatically.
    A

    If the first stand-by set failed

    B

    If the first stand-by set fails

    C

    If the first stand-by set will fail

    D

    If the first stand-by set doesn’t fail


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

  • 第12题:

    单选题
    有如下程序:#include struct pair{ int first,second;};struct pair get_min_max(int*array, int len){ int i; struct pair res; res.first=array[0]; res.second=array[0]; for(i=1;ires.second)   res.second=array[i]; } return res;}main(){ int array[5]={9,1,3,4}; struct pair min_max = get_min_max(array,5); printf(min=%d,max=%d, min_max.first, min_max.second);}程序运行后的输出结果是(  )。
    A

    min=1,max=9

    B

    min=0,max=9

    C

    min=1,max=4

    D

    min=0,max=4


    正确答案: A
    解析:
    在对数组进行初始化时,如果在定义数组时给出了长度,但没有给所有的元素赋予初始值,那么c语言将自动对余下的元素赋初值0,则array[5] = {9,1,3,4,0}。程序的执行过程为:调用函数get_min_max(array,5),将数组array的首地址传入函数,定义结构体变量res,并为其成员赋值。for循环查找数组array的最小值0,将其赋值给res的成员first,查找数组最大值9,并将其赋值给res的成员second。最后返回结构体变量res,则min_max=res。输出min_max.first=0,min_max.second=9。答案选择B选项。

  • 第13题:

    下面程序的输出结果是______。 include using namespace std; int x; void funA(int&am

    下面程序的输出结果是______。

    include<iostream>

    using namespace std;

    int x;

    void funA(int&,int);

    void funB(int,int&);

    int main()

    {

    int first;

    int second=5;

    x=6;

    funA(first,second);

    funB(first,second);

    cout<<first<<””<<second<<””<<x<<endl;

    return 0;

    }

    void funA(int &a,int b)

    {

    int first;

    first=a+b;

    a=2*b;

    b=first+4;

    }

    void funB(int u, int &v)

    {

    int second;

    second=x;

    v=second+4;

    x=u+v;

    }


    正确答案:10 10 20
    10 10 20 解析:本题考核函数的引用传递。“引用”实际上是给一个已知变量起个别名,对引用的操作也就是对被它引用的变量的操作。函数funA的功能是将第二个实参的值乘以2再赋值给第一个实参(通过引用传递实现),函数funB的功能是将全局变量x加上4再赋值给第二个实参,同时x等于第一个实参与第二个实参相加的和。

  • 第14题:

    有以下程序: include using namespace std; char *x[]={"First", "Second", "Third"

    有以下程序: #include <iostream> using namespace std; char *x[]={"First", "Second", "Third" }; void f(char *z[ ]) { cout<<*z++<<end1; } int main ( ) { char **y; y=x; f(y); return 0; }

    A.产生语法错误

    B.First

    C.Secpnd

    D.Third


    正确答案:B
    解析:程序首先定义全局指针数组x,并赋初值。在函数f()中,语句“cout*z++end1;”是输出*z指向的字符串,然后指向下一个指针。由于在主函数中,指针y已初始化指向指针数组x,所以执行f(y)后,程序输出指针数组x中的第一个字符串"First"。

  • 第15题:

    使用VC6打开考生文件夹下的工程test27_1,此工程包含一个源程序文件test27_1.cpp,但该程序运行有问题,请改正函数中的错误,使该程序的输出结果为;

    100

    源程序文件test27_1.cpp清单如下:

    include <iostream.h>

    template <class T>

    class pair

    {

    T valuel, value2;

    public:

    pair (T first, T second)

    {valuel=first; value2=second;}

    /***************** found *****************/

    char getmax ();

    };

    /***************** found *****************/

    T pair<T>::getmax ()

    {

    T retval;

    /***************** found *****************/

    retval = valuel>value2?? value1 : value2;

    return retval;

    }

    void main ()

    {

    pair <int> myobject (100, 75);

    cout << myobject.getmax()<<end1;

    }


    正确答案:(1)错误:char getmax(); 正确:T getmax(); (2)错误:缺少模板的声明 正确:templateclassT> (3)错误:retval=valuel>value2??value1:value2; 正确:retval=valuel>value2?value1:value2;
    (1)错误:char getmax(); 正确:T getmax(); (2)错误:缺少模板的声明 正确:templateclassT> (3)错误:retval=valuel>value2??value1:value2; 正确:retval=valuel>value2?value1:value2; 解析:(1)主要考查考生对于模板使用的理解,该函数属于模板类定义的一部分,对于返回值类型,应该使用模板类名称T,这样编译的时候才‘能被接受:
    (2)主要考查考生是否掌握了模板的使用,前面的模板类已经声明完成了,在类的外面定义类的成员函数时仍然需要使用模板的声明,这样在后面的函数定义体中才能使用模板类;
    (3)主要考查考生对于“表达式17表达式2:表达式3”语句的掌握,这个语句是一个复合语句,先计算第一个表达式,如果为真则整个式子值为表达式2的值,否则为表达式3的值,题目中错误的使用了两个问号;

  • 第16题:

    对于数组int[][]t={{1,2,3},{4,5,6}}来说,t.length等于3,t[0].length等于2。( )


    正确答案:错误

  • 第17题:

    In order to acquire a second language, learners will subconsciously use their first language knowledge in learning a second language. This is know as language t().
    transfer

  • 第18题:

    现有元组valt=(1,3.14,"Fred"),关于元组t的说法错误的是?()

    • A、t._0?等于1
    • B、t的类型为Tuple3[Int,Double,java.lang.String]
    • C、val(first,second,_)=t?//second等于3.14
    • D、t._0无法访问,会抛出异常

    正确答案:A

  • 第19题:

    public class Bootchy {  int bootch;  String snootch;  public Bootchy() {  this(”snootchy”);  System.out.print(”first “);  }  public Bootchy(String snootch) {  this(420, “snootchy”);  System.out.print(”second “);  }  public Bootchy(int bootch, String snootch) {  this.bootch = bootch;  this.snootch = snootch;  System.out.print(”third “);  }  public static void main(String[] args) {  Bootchy b = new Bootchy();  System.out.print(b.snootch +“ “ + b.bootch);  }  }  What is the result?() 

    • A、 snootchy 420 third second first
    • B、 snootchy 420 first second third
    • C、 first second third snootchy 420
    • D、 third second first siiootchy 420
    • E、 third first second snootchy 420
    • F、 first second first third snootchy 420

    正确答案:D

  • 第20题:

    StringBuffer append(数值类型 t),参数t可以是boolean、int、char、float、double、long


    正确答案:正确

  • 第21题:

    Public class Holt extends Thread{   Private String sThreadName;   Public static void main(String argv[]) {  Holt  h=new Holt(); h.go(); Holt(){};  Holt(String s){ sThreadName=s;  Public String getThreadName() {  return sThreadName;} }  Public void go(){  Hot first=new Hot("first"); first.start();  Hot second=new Hot("second"); second.start();  }  Public void start() {  For(int i=0;i<2;i++) {  System.out.print(getThreadName()+i); Try{  Thread.sleep(100); }catch(Exception e){  System.out.print(e.getMessage()) ;  } } }  }  当编译运行上面代码时,将会出现() 

    • A、编译时错误
    • B、输出first0,second0,first0,second1
    • C、输出first0,first1,second10,second1
    • D、运行时错误

    正确答案:C

  • 第22题:

    单选题
    变量x、f、d分别为int,float,double类型的,除了f和d不能等于无穷大和NAN以外值可以任意选取,下面表达式为真的是()
    A

    x==(int)(double)x

    B

    x==(int)(float)x

    C

    d==(double)(float)d

    D

    (f+d)-f==d


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

  • 第23题:

    单选题
    public class Bootchy {  int bootch;  String snootch;  public Bootchy() {  this(”snootchy”);  System.out.print(”first “);  }  public Bootchy(String snootch) {  this(420, “snootchy”);  System.out.print(”second “);  }  public Bootchy(int bootch, String snootch) {  this.bootch = bootch;  this.snootch = snootch;  System.out.print(”third “);  }  public static void main(String[] args) {  Bootchy b = new Bootchy();  System.out.print(b.snootch +“ “ + b.bootch);  }  }  What is the result?()
    A

     snootchy 420 third second first

    B

     snootchy 420 first second third

    C

     first second third snootchy 420

    D

     third second first siiootchy 420

    E

     third first second snootchy 420

    F

     first second first third snootchy 420


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