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
第1题:
有以下程序:
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;
}
则该程序的输出结果为:【 】。
第2题:
给出下列的不完整的类代码,则下列的( )语句可以加到横线处。 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);
第3题:
根据下面的定义,能打印出字母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]);
第4题:
给出下面不完整的类代码,则横线处的语句应该为( )。 class Person { String name,department; int age; public Person (Strings) {name=s;} public Person (String s,int
A.{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);
第5题:
●以下的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.无任何关系
第6题:
某C语言结构体的定义如下。 struct date { int year, month, day; }; struct worklist { char name[20]; char sex; struct date birthday; }person; 若对变量person的出生年份进行赋值,正确的赋值语句是(33)。
A.year=1976
B.birthday. year=1976
C.person. year=1976
D.person. birthday. year=1976
第7题:
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; }
第8题:
在J2EE中,使用()选项中的代码,可以生成如下XML文档:
第9题:
Compilation fails because the hashCode method is not overridden.
A HashSet could contain multiple Person objects with the same name.
All Person objects will have the same hash code because the hashCode method is not overridden.
If a HashSet contains more than one Person object with name=”Fred”, then removing another person, also with name=”Fred”, will remove them all.
第10题:
Most, if not all, members of modern Western civilization consider themselves either male or female.
Contemporary Western civilization does not believe in the concept of hijra.
The idea of male/female binary gender is not generally considered the norm of contemporary Western civilization.
第11题:
Zhao,m,290,Qian,m,290
Zhao,m,290,Zhao,m,290
Zhao,m,290,Qian,m,350
Zhao,m,290,Qian,f,350
第12题:
Zhao,m,290,Qian,f,350
Zhao,m,290,Qian,m,290
Zhao,m,290,Zhao,m,290
Zhao,m,290,Qian,m,350
第13题:
下列程序运行后的输出结果是( )。#include#includeusing namespace std;class Person{public:Person(string n):name(n) { cout<<'P'; }private:string name;};class Date{public:Date(int y=2012,int m=12,int d=21):year(y),month(m),day(d) { cout<<'D'; }
private: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) { cout<<'S'; }private:Date birthday;char sex;};int main(){Student stu1("Zhang",1990,10,1,'F');return 0}
A. S
B.PS
C.DPS
D.PDS
第14题:
有如下定义: 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]);
第15题:
设有以下语句: struct SS { int no; char name[10];}PERSON; 则下面叙述中错误的是 ( )
A.struct是结构体类型的关键字
B.struct SS是结构体类型
C.PERSON是结构体类型名
D.name是结构体成员名
第16题:
设有定义:
struct person
{int ID;char name[12];}P;
请将scanf(“%d”, 【 】);语句补充完整,使其能够为结构体变量P的成员ID正确读人数据。
第17题:
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;
第18题:
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])
第19题:
设有如下定义 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));
第20题:
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?()
第21题:
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);
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);
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);
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);
第22题:
Qian,m,290,Qian,f,350
Zhao,m,290,Qian,f,350
Qian,f,350,Qian,t,350
Zhao,m,290,Zhao,f,350
第23题:
Wang:19
Wang:17
Li:20
Li:19
第24题:
Li:19
Wang:19
Li:20
Wang:17