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

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

有声明union perdata{ int class;char ofice[10];int score;} ;该共用体占据字节数为()

  • A、10
  • B、12
  • C、14
  • D、15

参考答案

更多 “有声明union perdata{ int class;char ofice[10];int score;} ;该共用体占据字节数为()A、10B、12C、14D、15” 相关考题
考题 若有以下说明和定义,以下叙述中错误的是( )。union dt{ int a;char b;double c;}data;A.两个共用体变量之间可以相互赋值B.变量data所占内存字节数与成员c所占字节数相等C.程序段:data.a=5;printf("%f\n",data.c);输出结果为5.000000D.共用体在初始化时只能用第一个成员的类型进行初始化

考题 ( 27 )有如下程序:#includeiostream#includecstringusing namespace std;class XCD{char* a;int b;public:XCD ( char* aa, int bb ) {a=new char[strlen ( aa ) +1];strcpty ( a,aa ) ;b=bb;}Char* Geta () {return a; )int Getb () { return b;}};int main () {char *pl="abcd" , *p2="weirong" ;int dl=6, d2=8;XCD x ( pl,dl ) , Y ( p2 , d2 ) ;coutstrien ( x .Geta ( ) ) +y. Getb () +endl;return 0;}运行时的输出结果是A ) 12B ) 16C ) 14D ) 11

考题 ● 已知有变量 data1 定义如下:union data{ int i;char ch;float f;} data1;则变量 data1 所占的内存存储空间可表示为 (57) 。(57)A. sizeof(int)B. sizeof(char)C. sizeof(float)D. sizeof(int)+sizeof(char)+sizeof(float)

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

考题 有语句定义共用体类型变量: union { int i; char ch; float f; } a,bc; 上面定义的共用体变量a、b、c各占( )字节。A.4B.2C.7D.1

考题 变量a所占内存字节数是______。 union U { char st[4]; int i; long 1; }; struct A { int c; union U u; }a;A.4B.5C.6D.8

考题 变量a所占的内存字节数是 ______。A.4B.5C.6D.8 union U { char st[4]; int i; long l; }; Struct A{ int c; union U u; }a;

考题 在下列定义中的共用体所占内存字节数是( )。 union { char k[6]; struct { int m; floar f; }a; double d; }b;A.8B.14C.18D.10

考题 以下程序的输出结果是includemain(){ union un{ int i;long k;char c;};struct byte{i 以下程序的输出结果是 #include<stdio.h> main() { union un{ int i; long k; char c;}; struct byte{ int a; long b; union un c;}r; printf("%d\n",sizeof(r));}A.10B.13C.7D.8

考题 有以下程序:include include using namespace std;class Y;class X{private 有以下程序: #include <iostream> #include <string> using namespace std; class Y; class X { private: int x; char *strx; public: X(int a, char *str) { x=a; strx=new char[strlen(str)+1]; strcpy(strx,str); } void show(Y ob) ; }; class Y { private: int y; char *stry; public: Y(int b,char *str) { y=b; stry=new char[strlen(str)+1]; strcpy(stry, str); } friend void X: :show(Y ob) ; }; void X: :show(Y ob) { cout<<strx<<", "; cout<<ob, stry<<end1; } int main ( ) { X a(10,"X"); Y b (20, "Y"); a. show(B) ; return 0; } 执行后的输出结果是( )。A.X,YB.a,bC.X,XD.Y,Y

考题 下列程序的执行结果是______。include union {int i;char c[2]; }; void main() {union 下列程序的执行结果是______。 #include<stdio.h> union { int i; char c[2]; }; void main() { union un x; x.c[0]=10; x.c[1]=1; printf("\n%d",x.i); }A.266B.11C.265D.138

考题 有以下程序:include struct STU{char name[10]; int num; int Score;};main(){struct 有以下程序: #include <stdio.h> struct STU { char name[10]; int num; int Score; }; main() { struct STU s[5]={{"YangSan",20041,703},{"LiSiGuo",20042,580}, {"WangYin",20043,680},{"SunDan",20044,550}, {"Penghua",20045,537}}, *p[5],*t; int i,j; for(i=0;i<5;i++) p[i]=s[i]; for(i=0;i<4;i++) for(j=i+1;j<5;j++) if(p[i]->Score>p[j]->Score) { t=p[i];p[i]=p[j];p[j]=t;} printf("%d%d\n",s[1].Score,p[1]->Score); } 执行后的输出结果是( )。A.550 550B.680 680C.580 550D.580 680

考题 以下程序的输出结果是() includemain(){ union un{int i; long k; char c;};struct by 以下程序的输出结果是( ) # include<stdio.h> main() { union un{int i; long k; char c; }; struct byte{ int a; long b; union un c; } r; printf("%d\n",sizeof(r)); }A.10B.13C.7D.8

考题 若有如下定义和声明: struct s { int m;char ch;double x; union t {char a[6];int b[3];}tt;}ss; 则sizeof(struets)的值是( )A.6B.14C.17D.20

考题 若有下面的说明和定义: union un { char s[10]; long d[3]; }ua; struet std { char c[10];double d;int a; union un vb; }a;则printf("%d\n", sizeof(struct std)+sizeof(union un));输出的值为______。A.34B.52C.54D.64

考题 在16位IBM-PC上使用C语言,如定义下列共用体类型变量: union data { int i; char ch; float f; }a,b,c; 则共用体变量a,b,c占用内存的字节数为( )。A.1B.2C.4D.6

考题 以下程序段的输出结果是()。      union node      {int a;      float b;      Char C[10];};    printf(”%d”,sizeof(union node));

考题 考虑下面的声明: union u1{ char c; int i[3]; double d; }; 那么每个u1的对象需要的字节数为()A、21B、13C、12D、8

考题 Union test{ Char a[3]; Int b[4]; Short c[5]; }; 一个test类型数据占用()个字节的空间。A、10B、16C、29D、30

考题 下面的函数声明中,()是“void BC(int a, int b);”的重载函数A、 int BC(int x, int y);B、 void BC(int a, char b);C、 float AA(int a, char b);D、 int BC(int a, int b=0);

考题 public class Score implements Comparable {  private int wins, losses;  public Score(int w, int 1) { wins = w; losses = 1; }  public int getWins() { return wins; }  public int getLosses() { return losses; }  public String toString() {  return ““ + wins + “,“ + losses + “”; }  // insert code here  }  Which method will complete this class?() A、 public int compareTo(Object o) {/*mode code here*/}B、 public int compareTo(Score other) {/*more code here*/}C、 public int compare(Score s1,Score s2){/*more code here*/}D、 public int compare(Object o1,Object o2){/*more code here*/}

考题 下面语句定义了共用体(联合体)变量a,则a占用()个字节。union data { short int i ;char c ; double d;}a;

考题 填空题以下程序段的输出结果是()。      union node      {int a;      float b;      Char C[10];};    printf(”%d”,sizeof(union node));

考题 单选题有声明union perdata{ int class;char ofice[10];int score;} ;该共用体占据字节数为()A 10B 12C 14D 15

考题 填空题下面语句定义了共用体(联合体)变量a,则a占用()个字节。union data { short int i ;char c ; double d;}a;

考题 单选题考虑下面的声明: union u1{ char c; int i[3]; double d; }; 那么每个u1的对象需要的字节数为()A 21B 13C 12D 8

考题 单选题下面的函数声明中,()是“void BC(int a, int b);”的重载函数A  int BC(int x, int y);B  void BC(int a, char b);C  float AA(int a, char b);D  int BC(int a, int b=0);