首页 > 软考
题目内容 (请给出正确答案)
[单选题]

以下程序段,输出结果为()。int y=10;while(y--);printf("y=%d/n",y);

A.while构成死循环

B.y=-1

C.y=0

D.y=1

查看答案
答案
收藏
如果结果不匹配,请 联系老师 获取答案
您可能会需要:
您的账号:,可能还需要:
您的账号:
发送账号密码至手机
发送
安装优题宝APP,拍照搜题省时又省心!
更多“以下程序段,输出结果为( )。int y=10;while(…”相关的问题
第1题
以下程序段的输出结果为()。int j=2switch (j){Case 2:system.out.print("two."):Case 2+1:System

以下程序段的输出结果为()。 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

点击查看答案
第2题
若变量都已正确说明,则以下程序段输出结果为()。#include<stdio.h>main(){char a='a';int b=2;pri

若变量都已正确说明,则以下程序段输出结果为()。 #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.全部错误

点击查看答案
第3题
下列程序段执行后的输出结果为 int x=3;inty=10; System.out.println(y%x);A.0B.1C.2D.3

下列程序段执行后的输出结果为 int x=3; int y=10; System.out.println(y%x);

A.0

B.1

C.2

D.3

点击查看答案
第4题
请选出以下程序段的输出结果 ()。#include <iostream>using namespace std;#define MIN(x,y)(x)<

请选出以下程序段的输出结果 ()。 #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

点击查看答案
第5题
下面程序段的输出结果为package test;public class ClassA{int x=20;static int y=6;public stat

下面程序段的输出结果为 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.编译不通过

点击查看答案
第6题
下面程序段的输出结果为package test;public class Class A{ int x=20; static int y=6; public

下面程序段的输出结果为 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.编译不通过

点击查看答案
第7题
若有以下说明和定义 union dt {int a;char b;double c;}data; 以下叙述中错误的是

A.data的每个成员起始地址都相同

B.变量data所占内存字节数与成员c所占字节数相等

C.程序段:data.a=5;printf("%f\n",data.c);输出结果为5.000000

D.data可以作为函数的实参

点击查看答案
第8题
下面程序段的输出结果为public class Test{int a,b;Test(){ a=100; b=200; } Test(int x,int y)

下面程序段的输出结果为 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

点击查看答案
第9题
3下面程序段的输出结果为()。public class Test{int a, b;Test(){ a=100; b=200;} Test(int x, in

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

点击查看答案
第10题
若有以下说明和定义,以下叙述中错误的是()。union dt{ int a;char b;double c;}data;

A.两个共用体变量之间可以相互赋值

B.变量data所占内存字节数与成员c所占字节数相等

C.程序段:data.a=5;printf("%f\n",data.c);输出结果为5.000000

D.共用体在初始化时只能用第一个成员的类型进行初始化

点击查看答案
第11题
下面程序段的输出结果为()。 public class Test { int a,b; Test { a=100; b=200: } Test(i

下面程序段的输出结果为()。 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

点击查看答案
退出 登录/注册
发送账号至手机
密码将被重置
获取验证码
发送
温馨提示
该问题答案仅针对搜题卡用户开放,请点击购买搜题卡。
马上购买搜题卡
我已购买搜题卡, 登录账号 继续查看答案
重置密码
确认修改