网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)

char name[10]=“Mary”;char*pName=name;int i=5;对上面语句描述错误的是()。

  • A、name和pName有相同的值
  • B、&name[0]和pName有相同的值
  • C、name+i和pName+i有相同的值
  • D、*(name+i)和(*pName+i)有相同的值

参考答案

更多 “char name[10]=“Mary”;char*pName=name;int i=5;对上面语句描述错误的是()。A、name和pName有相同的值B、name[0]和pName有相同的值C、name+i和pName+i有相同的值D、*(name+i)和(*pName+i)有相同的值” 相关考题
考题 根据下列定义,能打印出字母P的语句是( )。struct stu{char name[10];int age;};struct stu s[10]={"John",11,"Pau1",12,"Mary",11,"adam",12};A.primf("%c",s[3].name};B.primf("%c",s[3].name[1]);C.printf("%c",s[2].name[1]);D.printf("%c",s[1].name[0]);

考题 ( 32 )有如下程序#includeiostreamusing namespace std;class Publication{ // 出版物类char name[30];public:Publication(char *name=" 未知名称 "){strcpy(this-name,name);}const char * getName()const{ return name; }virtual const char * getType()const{ return " 未知类型 ";}};class Book: public Publication{ // 书类public:Book(char *name): Publication(name){}virtual const char * getType()const{ return " 书 " ; }};void showPublication( Publication p){coutp.getType()":"p.getName()endl;}int main(){Book book(" 精彩人生 ");showPublication(book);return 0;}运行时的输出结果是A )未知类型:未知名称B )未知类型:精彩人生C )书:未知名称D )书:精彩人生

考题 ( 13 )有如下程序:#include iostreamusing namespace std;class GrandChild{public:GrandChild(){ strcpy (name,"Unknown"); }const char * getName()const { return name; }virtual char * getAddress()const=0;private:char name[20];};class GrandSon : public GrandChild{public:GrandSon{char *name} {}Char * getAddress() const { return "Shanghai";}};int main(){GrandChild *gs=new GrandSon("Feifei");coutgs-getName()" 住在 "gs-getAddress()endl;delete gs;return 0;}运行时的输出结果是 【 13 】 。

考题 如下程序的输出结果是______。 include using namespace std; class Pet{ char nam 如下程序的输出结果是______。include<iostream>using namespace std;class Pet{char name[10];public:Pet(char*nanle){strcpy(this->name,name);}const char*getName( )const{return name;}virtual void call( )eonst=0;};class Dog:public Pet{public:Dog(char*name):Pet(name){ }void call( )eonst{cout<<"汪汪叫";}};class Cat:public Pet{public:Cat(char*name):Pet(name){ }void call( )const{eout<<"喵喵叫";}};int main( ){Pet*petl=new Dog("哈克"),*pet2=new Cat("吉米");eout<<petl->getName( );petl->call( );eout<<endl;cout<<pet2->getName( );pet2->call( );eout<<endl;return 0;}

考题 有如下定义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]);

考题 有以下程序: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;}则该程序的输出结果为:【 】。

