有以下程序 union myun { struct {int x,y,z;}u; int k; }a; main() { a.u.x=4;a.u.y=5;a,u.z=6; a.k=0; printf("%d\n",a.u.x); } 程序运行后的输出结果是( )
A.4
B.5
C.6
D.0
第1题:
变量a所占内存字节数是______。 union U { char st[4]; int i; long 1; }; struct A { int c; union U u; }a;
A.4
B.5
C.6
D.8
第2题:
下列程序的输出结果是( )。
#include<stdio.h>
main()
{ stmct st
{ int y,x,z;
};
union
{ long i;
int j;
char k;
}un;
printf("%d,%d\n",sizeof(stmct st),sizeof(un));
}
A.6,2
B.6,4
C.8,4
D.8,6
第3题:
下列程序的运行结果是 #include"stdio.h" main() { intx=-9,y=5,z=8; if(x<y) if(y<0)z=0; else z+=1; printf("%d\n",z);}
A.6
B.7
C.8
D.9
第4题:
有以下程序:
include <iostream>
using namespace std;
void t(int x,int y, int cp,int dp)
{
cp=x*x+y+y;
dp=x*x-y*y;
}
int main()
{
int a=4,b=3,c=5,d=6;
t(a,b,c,D) ;
cout<<c<<","<<d<<end1;
return 0;
第5题:
以下程序输出结果是 ______。 #include<iostream.h> void fun(int x,int y,int z){z=x+y;} void main() { int a=10; fun (2,2,a); cout<<a; }
A.0
B.4
C.10
D.无定值
第6题:
有如下程序段#include "stdio.h"typedef union{ long x[2]; int y[4]; char z[8];}atx;typedef struct aa { long x[2]; int y[4]; char z[8];} stx;main(){ printf("union=%d,struct aa=%d\n",sizeof(atx),sizeof(stx));}则程序执行后输出的结果是A.union=8,struct aa=8 B.union=8,struct aa=24C.union=24,struct aa=8 D.union=24,struct aa=24
第7题:
设有以下说明和定义: #include<iostream. h> Void main() { typedef union { long i; int k[5]; char c; } DATE; struct date {int cat; DATE cow; double dog; }too; DATE max; cout<<(sizeof(struct date)+sizeof(max))<<end1;}
A.26
B.52
C.18
D.8
第8题:
以下程序的输出结果是( )。 union myun { struct {int x,y,z;)u; int k: }a; main { a.u.x=4;a.u.y=5;a.u.z=6; k=0; printf(%d\n",a.u.x); }
A.4
B.5
C.6
D.0
第9题:
有以下程序: #include <stdio.h> fun(int x,int y,int z) { z=x*y;} main() { int a=4,b=2,c=6; fun(a,b,c); printf("%d",c); } 程序运行后的输出结果是( )。
A.16
B.6
C.8
D.12
第10题:
若有以下程序: #include<iostream> usingnamespacestd; voidsub(intx,inty,int*2) { *z=y+x; } int main() { int a,b,C; sub(8,4,&A) ; sub(6,a,&B) ; sub(a,b,&C) ; cout<<a<<","<<b<<","<<c<<end1; return 0; }
A.12,18,30
B.-12,6,8
C.6,8,10
D.12,-18,16
第11题:
以下程序的输出结果是 union myun { struct { int x,y,z;} u; int k;} a; main() { a.u.x=4;a.u.y=5;a.u.z=6; a.k=0; printf("%d\n",a.u.x);}
A.4
B.5
C.6
D.0
第12题:
0
9
6
8
第13题:
下列程序的输出结果是( )。 #include<stdio.h> main() { struct st { int y,x,z; }; union { long i; int j; char k; }un; printf("%d,%d\n",sizeof(struct st),sizeof(un)); }
A.6,2
B.6,4
C.8,4
D.8,6
第14题:
下列程序的输出结果是( )。 #include <stdio.h> main() { struct st { int y,x,z; }; union { long i; int j; char k; } un; printf("%d,%d\n",sizeof(struct st),sizeof(un)); }
A.6, 2
B.6, 4
C.8, 4
D.8, 6
第15题:
有以下程序 #include <stdio.h> intf(int x) { int y; if(x==0||x==1) return(3); y=x*x-f(x-2); return y; } main() { int z; z=f(3); printf("%d\n",z); } 程序的运行结果是
A.0
B.9
C.6
D.8
第16题:
变量a所占的内存字节数是 ______。
A.4
B.5
C.6
D.8 union U { char st[4]; int i; long l; }; Struct A{ int c; union U u; }a;
第17题:
有以下程序 #include <stdio.h> int f(int x) { int y; if(x==0||x==1) return(3); y=x*x-f(x-2); return y; } main() { int z; z=f(3); printf("%d\n",z); } 程序的运行结果是
A.0
B.9
C.6
D.8
第18题:
若有以下程序段; #include<iostream> using namespace std; int main() { int a[]={1,4,5}; int *p=&a[0],x=6,y,z; for(y=0;y<3;y++) z=((*(p+y)<x) ? *(p+y):x); cout<<z<<end1; return 0; } 程序运行后的输出结果是( )。
A.1
B.4
C.5
D.2
第19题:
以下程序的输出结果是 #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.10
B.13
C.7
D.8
第20题:
以下程序的输出结果是( ) # 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.10
B.13
C.7
D.8
第21题:
有以下程序: #include <sldio.h> main() { int x=0,y=5,z=3; while(z-->0&& ++x<5) y=y-1; printf("%d,%d,%d\n",x,y,z); } 程序执行后的输出结果是( )。
A.3,2,0
B.3,2,-1
C.4,3,-1
D.5,-2,-5
第22题:
下面程序的输出结果是( )。#include<iostream.h>void main(){int x=-1,y=5,z;z=(x++<0)&& (y-->=0);cout<<x<<'\t'<<y<<'\t'<<z<<end1;}
A.-1 5 0
B.-1 4 1
C.0 4 1
D.0 4 0
第23题:
6
5
4
3