2、下面哪一条语句出现编译错误: enum Gender{female, male}; //A struct Person{ char name[20]; Gender sex; //B Person father; //C }; Person members[30]; //DA.行AB.行BC.行CD.行D

2、下面哪一条语句出现编译错误: enum Gender{female, male}; //A struct Person{ char name[20]; Gender sex; //B Person father; //C }; Person members[30]; //D

A.行A

B.行B

C.行C

D.行D


参考答案和解析
CD

相关考题:

设有定义:struct person{ int ID;char name[12];}p;请将 scanf("%d", 【 1 2 】 ); 语句补充完整,使其能够为结构体变量 p 的成员 ID 正确读入数据。

设有如下定义 struct ss { char name[10]; int age; char sex; } std[3],* p=std; 下面各输入语句中错误的是A.scanf("%d",(*p).age);B.scanf("%s",std.name);C.scanf("%c",std[0].sex);D.scanf("%c",(p->sex));

有如下定义struct person{char name[9];int age;};struct person class[10]={"John",17,"paul",19,"Mary",18,"Adam",16,};根据上述定义,能输出字母M的语句是A.printf("%c\n",class[3].name);B.printf("%c\n",class[3].name[1]);C.printf("%c\n",class[2].name[1]);D.printf("%c\n",class[2].name[0]);

给出下列的不完整的类代码,则哪个语句可以被加到横线处? ( ) class Person{ String name,department; int age; public Person(String n){name=n;} public Person(String n,int s){name=n; age=a;} public Person(String n,String d,int a){ department=d;______ } }A.Person(n,a);B.this(Person(n,a));C.this(n,s);D.this(name,age);

有以下程序:includeincludeusingnameSpacestd;classperson{ intage; Char*nam 有以下程序:include <iostream>include <string>using nameSpace std;class person{int age;Char * name;public:person ( int i, Char * str ){int j;j = strlen( str ) + 1;name = new char[ j ];strcpy( name, str );age = i;}~person(){delete name;cout<<"D";}void display(){cout<<name<<":"<<age;}};int main(){person demo( 30,"Smith" );demo.display();return 0;}则该程序的输出结果为:【 】。

下列程序运行后的输出结果是( )。#include#includeusing namespace std;class Person{public:Person(string n):name(n) { coutprivate:int year,month,day;};class Student:public Person{public:Student(string n,int y,int m,int d,char c):birthday(y,m,d),sex(c),Person(n) { coutA. SB.PSC.DPSD.PDS

给出下列的不完整的类代码,则下列的( )语句可以加到横线处。 class Person{ String name,department; int age public Person(String n){name=n;} public Person(String n,int a){name=n;age=a;} pubilc Person(String n,String d,int a) { _______________ department=d; } }A.Person(n,a);B.this(Person(n,a));C.this(n,a);D.this(name,age);

有如下定义: struct person {char name[9];int age;} struct person class[10]={ "John",17, "Paul",19, "Mary",18, "Adam",16}; 能输出字母M的是( )A.printf("%c\n",class[3].name);B.printf("%c\n",class[3].name[1]);C.printf("%c\n",class[2].name[1]);D.printf("%c\n",class[2].name[0]);

根据下面的定义,能打印出字母M的语句是( )。 struct person { char name[9]; int age; }; struct person class[10]={"John",17,"Paul",19,"Mary",18,"Adam",16};A.printf("%c\n",class[3].name};B.printf("%c\n",class[2].name[0]);C.printf("%c\n",class[3].name[1]);D.printf("%c\n",class[2].name[1]);

设有以下语句: struct SS { int no; char name[10];}PERSON; 则下面叙述中错误的是 ( )A.struct是结构体类型的关键字B.struct SS是结构体类型C.PERSON是结构体类型名D.name是结构体成员名

给出下面不完整的类代码,则横线处的语句应该为( )。 class Person { String name,department; int age; public Person (Strings) {name=s;} public Person (String s,intA.{name=s;age=a;} public Person (String n,String d,intA){ __________ department=d; } }A)Person (n,A);B.this (Person(n,A));C.this(n,A);D.this(name,age);

设有定义:struct person{int ID;char name[12];}P;请将scanf(“%d”, 【 】);语句补充完整,使其能够为结构体变量P的成员ID正确读人数据。

●以下的SQL 99语句,Student与Person之间的关系是 (62) 。CREATE TYPE Person(name char(20),address varchar(50));CREATE TYPE Student(under Person(degree char(20)department char(20));(62)A.类型继承B.类型引用C.表继承D.无任何关系

TestClass类定义如下: class TestClass { private: intid; char gender; char*phone; public: TestClass ():id(0),gender('#'),phone(NULL){) TestClass(int no,char ge='#',char *ph=NULL) {id=no;gender=ge;phone=ph;} }; 下面类对象定义语句中错误的是( )。A.TestClass myObj(i);B.TestClass myObj(2,"11101111155");C.TestClass myObj(1,'m');D.TestClass myObj;

某C语言结构体的定义如下。 struct date { int year, month, day; }; struct worklist { char name[20]; char sex; struct date birthday; }person; 若对变量person的出生年份进行赋值,正确的赋值语句是(33)。A.year=1976B.birthday. year=1976C.person. year=1976D.person. birthday. year=1976

根据下述定义,能输出字母M的语句是( )。struct person { char name[9]; int age;}class[10]={"Johu",17,"Paul",19,"Mary",18,"Adam",16}; A、prinft("%c\n",class[3].nane);B、pfintf("%c\n",class[3].name[1]);C、prinft("%c\n",class[2].name[1]);D、printf("%c\n",class[2].name[0])

Person p = new Person(“张三”,23);这条语句会调用下列哪个构造方法给属性进行初始化() A.public Person(){}B.public Person(String name,int age) { this.name = name; this.age = age; }C.public Person(int age,String name) { this.age = age; this.name = name; }D.public Person(String name) { this.name = name; }

设有如下定义 struct ss { char name[10]; int age; char sex; }std[3], * p=std; 下面各输入语句中错误的是A.cin>>(* p).age);B.cin>>std.name);C.cin>>std[0].sex);D.cin>>(p->.sex));

