下列程序输出结果为varc=Array(1,2,3,4,9,5)varmax=c.max;println(max)()
第1题:
下列程序运行后,输出结果为( )。 Dim a() a=Array(1,3,5,7,9) s=0 For i=1 To 4 s=s*10+a(i) Next i Print s
A.1357
B.3579
C.7531
D.9753
第2题:
下列程序的输出结果是______。
include<iostream.h>
template<class T>
T max(T x[],int n)
{
int i;
T maxv=x[0];
for(i=1;i<n;i++)
if(maxv<x[i])
maxv=x[i];
return maxv;
}
void main( )
{
int a[]={3,2,7,6,8,9};
double b[]={1.2,3.4,2.5,7.3,6.8};
cout<<max(a,4)<<","<<max(b,3)<<endl;
}
第3题:
下面程序的输出结果是 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.以下都不对
第4题:
下列程序的输出结果为【 】。
inelude<iostream. h>
int &max(int &x, int &y)
{return (x>y? x: y); }
void main() {
int n=3, m=12;
max(m, n)++
cout<<"m="<<m<<", n= "<<n<<end1;
}
第5题:
请阅读下列程序代码,然后将程序的执行结果补充完整。横线处应填写的内容是( )。 程序代码: public class throwsExeeption{ static void Proc(intsel) throws Arithmetic Exception,Array Index Out Of Bounds Exception{ System.out.println("InSituation"+sel); if(sel= =0){ System.OUt.println("noException caught"); return; } else if(sel= =l){ int iArray[]=newint[4]; iArray[1]=3; } } public static void main(String args[]){ try{ Proe(O); Proc(1); } catch(Array Index Out Of Bounds Exception e){ System.out.println("Catch"+e); } finally{ System.out.println("inProcfinally"): } } } 执行结果: In Situation 0 no Exception caught in Proc finally
A.In Situation l
B.In Situation
C.with Catch
D.int iArray l
第6题:
下列程序的输出结果为______。
include<iostream.h>
int&max(int&x,int&y)
{return(x>y? x:y);)
void main( )
{
int n=3,m=12;
max(m,n)++;
cout<<"m="<<m<<",n=<<n<<endl;
}
第7题:
reduceRight通过如下程序块其输出结果为varlist=List(1,2,99,4,100)varjs=list.reduceRight(_max_println(js)()
第8题:
在scala中fold的输出结果为varlb=List(1,2,3,4,5)varjs=lb.fold(100)(_-_)println(js)()
第9题:
研究下面的Java代码: switch (x) { case 1: System.out.println(1); case 2: case 3: System.out.println(3); case 4: System.out.println(4); } 当x=2时,运行结果是()。
第10题:
reverse会将所给的对象的顺序反转,请说出下列程序输出结果为valarr=Array(1,2,3,4,5)//带下标的for循环for(i<-(0to4).reverse)print(arr(i)+"")()
第11题:
2,3,4,5,
3,4,5,6,
3,4,2,2,
1,2,0,0,
第12题:
min=1,max=9
min=0,max=9
min=1,max=4
min=0,max=4
第13题:
有如下函数模板声明:
template<typenameT>
TMax(Ta,Tb){return(a>b)?a:b;}
下列对函数模板Max( )的调用中错误的是( )。
A.Max(3.5,4.5)
B.Max(3.5,4)
C.Max(3.5,4)
第14题:
有如下程序段: #include<stdio.h> #define Max(a,b) a>b?a:b main() { int a=5,b=6,c=4,d; d=c+Max(a,b); printf("%d",d); } 其输出结果为______。
A.10
B.5
C.6
D.编译错误
第15题:
编译运行下程序后,关于输出结果的说法正确的是( )。 public class conditional{ public smile void main(string args[]){ int x=4; System.out.println("alue is "+((x>4)?99:9)); } }
A.输出结果为 value is 99.99
B.输出结果为 value is 9
C.输出结果为 valueis9.0
D.编译错误
第16题:
下列程序的输出结果是( )。 Public class Test{ Public static void main(String[]args){ int[]array=(2,4,6,8,10); int size=6; int result=-l: try{ for(int i=0;i<sizeresult= =-1:) if(array[i]= =20)result=i: } catch(ArithmeticException e){ System.out.println("Catch---1"); } catch(ArraylndexOutOfBoundsException e){ System.out.println("Catch---2"): } catch(Exception e){ System.out.println("Catch---3"): } }
A.Catch---1
B.Catch---2
C.Catch---3
D.以上都不对
第17题:
A.14
B.0
C.6
D.12
第18题:
( 17 )下列程序的输出结果是
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 )以上都不对
答案暂缺
第19题:
reduceRight通过如下程序块其输出结果为varlist=List(1,2,99,4,100)varjs=list.reduceRight(_max_)println(js)()
第20题:
程序System.out.println(10/3);的输出结果是()
第21题:
下列程序输出结果为varc=Array(1,2,3,4,9,5);varmin=c.minprintln(min)()
第22题:
15
10
8
1
第23题:
没有输出任何结果
输出结果为3
输出结果是3和4
输出结果是1、3和4