题目详情
当前位置:首页 > 职业培训考试
题目详情:
发布时间:2024-06-27 18:24:17

[单项选择]下面程序的输出结果为( )。
#include<iostream.h>
class CStaticpublic:
CStatic( ) val++;
static int val;
;
int CStatic::val=0;
void main( )CStatic cs1;
cout<<cs1.val<< "";
CStatic cs2;
CStatic cs3, cs4;
cout<<cs2. val<<end1;

A. 14
B. 24
C. 34
D. 54

更多"下面程序的输出结果为( )。#include<iostream.h>"的相关试题:

[单项选择]下面程序的输出结果为( )。
#include<iostream.h>
class CStaticpublic:
CStatic( ) val++;
static int val;
;
int CStatic::val=0;
void main( )CStatic cs1;
cout<<cs1.val<< "";
CStatic cs2;
CStatic cs3, cs4;
cout<<cs2. val<<end1;

A. 14
B. 24
C. 34
D. 54
[单项选择]下面程序输出的结果是什么 ( ) public class Quiz2 { public static void main(String args[]) { try {throw new MyException( ); }catch(Exception e) { System.out.println("It’s caught!"); }finally{ System.out.println("It’s finally caught!"); } } } class MyExeeption extends Exception{}
A. It’s finally caught!
B. It’s caught!
C. It’s caught!/It’sfinally caught!
D. 无输出
[单项选择]下面程序的输出结果是
public class Test
 public static void main(String[] args)
  int[]array=2,4,6,8,10;
  int size=6;
  int result=-1:
  try
   for(int i=0;i<size&&result==-1;i++)
    if(array[i]==20)result=i;
catch(ArithmeticException e)
   System.out.println("Catch---1");
  catch(ArrayIndexOutOfBoundsException e)
   System.out.println("Catch---2");
  catch(Exception e)
   System.out.println("Catch---3");
  
 

A. Catch---1
B. Catch一--2
C. Catch---3
D. 以下都不对
[单项选择]下面程序输出的结果为 #include"iostream.h” class A { public: A( ){cout<<"CLASSA"<<endl;} ~A( ) {} }; class B:public A { public: B( ){cout<<"CLASS B"<<endl;} ~B( ){} }; void main( ) { A*p; p=new B; B*q; q=new B; }
A. CLASS A CLASS B CLASS B CLASS B
B. CLASS A CLASS B CLASS A CLASS B
C. CLASS A CLASS B CLASS B
D. CLASS A CLASS B
[单项选择]下面程序的输出结果是 public class Test{  public static void main(String[] args){   int[]array={2,4,6,8,10};   int size=6;   int result=-1:   try{    for(int i=0;i<size&&result==-1;i++)     if(array[i]==20)result=i; }catch(ArithmeticException e){    System.out.println("Catch---1");   }catch(ArrayIndexOutOfBoundsException e){    System.out.println("Catch---2");   }catch(Exception e){    System.out.println("Catch---3");   }  } }
A. Catch---1
B. Catch一--2
C. Catch---3
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. 编译不通过
[单项选择]下面程序的输出结果是( )。
public class Sun

public static void main(String args[ ])

int i = 9;
switch (i)

default:
System.out.println("default");
case 0:
System.out.println("zero");
break;
case 1:
System.out.println("one");
case 2:
System.out.println("two");



A. defaun
B. defauh, zero
C. error default clause not defined
D. no output displayed
[单项选择]下面程序的输出结果是( )。
public class Sun

public static void main(String args[ ])

int[] a=new int[11];
int[] p=new int[4];
int k=5;
for(int i=1;i<=10;i++)
a[i]=i;
for(int i=1;i<=3;i++)
p[i]=a[i*i];
for(int i=1;i<=3;i++)
k=k+p[i]*2;
System.out.println(k);;


A. 33
B. 28
C. 35
D. 37
[单项选择]下面程序的输出结果为( )。
public class Test
public static void main (String args[])
String X="ABCD";
String Y="EFG";
X=X.substring (X.length( )-Y.length( ));
System.out.println(X);


A. ABC
B. BCD
C. EFG
D. ABCDEFG

我来回答:

购买搜题卡查看答案
[会员特权] 开通VIP, 查看 全部题目答案
[会员特权] 享免全部广告特权
推荐91天
¥36.8
¥80元
31天
¥20.8
¥40元
365天
¥88.8
¥188元
请选择支付方式
  • 微信支付
  • 支付宝支付
点击支付即表示同意并接受了《购买须知》
立即支付 系统将自动为您注册账号
请使用微信扫码支付

订单号:

请不要关闭本页面,支付完成后请点击【支付完成】按钮
恭喜您,购买搜题卡成功
重要提示:请拍照或截图保存账号密码!
我要搜题网官网:https://www.woyaosouti.com
我已记住账号密码