考题 有以下程序includestruct STU{char name[10];int num;};void f(char*name, intnum){s 有以下程序 #include <string.h> struct STU { char name[10]; int num; }; void f(char *name, int num) { struct STU s[2]={{"SunDan",20044},{"Penghua",20045}}; num=s[0].num; strcpy(name,s[0].name); } main() { struct STU s[2]={{"YangSan",20041},{"LiSiGuo",20042}},*p; p=s[1]; f(p->name,p->num); printf("%s %d\n",p->name,p->num); } 程序运行后的输出结果是A.SunDan 20042B.SunDan 20044C.LiSiGuo 20042D.YangSan 20041

考题 阅读以下说明和C++程序,将应填入(n)处的字句写在对应栏内。[说明]本程序使用类来管理员工的通讯地址信息。已知程序的输出为:输出记录:5姓名:王丽华街道地址:中华路15号市:襄樊市省;湖北省邮政编码:430070[C++程序]include < iostream, h >include < string, h >class employee.{ protected:char name[10];char street[ 20 ];char city[10];char (1) [10];char post[7];int no;(2):(3) (char [] ,char [] ,char [] ,char [] ,char [] ,int);void changename ( char n [] ) { strcpy ( name, n); }void changestreet( char s[] ) { strcpy(street,s) ;}void changecity ( char c [] ) { strcpy ( city, c ); }void changeprov( char p [] ) { strcpy(prov,p); }void changeno(int nnm) { (4);}void display( );};employee:: (3) (char n[] ,char s[] ,char c[] ,char p1[] ,char p2[] ,int nam){ strcpy(name,n);strcpy ( street, s);strcpy ( city, c);strcpy ( prov, p1 );strcpy ( post, p2 );no = nam; }void employee:: display( ) { cont< <"输出记录: "< <no< <endl;cout< < "姓名: "< < name < < endl;coot < < "街道地址: "< < street < < endl;cout < < "市: "< < city < < endl;cout< <"省: "< <prov < <endl;cout < <"邮政编码: "< < post < < endl;}void main( ) { employee cmp("王华" ,"中华路15号" ,"武汉市","湖北省","430070", 1 );emp. changename( "五丽华" );emp. changecity ( "襄樊市" );emp. changeno(5);(5);

考题 阅读以下说明C++代码,将应填入(n)处的字句写在对应栏内。[说明]本程序实现了雇员信息管理功能,其中封装了雇员信息及其设置、修改、删除操作。已知当输入为“Smith 31 2960.0”时,程序的输出是:姓名:Smith 年龄:31 工资:2960姓名:Smith 年龄:31 工资:3500姓名:Mary 年龄:23 工资:2500[C++程序]include <iostream.h>include <string.h>class employee{char *name; //雇员姓名short age; //年龄float salary;//工资public:employee();void set_name(char *);void set_age(short a) {age=a;}void set_salary(float s) {salary=s;}(1);~ employee(){delete[] name;}};employee::employee() { name="";age=0;salary=0.0;void employee::set_name(char *n){ name=new char[strlen(n)+1];(2) (name,n);}void employee::print(){ cout<<"姓名":"<<name<<" 年龄:"<<agc<<" 工资:" <<salary<<endl;}void main(){ char *na;short ag=0;float sa=0;(3);na=new char[10];cin>>na>>ag>>sa;emp.set_name(na);emp.set_age(ag);emp.set_salary(sa);emp.print();(4) (3500.0);emp.print();(5);emp.set_name("Mary");emp.set_age(23);emp.set_salary(2500.0);emp.print();}

考题 下面程序和运行运行结果是【 】。typedef union student{ char name [10];long sno;char sex;float score [4];} STU;main ( ){ STU a[5];prinff( "% d\n", sizeof(a) );}

考题 下列语句错误的是( )。A.char*p="John";p[2]='a';B.char name[5]="John";name[2]='a'C.char name[5]="John",*p=name;p[2]='a';D.char name[5]="John",*p=name[2];*p='a';

考题 有如下程序: include using namespace std; class Pet{ char name[10]; public: Pet(c 有如下程序:include<iostream>using namespace std;class Pet{char name[10];public:Pet(char*name){strcpy(this->name,name);}const char*getName()const {return name;}virtual void call()const=0;};class Dog:public Pet{public:Dog(char*name):Pet(name){}void call()const{cout<<"汪汪叫":}};class Cat:public Pet{public:Cat(char*name):Pet(name){}void call()const{cout<<"喵喵叫";}};int main(){Pet*pet1=new Dog("哈克"),*pet2=new Cat("吉米");cout<<pet1->getName();pet1->call();cout<<end1;cout<<pet2->getName();pet2->call();cout<<end1;return 0;}程序的输出结果是______。

考题 有如下定义: 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]);

考题 以下选项中,合法的是( )。A.char str3[]={d,e,b,u,g,\0};B.char str4;str4="hello world";C.char name[10];name="china";D.char strl[5]="pass",str2[6];str2=strl;

考题 有以下程序: #include 〈iostream〉 #include 〈string〉 using namespace std; class visited { private: int number; char *name; public: static int glob; void set mes(char *a); }; void visited::set mes(char *a) { name=new char[strlen(A) +1]; strcpy(name,A) ; number=++glob; } int visited::glob-O; int main() { visited person[10]; int i; char str[8]; for(i=0;i5;i++) { cinstr; person[i] .set mes(str); } coutA.5B.4C.3D.2

考题 有如下程序:includeusing namespace std;class Name{char name[20];public:Name( ){s 有如下程序: #include<iostream> using namespace std; class Name{ char name[20]; public: Name( ){strepy(name," ");tout<<'?';} Name(char*fname){strcpy(name,fname);cout<<'?';} }; int main( ){ Name name[3]={Name("张三"),Name("李四")}; return 0; } 运行此程序输出符号“?”的个数是A.0B.1C.2D.3

考题 有如下程序:includeusing namespace std;class Publication{//出版物类char name[30] 有如下程序: #include<iostream> using namespace std; class Publication{//出版物类 char name[30]; public: Publication(char*name="未知名称"){strcpy(this->name,name);} const char*getName( )const{return name;} //常数据成员 virtual const char*getType( )const{return"未知类型";}//虚常数据成员 }; class Book:public Publication{ //书类 public: Book(char*name):Publication(name){ } virtual const char*getType( )const{return"书";} //虚常数据成员 }; void showPublication(Publication p){cout<<p.getType( )<<":"<<P.getName( )<<endl;} int main( ){ Book book("精彩人生"); showPublication(book); return 0; } 程序的输出结果是A.未知类型:未知名称B.未知类型:精彩人生C.书:未知名称D.书:精彩人生

考题 若某企业的数据库系统中有如下所示的员工关系和仓库关系,每个仓库可有多名员工,但只有一名负责人。员工关系(cmployee):仓库关系(warehouse):则创建仓库表结构的SQL语句为(58)。A.CREATE TABLE(employeeID CHAR(2)NOT NULL UNIQUE, name CHAR(30)NOT NULL, address CHAR(40), pricipallD CHAR(3));B.CREATE warehouse(warehouseD CHAR(2)PRIMARY KEY, name CHAR(30), address CHAR(40), pficipalID CHAR(3));C.CREATE TABLE warehouse(warehouselD CHAR(2)PRIMARY KEY, name CHAR(30)NOT NULL, address CHAR(40), pricipalID CHAR(3), FOREIGN KEY(priciPalID)REFERENCES employee(employeeID));D.CREATE TABLE warehouse(warehouselD CHAR(2), name CHAR(30)NOT NULL, address CHAR(40), pricipalID CHAR(3), PRIMARY KEY(warehouselD), FOREIGN KEY(employeeID)REFERENCES emplo

考题 下面程序的运行结果是typedef union student{ char name[10]; long sno; char sex; float score[4];}STU;main(){ STU a[5]; printf("%d\n",sizeof(a));}

考题 有如下程序:includeusing namespace std;class Toy{public:Toy(char*_n){strcpy(name 有如下程序: #include<iostream> using namespace std; class Toy{ public: Toy(char*_n){strcpy(name,_n);count++;} ~Toy(){count--;} char*GetName( ){return name;} static int getCount( ){return count;} private: char name[10]; static int count; }; int Toy::count=0: int main( ){ Toy tl("Snoopy"),t2("Mickey"),t3("Barbie"); cout<<t1.getCount( )<<endl; return 0; } 程序的输出结果是A.1B.2C.3D.运行时出错

考题 某企业的数据库系统中有如下所示的员工关系和仓库关系,每个仓库可有多名员工,但只有一名负责人。员工关系(employee):仓库关系(warehouse):则创建仓库表结构的SQL语句为(58)。A.CREATE TABLE (employee ID CHAR(2)NOTNULL UNIQUE, name CHAR(30)NOT NULL, address CHAR(40), principal ID CHAR(3));B.CREATE warehouse(warehouse ID CHAR(2)PRIMARY KEY, name CHAR(30), address CHAR(40), principal ID CHAR(3));C.CREATE TABLE warehouse(warehouse ID CHAR(2)PRIMARY KEY, name CHAR(30)NOT NULL, address CHAR(40), principal ID CHAR(3), FOREIGN KEY(principal ID)REFERENCES employee(employee ID));D.CREATE TABIE warehouse(warehouse ID CHAR(2), name CHAR(30)NOT NULL, address CHAR(40), principal ID CHAR(3), PRIMARY REY(warehouse ID), FOREIGN KEY(employee ID)REFERENCES employee(employee ID));

考题 根据下述定义,能输出字母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])

考题 下列关于结构型变量的定义语句中,错误的是( )A.typedef struct CCCB.define GGG struct { char name[20];GGG CCC { char name[20]; int age; int age; }GGG; }; GGG abc ; GGG CCC abc;C.structD.struct { char name[20]; { char name[20]; int age; int age; }ccc; }abc; CCC abc;

考题 根据下列的定义,能打印出字母P的语句是( )。 struct stu {char name[10]; int age; }; struct sm s[10]={"John",11, "Pau1",12, "Mary",11, "adam",12 };A.printf("%c",s[3].name);B.printf("%c",s[3].name[1]);C.printf("%c",s[2].name[1]);D.printf("%c",s[1].name[0]);

考题 单选题若有以下程序#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);}则程序的输出结果是(  )。A Qian,m,290,Qian,f,350B Zhao,m,290,Qian,f,350C Qian,f,350,Qian,t,350D Zhao,m,290,Zhao,f,350

考题 单选题char name[10]=“Mary”;char*pName=name;int i=5;对上面语句描述错误的是()。A name和pName有相同的值B name[0]和pName有相同的值C name+i和pName+i有相同的值D *(name+i)和(*pName+i)有相同的值

考题 在Oracle 中,下列语句中哪些可以合法地创建一个函数? (1.0分) [多选] A. CREATE FUNCTION func_name(cdcode NUMBER) RETURN CHAR IS DECLARE dis_cd CHAR(15); BEGIN .. END; B. CREATE FUNCTION func_name(cdcode NUMBER) RETURN CHAR IS dis_cd CHAR(15); BEGIN .. END; C. CREATE FUNCTION func_name(cdcode NUMBER) IS BEGIN .. END; D. CREATE FUNCTION func_name(cdcode NUMBER) RETURN CHAR IS BEGIN .. END; E. CREATE FUNCTION func_name(cdcode NUMBER) RETURN CHAR IS DECLARE dis_cd STRING (15); BEGIN .. END;