以下程序段,输出结果为()。int y=10;while(y--);printf("y=%d/n",y);
A.while构成死循环
B.y=-1
C.y=0
D.y=1
A.while构成死循环
B.y=-1
C.y=0
D.y=1
以下程序段的输出结果为()。 int j=2 switch (j){ Case 2: system.out.print("two."): Case 2+1: System.out.println("three."); break: default: System.out.println (“value is”+j): Break }A.B.two
A.two.three.
B.two
C.three
D.value is 2
若变量都已正确说明,则以下程序段输出结果为()。 #include<stdio.h> main() {char a='a'; int b=2; printf(a>b?”***a=%d":"###b=%d",a,B; }
A.***a=3
B.###b=3
C.***a=3##b=5
D.全部错误
下列程序段执行后的输出结果为 int x=3; int y=10; System.out.println(y%x);
A.0
B.1
C.2
D.3
请选出以下程序段的输出结果 ()。 #include <iostream> using namespace std; #define MIN(x,y) (x)<(y) ?(x) : (y) int main () { int i,j,k; i=10; j=15; k=10*MIN(i,j); cout<<k<<end1; return 0; }
A.15
B.100
C.10
D.150
下面程序段的输出结果为 package test; public class ClassA { int x=20; static int y=6; public static void main(String args[]) { ClassB b=new ClassB(); b.go(10); System.out.println("x="+b.x); } } class ClassB { int x; void go(int y) { ClassA a=new ClassA(); x=a.y; } }
A.x=10
B.x=20
C.x=6
D.编译不通过
下面程序段的输出结果为 package test; public class Class A { int x=20; static int y=6; public static void main(String args[]) { Class B b=new Class B(); b.go(10); System.out.println("x"+b.x); } } class ClassB { int x; void go(int y) { ClassA a=new ClassA(); x=a.y; } }
A.x=10
B.x-20
C.x=6
D.编译不通过
A.data的每个成员起始地址都相同
B.变量data所占内存字节数与成员c所占字节数相等
C.程序段:data.a=5;printf("%f\n",data.c);输出结果为5.000000
D.data可以作为函数的实参
下面程序段的输出结果为 public class Test { int a,b; Test() { a=100; b=200; } Test(int x,int y) { a=x; b=y; } public static void main(String args[]) { Test Obj1=new Test(12,45); System.out.println(”a=”+Obj 1.a+” b=”+Obj 1.b); Test Obj2=new Test(); System.out.println(”a=”+Obj 2.a+” b=”+Obj 2.b); } }
A.a=100 b=200 a=12 b=45
B.a=12 b=45 a=100 b=200
C.a=12 b=200 a=100 b=45
D.a=100 b=45 a=12 b=200
3下面程序段的输出结果为()。public class Test{ int a, b; Test() { a=100; b=200; } Test(int x, int y) { a=x; b=y; } public static void main(String args[]) { Test Obj 1 = new Test(12,45 ); System.out.println("a="+Obja+" b="+Objb); Test Obj2 = new Test(); System.out.println("a="+Obja+" b="+Objb); }}
A.a=100 b=200 a=12 b=45
B.a=12 b=45 a=100 b=200
C.a=12 b=200 a=100 b=45
D.a=100 b=45 a=12 b=200
A.两个共用体变量之间可以相互赋值
B.变量data所占内存字节数与成员c所占字节数相等
C.程序段:data.a=5;printf("%f\n",data.c);输出结果为5.000000
D.共用体在初始化时只能用第一个成员的类型进行初始化
下面程序段的输出结果为()。 public class Test { int a,b; Test { a=100; b=200: } Test(int X,int y) { a=x: b=y; } public static void main(String args[]) { Test bjl=new Test(12,45); System.OUt.println("a="+Objl.a+"b="+Objl. b); Test Obj2=new Test; System.out.println("fl="+Obj2.a+"b="+Obj2. b); } }
A.a=100 b=200 a=12 b=45
B.a=12 b=45a=100 b=200
C.a=12 b=200 a=100 b=45
D.a=100 b=45 a=12 b=200