网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
单选题
forIinrange(2):print(’hi’)的结果()。
A
打印两次hi
B
打印两次2
C
打印一次2
D
打印一次hi
参考答案
参考解析
解析:
暂无解析
更多 “单选题forIinrange(2):print(’hi’)的结果()。A 打印两次hiB 打印两次2C 打印一次2D 打印一次hi” 相关考题
考题
下列程序的输出结果是 ( )#includeusing namespace std;class A{int apublic:A():a(9){}virtual void print() const {cout};class B:public A{char b;public:B(){b= ‘S’;}void print()const{cout};void show(AaX){X,print()}int main(){ Ad1;*p;Bd2;p=d2;d1,print();d2,print();p-print();show(d1);show(d2);return 0;}
考题
现有:classThreadBothextendsThreaaimplementsRunnable{publicvoidrun()(System.out.print(hi);}publicstaticvoiclmain(String[]args){Threadtl=newThreadBoth():Threadt2=newThread(tl):tl.run():t2.run():}结果为:()A.hihiB.hiC.编译失败D.运行时异常被抛出
考题
下列程序段的执行结果为 a=2 b=0 Select Case a Case 1 Select Case b Case 0 Print " * * 0 * *" Case 1 Print" * * 1 * *" End selec Case 2 Print " * * 2 * *" End SelectA.* * 0 * *B.* * 1 * *C.* * 2 * *D.0
考题
下列程序的输出结果是【】。 include using namespace std; class A {int a; public:A()
下列程序的输出结果是【 】。include <iostream>using namespace std;class A {int a;public:A():a(9){}virtual void print() const { cout<<a;};};class B: public A {char b;public:B( ){b='S';}void print() const {cout<<b;}};void show(A x){ x.print0;}int main(){ Ad1,*p;B d2;p=d2;d1.print();d2.print0;p->print();show(d1);show(d2);return 0;}
考题
语句Print Sgn(-6^2)+Abs(-6^2)+Int(-6^2)的输出结果是( )。A.-36B.1C.-1S
语句Print Sgn(-6^2)+Abs(-6^2)+Int(-6^2)的输出结果是( )。A.-36B.1C.-1D.-72
考题
下列语句的输出结果是______。 (说明:'\b'是退格符)printf("a\bre\'hi\'y\\\bou\n");A.a\bre\'hi\'y\\\bouB.a\bre\'hi\'y\bouC.re'hi'youD.abre'hi'y\bou
考题
下面程序的输出结果是includeclass example{ int a;public: example(int b){a=b++;
下面程序的输出结果是 #include<iostream.h> class example { int a; public: example(int b){a=b++;} void print(){a=a+1; cout<<a<<" ";} void print()const{cout<<a<<" ";} }; void main() { example x(3); const example y(2); x.print(); y.print(); }A.2 2B.4 3C.4 2D.3 2
考题
若变量a和b的取值为a='1'b=2 则,下面描述错误的是?
A.print(int(a)+b)结果是3B.print(a+b)结果是TypeError:mustbestr,notintC.print(a+str(b))结果是12D.print(a+str(b))结果是3
考题
下面程序段的输出结果是:int a = 2;System.out.print( a++);System.out.print( a);System.out.print(++a);
A.333B.334C.234D.233
考题
语句printf("a/bre/’hi/’y///bou/n");的输出结果是(说明:’/b’是退格符)().A、a/bre/’hi/’y///bouB、a/bre/’hi/’y/bouC、re’hi’youD、abre’hi’y/bou
考题
class Guy { String greet() { return "hi "; } } class Cowboy extends Guy { String greet() { return "howdy "; } } class Wrangler extends Cowboy { String greet() { return "ouch! "; } } class Greetings2 { public static void main(String [] args) { Guy g = new Wrangler(); Guy g2 = new Cowboy(); Wrangler w2 = new Wrangler(); System.out.print(g.greet()+g2.greet()+w2.greet()); } } 结果是什么?() A、hi hi ouch!B、hi howdy ouch!C、ouch! howdy ouch!D、编译失败
考题
class Guy{String greet(){return “hi“}} class Cowboy extends Guy {String greet(){return“howdy”}} class Surfer extends Guy {String greet(){return“dudel”}} class Greetings{ public static void main (string[]args){ Guy[] guy= {new Guy(),new Cowboy(),new Surfer()}; for(Guy 0: guys) System.out.print(g.green()); } } 结果为: A、运行时异常被输出B、第7行出现一个错误,编译失败C、第8行出现一个错误,编译失败D、hi hi hiE、hi hawdy doude
考题
class ThreadBoth extends Thread implements Runnable { public void run(){ System.out.print("hi "); } public static void main(String [] args){ Thread t1 = new ThreadBoth(); Thread t2 = new Thread(t1); t1.run(); t2.run(); } } 结果为:() A、hiB、hi hiC、编译失败D、代码运行,但无输出结果
考题
现有: class ThreadBoth extends Threaa implements Runnable { public void run() (System.out.print("hi"); } public static voicl main (String [] args) { Thread tl=new ThreadBoth(): Thread t2 = new Thread (tl): tl.run(): t2.run(): } 结果为:() A、 hi hiB、 hiC、编译失败D、运行时异常被抛出
考题
单选题class ThreadBoth extends Thread implements Runnable { public void run(){ System.out.print("hi "); } public static void main(String [] args){ Thread t1 = new ThreadBoth(); Thread t2 = new Thread(t1); t1.run(); t2.run(); } } 结果为:()A
hiB
hi hiC
编译失败D
代码运行,但无输出结果
考题
单选题现有: class Guy { String greet() { return "hi"; } } class Cowboy extends Guy { String greet() { return. "howdy";}} class Wrangler extends Cowboy { String greet() { return "orch!"; } } class Greetings2 { public static void main (String [] args) { Guy g=new Wrangler(); Guy g2=new Cowboy(); Wrangler w2=new Wrangler(); System. out .print (g.greet()+g2.greet()+w2 .greet()); } } 结果是什么?()A
hi hi ouch!B
ouch! howdy ouch!C
hi howdy ouch!D
编译失败E
运行的咐候有异常抛出
考题
单选题class Guy { String greet() { return "hi "; } } class Cowboy extends Guy { String greet() { return "howdy "; } } class Wrangler extends Cowboy { String greet() { return "ouch! "; } } class Greetings2 { public static void main(String [] args) { Guy g = new Wrangler(); Guy g2 = new Cowboy(); Wrangler w2 = new Wrangler(); System.out.print(g.greet()+g2.greet()+w2.greet()); } } 结果是什么?()A
hi hi ouch!B
hi howdy ouch!C
ouch! howdy ouch!D
编译失败
考题
单选题现有: class ThreadBoth extends Threaa implements Runnable { public void run() (System.out.print("hi"); } public static voicl main (String [] args) { Thread tl=new ThreadBoth(): Thread t2 = new Thread (tl): tl.run(): t2.run(): } 结果为:()A
hi hiB
hiC
编译失败D
运行时异常被抛出
考题
判断题表达式(i*2foriinrange(10))的结果是个字典。A
对B
错
热门标签
最新试卷