A.4
B.5
C.6
D.7
第1题:
已知如下定义,则sizeof(a)的值是 struct{ int i; char c; double a;}a;
A.8
B.9
C.10
D.11
第2题:
设有以下程序,其运行输出结果为? class Test{ Test(int i) { System.out.println("Test(" +i +")"); } } public class Q12 { static Test t1 = new Test(1); Test t2 = new Test(2); static Test t3 = new Test(3); public static void main(String[ ] args){ Q12 Q = new Q12(); } }
A.Test(1) Test(2) Test(3)
B.Test(3) Test(2) Test(1)
C.Test(2) Test(1) Test(3)
D.Test(1) Test(3) Test(2)
第3题:
有一个类Test,下面为其构造方法的声明,正确的是()。
A.void Test(int i){}
B.test(int i){}
C.void test(int i){}
D.Test(int i){}
第4题:
6 写出下列程序在X86 上的运行结果。
struct mybitfields
{
unsigned short a : 4;
unsigned short b : 5;
unsigned short c : 7;
}test
void main(void)
{
int i;
test.a=2;
test.b=3;
test.c=0;
i=*((short *)&test);
printf("%d\n",i);
}
第5题:
已知: char c; int x; 则执行x=sizeof(c);后,x的值是________。