在J2EE中,使用()选项中的代码,可以生成如下XML文档:      Tony Blair      A、Element people = doc.createElement("PEOPLE");  Element person = doc.createElement("PERSON"); Element name = doc.createElement("NAME"); name.appendChild(doc.createTextNode("Tony Blair")); people.appendChild(person); person.appendChild(name); doc.appendChild(people);B、Element people = doc.createElement("PEOPLE");  Element person = doc.createElement("PERSON"); people.appendChild(person); Element name = doc.createElement("NAME"); name.appendChild(doc.createTextNode("Tony Blair")); person.appendChild(name); doc.appendChild(people);C、Element people = doc.createElement("PEOPLE");  Element person = doc.createElement("PERSON"); people.appendChild(person); Element name = doc.createElement("NAME"); name.appendText(doc.createTextNode("Tony Blair")); person.appendChild(name); doc.appendChild(people);D、Element people = doc.createElement("PEOPLE");  Element person = doc.createElement("PERSON");Element name = doc.createElement("NAME"); name.createTextNode("Tony Blair"); people.appendChild(person); person.appendChild(name); doc.appendChild(people);

public class Person {  private name;  public Person(String name) {  this.name = name;  }  public boolean equals(Object o) {  if( !o instanceof Person ) return false;  Person p = (Person) o;  return p.name.equals(this.name);  }  }  Which is true?() A、 Compilation fails because the hashCode method is not overridden.B、 A HashSet could contain multiple Person objects with the same name.C、 All Person objects will have the same hash code because the hashCode method is not overridden.D、 If a HashSet contains more than one Person object with name=”Fred”, then removing another person, also with name=”Fred”, will remove them all.

单选题public class Person {  private name;  public Person(String name) {  this.name = name;  }  public boolean equals(Object o) {  if( !o instanceof Person ) return false;  Person p = (Person) o;  return p.name.equals(this.name);  }  }  Which is true?()A Compilation fails because the hashCode method is not overridden.B A HashSet could contain multiple Person objects with the same name.C All Person objects will have the same hash code because the hashCode method is not overridden.D If a HashSet contains more than one Person object with name=”Fred”, then removing another person, also with name=”Fred”, will remove them all.

