单选题Union test{ Char a[3]; Int b[4]; Short c[5]; }; 一个test类型数据占用()个字节的空间。A10B16C29D30

单选题
Union test{ Char a[3]; Int b[4]; Short c[5]; }; 一个test类型数据占用()个字节的空间。
A

10

B

16

C

29

D

30


参考解析

解析: 暂无解析

相关考题:

试题三(共 15分)阅读以下说明、C函数和问题,将解答写入答题纸的对应栏内。【说明 1】函数test_f1(int m, int n)对整数 m、n进行某种运算后返回一个整数值。【C函数 1】int test_f1(int m, int n){ int k;k = m n ? m : n;for(;(k%m!=0) || (k%n!=0);k++);return k;}【问题 1】(5分)(1)请写出发生函数调用test_f1(9,6)时,函数的返回值;(2)请说明函数test_f1的功能。【说明 2】设在某 C 系统中为每个字符分配 1 个字节,为每个指针分配 4 个字节,sizeof(x)计算为x分配的字节数。函数test_f2()用于测试并输出该C系统为某些数据分配的字节数。【C函数 2】void test_f2( ){ char str[] = "NewWorld"; char *p = str; char i = '\0';void *ptr = malloc(50);printf("%d\t", sizeof(str)); printf("%d\n", sizeof(p));printf("%d\t", sizeof(i)); printf("%d\n ", sizeof(ptr));}【问题 2】(4分)请写出函数test_f2()的运行结果。【说明 3】函数 test_f3(char s[])的功能是:将给定字符串 s 中的所有空格字符删除后形成的串保存在字符数组tstr中(串s的内容不变),并返回结果串的首地址。【C函数 3】char *test_f3 (const char s[]){ char tstr[50]={'\0'}; unsigned int i, k = 0;for(i=0; istrlen(s); i++)if (s[i] != ' ') tstr[k++] = s[i];return tstr;}【问题 3】(6分)函数test_f3()对返回值的处理有缺陷,请指出该缺陷并说明修改方法。

若有下面说明和定义:struct test{ int m1;char m2;float m3;union uu(char u1[5];int u2[2];)ua;}myaa; 则sizeof(struct test)的值是( )。A)20 B)16C)14 D)9

若下面程序运行时输出结果为1, A, 10.12, B, 3.5请将程序补充完整 。#includeusing namespace std;int main(){void test(int, char,double 【 8 】 );test(1,'A',10.1);test(2,'B');return 0;}void test(int a, char b, doubleC .{cout}

已知程序中已经定义了函数test,其原型是int test(int,int,int);,则下列重载形式中正确的是A.char test (int,int,int);B.double test(int,int,double);C.int test(int,int,int=O);D.float test(int,int,float=3.5F);

考虑函数原型void test(int a,int b=7,char z=‘*’),下面的函数调用中,属于不合法调用的是( )。A.test(5);B.test(5,8);C.test(6,’#’);D.test(0,0,’x’);

若有下面的说明和定义struct test{ int ml; char m2; float m3;union uu {char ul[5]; int u2[2];} ua;} myaa;则sizeof(struct test )的值是A.12B.16C.14D.9

若下面程序运行时输出结果为1,A,10.1 2,B,3.5 include using namespace std; int mai 若下面程序运行时输出结果为1,A,10.12,B,3.5include <iostream>using namespace std;int main(){void test(int, char, doubie【 】);test(1, 'A', 10.1 );test(2, 'B');return 0;}void test(int a, char b, double c){cout<<a<<','<<b<<','<<c<<endl;}

要用字符数组保存字符串“test”的值,以下代码正确的是(). A.char a[5]; a="test";B.char a[4]="test";C.char a[4l; a = "test";D.char a[5]="test”:

考虑函数原型void test(int a,int b=7,char="*"),下面的函数调用中,属于不合法调用的是()A: test(5)B: test(5,8)C: test(6,"#")D: test(0,0,"*")

下列代码中,将引起一个编译错误的行是( )。 1)public class Test{ 2) int m,n; 3) public Test(){} 4) public Test(int a){m=a;} 5) public static void main(String args[]){ 6) Test t1,t2; 7) int j,k; 8) j=0;k=0; 9) t1=new Test(); 10) t2=new Test(j,k); 11) } 12)}A.第3行B.第5行C.第6行D.第10行

自动类型转换是按优先关系从低级数据转换成高级数据,规定的优先次序是( )。A.byte, short, char→int→long→float→doubleB.float→int→long→byte, short, char→doubleC.int→long→float→double→byte, short, charD.double→int→float→long→byte, short, char

void setmemory(char **p, int num){ *p=(char *) malloc(num);}void test(void){ char *str=NULL;getmemory(str,100);strcpy(str,"hello");printf(str);}运行test函数有什么结果?( )

