单选题What is the result?()A The output is X = 6 y = 0B The output is x = 7 y = 0C The output is x = 6 y = -1D The output is x = 7 y = -1E Compilation will fail.
单选题
What is the result?()
A
The output is X = 6 y = 0
B
The output is x = 7 y = 0
C
The output is x = 6 y = -1
D
The output is x = 7 y = -1
E
Compilation will fail.
参考解析
解析:
暂无解析
相关考题:
program exam(output); var x,y,x:integer; proedure silly(x:integer;vary:integer); begin x:=5;y:=6;z:=3; writeln(x,y,z) end; begin x:=1;y:=2;z:=3; silly(x,y); writeln(x,y,z) end. 以上程序运行结果为(). A567 563B567 567C567 167D567 163
下面程序的输出为( )。 public class Test { public static void main (String args[]) { int x,y; x=1; y=2; System.out.println("The output is"+x+y); } }A.The output is xyB.The output is 3C.The output is 12D.The output is x=1 y=2
使用VC6打开考生文件夹下的工程test20_3,此工程包含一个源程序文件tes00_3.cpp,其中定义了用于表示复数的类comp,但类comp的定义并不完整。请按要求完成下列操作,将类comp的定义补充完整。(1)定义comp的构造函数,函数含参数x和y,它们都是in,型的数据,默认值都为0,请使用参数列表的形式分别将类数据成员a和b初始化x和y的值。请在注释“//**1**”之后添加适当的语句。(2)完成类comp的成员函数input(int x,int y)的定义,将int型的参数x和y分别赋值给数据成员s和b,请在注释“//**2**”之后添加适当的语句;(3)完成类comp的友元函数friend compplus(comp x,comp y)的定义,该函数首先要定义一个comp类的对象c,然后将参数x和y的数据成员a与b分别相加并分别赋值给c的成员a和b,最后返回c的值,请在注释“//**3**”之后添加适当的语句。输出结果如下:10+20i2+3iresult:12+23i注意:除在指定位置添加语句之外,请不要改动程序中的其他内容。源程序文件test20_3.cpp清单如下:include <iostream.h>class comp{int a;int b;public://**1**friend comp plus(comp x, comp y);void input(int x,int y){//**2**}void output ( ){cout<<a<<'+'<<b<<"i"<<end1;}};comp plus(comp x, comp y){//**3**c.b=x.b+y.b;return c;}void main(){comp x(10,20),y,z;y.input(2,3);z=plus(x,y);x.output();y.output();cout<<"result:";z.output();}
intx=1,y=6;while(y--){x++;}System.out.println(x=”+x+y=”+y);Whatistheresult?() A.x=6y=0B.x=7y=0C.x=6y=-1D.x=7y=-1E.Compilationfails.
阅读以下C++代码,填充(1)~(5)的空缺,将解答填入答题纸的对应栏内。 【说明】在下面程序横线处填上适当的字句,使其输出结果为:x=5x=6y=7x=8z=9【程序】#include<iostream.h>class X1{int x;(1):X1(int xx=0){x=xx;}(2)void Output()(cout<<"x="<<x<<end;}};(3)Y1:public X1{int y;public:Y1(int xx=0,int yy=0):X1(xx){y=yy;}(2)void Output(){(4)Output();cout<<"y="<<y<<end1;}};class Z1:pubtic X1{int z:(5):Z1(int xx=0,int zz=0):X1(xx){z=zz;}②void Output(){X1::Output();cout<<"z="<<z<<end1;}};void main(){X1 a(5);Y1 b(6,7);Z1 c(8,9);X1*p[3]={For(int i=0;i<3;i++){p[i]-->Output();cout<<end1;}}
设以下变量均为int类型,则值不等于7的表达式是( )A.(x=y=6,x+y,x+1)B.(x=y=6,x+y,y+1)C.(x=6,x+1,y=6,x+y)D.(y=6,y+1,x=y,x+1)
如果输入的数据是2,3,4,则下面程序的输出应为() PROGRAM SAM(INPUT,OUTPUT); VAR i,x,y:integer; BEGIN FOR i:=1 TO 3 DO BEGIN Read(x); y:=sqr(x)END; Writeln(‘x=’,x,‘y=’,y)END.A、x=2 y=4 x=3 y=9 x=4 y=16B、x=4 y=16 x=4 y=16 x=4 y=16C、x=4 y=16D、x=2 y=4 x=2 y=4 x=2 y=4
int x=0; int y 10; do { y--; ++x; } while (x 5); System.out.print(x + “,“ + y); What is the result?() A、 5,6B、 5,5C、 6,5D、 6,6
1. public class X implements Runnable( 2. private int x; 3. private int y; 4. 5. public static void main(String[]args) 6. X that = new X(); 7. (new Thread(that)).start(); 8. (new Thread(that)).start(); 9. ) 10. 11. public void run() ( 12. for (;;) ( 13. x++; 14. y++; 15. System.out.printIn(“x=” + x + “, y = ” + y); 16. ) 17. ) What is the result?()A、 Errors at lines 7 and 8 cause compilation to fail.B、 The program prints pairs of values for x and y that might not always be the same on the same line (for example, “x=2, y=1”).C、 The program prints pairs of values for x and y that are always the same on the same line (for example, “x=1, y=1”. In addition, each value appears twice (for example, “x=1, y=1” followed by “x=1, y=1”).D、 The program prints pairs of values for x and y that are always the same on the same line (for example, “x=1, y=1”. In addition, each value appears only for once (for example, “x=1, y=1” followed by “x=2, y=2”).
public class WhileFoo { public static void main (String []args) { int x= 1, y = 6; while (y--) {x--;} system.out.printIn(“x=” + x “y =” + y); } } What is the result?() A、 The output is x = 6 y = 0B、 The output is x = 7 y = 0C、 The output is x = 6 y = -1D、 The output is x = 7 y = -1E、 Compilation will fail.
public class X implements Runnable ( private int x; private int y; public static void main(String args) ( X that = new X(); (new Thread(that)) . start( ); (new Thread(that)) . start( ); ) public synchronized void run( ) ( for (;;) ( x++; y++; System.out.printIn(“x = “ + x + “, y = “ + y); ) ) ) What is the result?()A、 An error at line 11 causes compilation to fail.B、 Errors at lines 7 and 8 cause compilation to fail.C、 The program prints pairs of values for x and y that might not always be the same on the same line (for example, “x=2, y=1”)D、 The program prints pairs of values for x and y that are always the same on the same line (forexample, “x=1, y=1”. In addition, each value appears twice (for example, “x=1, y=1” followed by “x=1, y=1”)E、 The program prints pairs of values for x and y that are always the same on the same line (for example, “x=1, y=1”. In addition, each value appears twice (for example, “x=1, y=1” followed by “x=2s, y=2”)
设以下变量均为int类型,则值不等于7的表达式是()。A、(x=y=6,x+y,x+1)B、(x=y=6,x+y,y+1)C、(x=6,x+1,y=6,x+y)D、(y=6,y+1,x=y,x+1)
public class IfTest ( public static void main(string[]args) { int x = 3; int y = 1; if (x = y) system.out.printIn(“Not equal”); else system.out.printIn(“Equal”); } ) What is the result?() A、 The output is “Equal”B、 The output in “Not Equal”C、 An error at line 5 causes compilation to fall.D、 The program executes but does not print a message.
public class IfTest ( public static void main(stringargs) { int x = 3; int y = 1; if (x = y) system.out.printIn(“Not equal”); else system.out.printIn(“Equal”); } ) What is the result?()A、 The output is “Equal”B、 The output in “Not Equal”C、 An error at line 5 causes compilation to fall.D、 The program executes but does not print a message.
int x = 1, y =6; while (y--) { x++; } System.out.println(“x =” + x + “y =” +y); What is the result?() A、 x = 6 y = 0B、 x = 7 y = 0C、 x = 6 y = -1D、 x = 7 y = -1E、 Compilation fails.
int x = 3; int y = 1; if (x = y) { System.out.println(“x = “ + x); } What is the result? ()A、x=1B、x=3C、Compilationensp;fails.D、Theensp;codeensp;runsensp;withensp;noensp;output.ensp;E、Anensp;exceptionensp;isensp;thrownensp;atensp;runtime.
单选题int x = 3; int y = 1; if (x = y) { System.out.println(“x = “ + x); } What is the result? ()Ax=1Bx=3CCompilationensp;fails.DTheensp;codeensp;runsensp;withensp;noensp;output.ensp;EAnensp;exceptionensp;isensp;thrownensp;atensp;runtime.
单选题public class IfTest ( public static void main(stringargs) { int x = 3; int y = 1; if (x = y) system.out.printIn(“Not equal”); else system.out.printIn(“Equal”); } ) What is the result?()A The output is “Equal”B The output in “Not Equal”C An error at line 5 causes compilation to fall.D The program executes but does not print a message.
单选题int x = 1, y =6; while (y--) { x++; } System.out.println(“x =” + x + “y =” +y); What is the result?()A x = 6 y = 0B x = 7 y = 0C x = 6 y = -1D x = 7 y = -1E Compilation fails.
单选题public class X implements Runnable( private int x; private int y; public static void main(Stringargs) X that = new X(); (new Thread(that)).start(); (new Thread(that)).start(); ) public void run() ( for (;;) ( x++; y++; System.out.printIn(“x=” + x + “, y = ” + y); ) ) What is the result?()A Errors at lines 7 and 8 cause compilation to fail.B The program prints pairs of values for x and y that might not always be the same on the same line (for example, “x=2, y=1”).C The program prints pairs of values for x and y that are always the same on the same line (for example, “x=1, y=1”. In addition, each value appears twice (for example, “x=1, y=1” followed by “x=1, y=1”).D The program prints pairs of values for x and y that are always the same on the same line (for example, “x=1, y=1”. In addition, each value appears only for once (for example, “x=1, y=1” followed by “x=2, y=2”).
单选题如果输入的数据是2,3,4,则下面程序的输出应为() PROGRAM SAM(INPUT,OUTPUT); VAR i,x,y:integer; BEGIN FOR i:=1 TO 3 DO BEGIN Read(x); y:=sqr(x)END; Writeln(‘x=’,x,‘y=’,y)END.Ax=2 y=4 x=3 y=9 x=4 y=16Bx=4 y=16 x=4 y=16 x=4 y=16Cx=4 y=16Dx=2 y=4 x=2 y=4 x=2 y=4
单选题public class WhileFoo { public static void main (String []args) { int x= 1, y = 6; while (y--) {x--;} system.out.printIn(“x=” + x “y =” + y); } } What is the result?()A The output is x = 6 y = 0B The output is x = 7 y = 0C The output is x = 6 y = -1D The output is x = 7 y = -1E Compilation will fail.
单选题int x=0; int y 10; do { y--; ++x; } while (x 5); System.out.print(x + “,“ + y); What is the result?()A 5,6B 5,5C 6,5D 6,6
单选题public class X implements Runnable ( private int x; private int y; public static void main(String [] args) ( X that = new X(); (new Thread(that)) . start( ); (new Thread(that)) . start( ); ) public synchronized void run( ) ( for (;;) ( x++; y++; System.out.printIn(“x = “ + x + “, y = “ + y); ) ) ) What is the result?()A An error at line 11 causes compilation to fail.B Errors at lines 7 and 8 cause compilation to fail.C The program prints pairs of values for x and y that might not always be the same on the same line (for example, “x=2, y=1”)D The program prints pairs of values for x and y that are always the same on the same line (for example, “x=1, y=1”. In addition, each value appears twice (for example, “x=1, y=1” followed by “x=1, y=1”)E The program prints pairs of values for x and y that are always the same on the same line (for example, “x=1, y=1”. In addition, each value appears twice (for example, “x=1, y=1” followed by “x=2s, y=2”)
单选题What is the result?()A The output is X = 6 y = 0B The output is x = 7 y = 0C The output is x = 6 y = -1D The output is x = 7 y = -1E Compilation will fail.