多选题在J2EE中,使用()选项中的代码,可以生成如下XML文档:      Tony BlairAElement people = doc.createElement(PEOPLE);  Element person = doc.createElement(PERSON); Element name = doc.createElement(NAME); name.appendChild(doc.createTextNode(Tony Blair)); people.appendChild(person); person.appendChild(name); doc.appendChild(people);BElement people = doc.createElement(PEOPLE);  Element person = doc.createElement(PERSON); people.appendChild(person); Element name = doc.createElement(NAME); name.appendChild(doc.createTextNode(Tony Blair)); person.appendChild(name); doc.appendChild(people);CElement people = doc.createElement(PEOPLE);  Element person = doc.createElement(PERSON); people.appendChild(person); Element name = doc.createElement(NAME); name.appendText(doc.createTextNode(Tony Blair)); person.appendChild(name); doc.appendChild(people);DElement people = doc.createElement(PEOPLE);  Element person = doc.createElement(PERSON);Element name = doc.createElement(NAME); name.createTextNode(Tony Blair); people.appendChild(person); person.appendChild(name); doc.appendChild(people);

多选题For Question 1, consider each of the choices separately and select all that apply.  The passage suggests which of the following about gender in Western culture?AMost, if not all, members of modern Western civilization consider themselves either male or female.BContemporary Western civilization does not believe in the concept of hijra.CThe idea of male/female binary gender is not generally considered the norm of contemporary Western civilization.

单选题若有以下程序#include #include #include typedef struct stu{ char *name,gender; int score;}STU;void f(char *p){ p=(char *)malloc(10); strcpy(p,Qian);}main(){ STU a={NULL,'m',290},b; a.name=(char *)malloc(10); strcpy(a.name,Zhao); b=a; f(b.name); b.gender='f'; b.score=350; printf(%s,%c,%d,, a.name, a.gender, a.score); printf(%s,%c,%d, b.name, b.gender, b.score);}则程序的输出结果是(  )。AQian,m,290,Qian,f,350BZhao,m,290,Qian,f,350CQian,f,350,Qian,t,350DZhao,m,290,Zhao,f,350

单选题有以下程序:#include #include typedef struct stu{ char name[10]; char gender; int score;}STU;void f(char *name,char gender,int score){ strcpy(name,Qian); gender='f'; score=350;}main(){ STU a={Zhao,'m',290},b; b=a; f(b.name,b.gender,b.score); printf(%s,%c,%d,, a.name, a.gender, a.score); printf(%s,%c,%d, b.name, b.gender, b.score);}程序的运行结果是(  )。AZhao,m,290,Qian,m,290BZhao,m,290,Zhao,m,290CZhao,m,290,Qian,m,350DZhao,m,290,Qian,f,350

单选题有如下程序:#include struct person{ char name[10]; int age;};main(){ struct person room[4] = {{Zhang,19}, {Li,20}, {Wang,17}, {Zhao,18}}; printf(%s:%d,(room+2)-name, room-age);}程序运行后的输出结果是(  )。AWang:19BWang:17CLi:20DLi:19

单选题有以下程序:#include #include typedef struct stu{ char name[10]; char gender; int score;}STU;void f(STU *c){ strcpy(c-name,Qian); c-gender='f'; c-score=350;}main(){ STU a={Zhao,'m',290},b; b=a; f(b); printf(%s,%c,%d,, a.name, a.gender, a.score); printf(%s,%c,%d, b.name, b.gender, b.score);}程序运行后的输出结果是(  )。AZhao,m,290,Qian,f,350BZhao,m,290,Qian,m,290CZhao,m,290,Zhao,m,290DZhao,m,290,Qian,m,350

单选题有如下程序:#include struct person{ char name[10]; int age;};main(){ struct person room[2] = {{Wang,19},{Li,20}}; printf(%s:%d,(room+1)-name, room-age);}程序运行后的输出结果是(  )。ALi:19BWang:19CLi:20DWang:17