下面代码的输出结果是多少?char var[10];int test(char var[]){return sizeof(var);};A.4SXB 下面代码的输出结果是多少?char var[10];int test(char var[]){return sizeof(var);};A.4B.9C.11D.10

3下列代码中,将引起一个编译错误的行是( )。 1)public class Test{ 2)int m,n; 3)public Test(){} 4)public Test(int a){m=a;} 5)public static void main(String args[]){ 6)Test t1,t2; 7)int j,k; 8)j=0; k=0; 9) t1=new Test(); 10)t2=new Test(j,k); 11)} 12)}A.第3行B.第5行C.第6行D.第10行

6 写出下列程序在X86 上的运行结果。struct mybitfields{unsigned short a : 4;unsigned short b : 5;unsigned short c : 7;}testvoid main(void){int i;test.a=2;test.b=3;test.c=0;i=*((short *)test);printf("%d\n",i);}

以下定义语句中,错误的是 ______。A.int a[]={1,2);B.char *a[3];C.char s[10]= "test";D.Int n=5,a[n];

有如下类定义: class Test { int x_,y_; public: Test ():a_(0) ,b_(0) {} Test(int a,int b=0) :a_(a),b_(b){} }; 若执行语句 Test x(2) ,y[3],*z[4]; 则Test类的构造函数被调用的次数是( )。A.2次B.3次C.4次D.5次

下列代码中,将引起一个编译错误的行是( )。 1)public class Test{ 2)int m,n; 3)public Test{} 4)public Test(int a){m=a;) 5)public static void main(String args[]){ 6)Test tl,t2; 7)int j,k; 8)j=0;k=0; 9)tl=new Test; 10)t2=new Test(j,k); 11)} 12)}A.第3行B.第5行C.第6行D.第l0行

下列程序的输出结果是______。 include using namespace std; class Test( public: Te 下列程序的输出结果是______。 #include<iostream> using namespace std; class Test( public: Test() {cnt++;} ~Test() {cnt--;} static int Count(){return cnt;} private: static int cnt; }; int Test::cnt=0; int main() { cout<<Test::Count()<<""; Test t1,t2; Test*pT3=new Test; Test*pT4=new Test; cout<<Test::Count()<<""; delete pT4; delete pT3; cout<<Test::Count()<<end1; return 0; }A.024B.042C.420D.240

若有下面的说明和定义: struct test { int m1; char m2; float m3; union uu {char ul[5]; int u2[2];} ua; }myaa;则sizeof(struct test)的值是( )。A.12B.16C.14D.9

阅读以下说明、C函数和问题,将解答写入答题纸的对应栏内。【说明1】函数test_fl(int m,im n)对整数m、n进行某种运算后返回一个整数值。【c函数1】int test_f1 (int m,int n){ int k;k=mn?m:n;for(; (k%m! =O) I I (k%n! =0);k++);return k;)【问题1】(5分)(1)请写出发生函数调用test_fl(9,6)时,函数的返回值;(2)请说明函数test_f1的功能。【说明2】设在某c系统中为每个字符分配1个字节,为每个指针分配4个字节,sizeof(x)计算为x分配的字节数。函数test_12Q用于测试并输出该c系统为某些数据分配的字节数。【c函数2】void test_f2(){ char str[] =“NewWorld”; char*p=str; char i=‘\0’; VOid*ptr=malloc(50);printf(”%d\t”,sizeof(str));printf(“%d\n”,sizeof(p)),printf(”%d\t”,sizeof(i)); printf(”%d\n”,sizeof(ptr));}【问题2】(4分)请写出函数test_f2()的运行结果。【说明3】函数test_f3(char S[])的功能是:将给定字符串S中的所有空格字符删除后形成的串保存在字符数组tstr中(串S的内容不变),并返回结果串的首地址。【C函数3】char*test_f3(const char s[])( char tstr[50]=(‘\0’); unslgned int i,k=0;for(i=0;i(strlen(s);i++)if(s[i]!=‘’)tstr[k++]=s[i];return tStr ;)【问题3】(6分)函数test_f3()对返回值的处理有缺陷,请指出该缺陷并说明修改方法。

下面关于整数的说法中正确的是()A、short类型占用2字节,int类型占用2字节,long类型占用8字节B、char类型占用1字节,short类型占用2字节long类型占用4字节C、short类型占用1字节,int类型占用2字节.long,类型占用4字节D、short类型占用2字节,int类型占用4字节,long类型占用8字节

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

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

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

单选题struct test{ Char a[3]; Int b[4]; Short c[5]; }; 一个test类型数据占用()个字节的空间。A28B29C30D32

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