网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
下列程序的输出结果是 。 try: print(2/'0') except ZeroDivisionError: print('AAA') except Exception: print('BBB')
参考答案和解析
BBB
更多 “下列程序的输出结果是 。 try: print(2/'0') except ZeroDivisionError: print('AAA') except Exception: print('BBB')” 相关考题
考题
下列程序的输出结果是 ( )#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;}
考题
( 15 )下列程序的输出结果是 【 15 】 。#includeusing namespace std;class A {int a;public:A():a(9){}virtual void print() const { couta;};};class B : public A {char b;public:B( ){b='S';}void print( ) const { cout b;}};void show(A x){ x.print();}int main(){ A d1,*p;B d2;p=d2;d1.print();d2.print();p-print();show(d1);show(d2);return 0;}
考题
下列程序段的执行结果是( )。 a = 1: b = 0 Select Case a Case 1 Select Case b Case 0 Print "**0**" Case 1 Print "**1**" End Select Case 2 Print "**2**" End Select
A. **0**B. **1**C. **2**D. 0
考题
publicclassTestApp{publicstaticvoidmain(String[]args){try{inti=0;intj=1/i;Stringmyname=null;if(myname.length()2)System.out.print(1”);}catch(NullPointerExceptione){System.out.print(2”);}catch(Exceptione){System.out.print(3”);}}}上述程序运行后的输出是哪项?()A.3B.2C.231D.32
考题
staticvoidtest()throwsRuntimeException{try{System.out.print(”test);thrownewRuntimeException();}catch(Exceptionex){System.out.print(”exception);}}publicstaticvoidmain(String[]args){try{test();}catch(RuntimeExceptionex){System.out.print(”runtime);}System.out.print(”end);}Whatistheresult?()A.testendB.Compilationfails.C.testruntimeendD.testexceptionendE.AThrowableisthrownbymainatruntime.
考题
staticvoidtest(){try{Stringx=null;System.out.print(x.toString()+);}finally{System.out.print(finally);}}publicstaticvoidmain(String[]args){try{test();}catch(Exceptionex){System.out.print(”exception);}}Whatistheresult?()A.nullB.finallyC.nullfinallyD.Compilationfails.E.finallyexception
考题
下列程序的输出结果是【】。 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;}
考题
有如下程序: include using namespace std; class TestClass { private: int x,y; pu
有如下程序: #include<iostream> using namespace std; class TestClass { private: int x,y; public: TestClass (int i,int j) { x=i; y=j; } void print() { cout<<"print1"<<end1; } void print()const { cout<<"print2"<<end1; } }; int main() { const TestClass a(1,2); a.print(); return 0; } 该程序运行后的输出结果是( )。A.print1B.print2C.print1 print2D.程序编译时出错
考题
有如下程序: #includediostream usingnamespacestd; classTestClass {private: intX,y; public: TestClass(inti,intj) {x=i; y=j;} voidprint() {cout"printl"endl;} voidprint()const {cout"print2"endl;}}; intmain() {constTestClassa(1,2); print(); return0;} 该程序运行后的输出结果是( )。A.printlB.print2C.printlprint2D.程序编译时出错
考题
给定以下JAVA代码,这段代码编译运行后输出的结果是( )publicclassTest{publicstaticintaMethod(inti)throwsException{try{returni/10;}catch(Exceptionex){thrownewException("exceptioninaaMothod");}finally{System.out.print("finally");}}publicstaticvoidmain(String[]args){try{aMethod(0);}catch(Exceptionex){System.out.print("exceptioninmain");}System.out.print("finished");}}A、finallyexceptioninmainfinishedB、exceptioninmainfinallyC、finallyfinishedD、finallyexceptioninmainfinished
考题
下列程序的输出结果是()。 include main() {int a=4;print f("%d\n", (a+=a-=a*a)); }A
下列程序的输出结果是( )。 #include<stdio.h> main() { int a=4; print f("%d\n", (a+=a-=a*a)); }A.-8B.14C.0D.-24
考题
对窗体编写如下事件过程: Private Sub Form. MouseDown(Button As Integer,Shift As Integer, _ x As Single, Y As Single) If Button=2 Then Print "AAA" End If End Sub Private Sub Form. MouseUp (Button As Integer,Shift As Integer,_ x As Single,Y As Single) Print "BBB" End Sub 程序运行后,如果单击鼠标右键,则输出结果为 ______。A.AAA BBBB.BBBC.AAA AAAD.BBB
考题
下面程序段的输出结果是:int a = 2;System.out.print( a++);System.out.print( a);System.out.print(++a);
A.333B.334C.234D.233
考题
static void test() throws RuntimeException { try { System.out.print(”test “); throw new RuntimeException(); } catch (Exception ex) { System.out.print(”exception “); } } public static void main(String[] args) { try { test(); } catch (RuntimeException ex) { System.out.print(”runtime “); } System.out.print(”end “); } What is the result?() A、 test endB、 Compilation fails.C、 test runtime endD、 test exception endE、 A Throwable is thrown by main at runtime.
考题
public class TestApp{ public static void main(String[] args){ try{ int i = 0; int j = 1 / i; System.out.println(“1”); } catch(Exception e){ System.out.print(“3”); } finally{ System.out.print(“4”); } } } 上述程序运行后的输出是哪项?() A、 4B、 34C、 43D、 14
考题
public class TestApp{ public static void main(String[] args){ try{ int i = 0; int j = 1 / i; String myname=null; if(myname.length()2) System.out.print(“1”); }catch(NullPointerException e){ System.out.print(“2”); } catch(Exception e){ System.out.print(“3”); } } } 上述程序运行后的输出是哪项?() A、 3B、 2C、 231D、 32
考题
static void test() { try { String x=null; System.out.print(x.toString() +“ “); } finally { System.out.print(“finally “); } } public static void main(String[] args) { try { test(); } catch (Exception ex) { System.out.print(”exception “); } } What is the result?() A、 nullB、 finallyC、 null finallyD、 Compilation fails.E、 finally exception
考题
class Waiting implements Runnable { boolean flag = false; public synchronized void run() { if (flag) { flag = false; System.out.print("1 "); try { this.wait(); } catch (Exception e) { } System.out.print("2 "); } else { flag = true; System.out.print("3 "); try { Thread.sleep(2000); } catch (Exception e) { } System.out.print("4 "); notify(); } } public static void main(String [] args) { Waiting w = new Waiting(); new Thread(w).start(); new Thread(w).start (); } } 以下哪两项是正确的?() A、代码输出 1 3 4B、代码输出 3 4 1C、代码输出 1 2 3 4D、代码不会完成
考题
现有: class Birds { public static void main (String [] args) { try { throw new Exception () ; } catch (Exception e) { try { throw new Exception () ; } catch (Exception e2) { System.out.print ("inner "); } System. out.print ( "middle" ) ; } System.out.print ("outer") ; } } 结果是()A、 inner outerB、 middle outerC、 inner middle outerD、.编译失败
考题
class Birds { public static void main(String [] args) { try { throw new Exception(); } catch (Exception e) { try { throw new Exception(); } catch (Exception e2) { System.out.print("inner "); } System.out.print("middle "); } System.out.print("outer "); } } 结果为:() A、innerB、inner outerC、middle outerD、inner middle outer
考题
单选题现有: class Birds { public static void main (String [] args) { try { throw new Exception () ; } catch (Exception e) { try { throw new Exception () ; } catch (Exception e2) { System.out.print ("inner "); } System. out.print ( "middle" ) ; } System.out.print ("outer") ; } } 结果是()A
inner outerB
middle outerC
inner middle outerD
.编译失败
考题
单选题static void test() throws RuntimeException { try { System.out.print(”test “); throw new RuntimeException(); } catch (Exception ex) { System.out.print(”exception “); } } public static void main(String[] args) { try { test(); } catch (RuntimeException ex) { System.out.print(”runtime “); } System.out.print(”end “); } What is the result?()A
test endB
Compilation fails.C
test runtime endD
test exception endE
A Throwable is thrown by main at runtime.
考题
单选题static void test() { try { String x=null; System.out.print(x.toString() +“ “); } finally { System.out.print(“finally “); } } public static void main(String[] args) { try { test(); } catch (Exception ex) { System.out.print(”exception “); } } What is the result?()A
nullB
finallyC
null finallyD
Compilation fails.E
finally exception
考题
单选题public class TestApp{ public static void main(String[] args){ try{ int i = 0; int j = 1 / i; String myname=null; if(myname.length()2) System.out.print(“1”); }catch(NullPointerException e){ System.out.print(“2”); } catch(Exception e){ System.out.print(“3”); } } } 上述程序运行后的输出是哪项?()A
3B
2C
231D
32
考题
单选题a=10ifa==10:print(a-10)else:print[a]程序的输出结果是()。A
0B
10C
-10D
程序异常
热门标签
最新试卷