阅读以下程序,填写运行结果_________________. dic={'apple':2, 'orange':5, 'pear':3, 'banana':6, 'watermelon':1} print(sum(dic.values()))
阅读以下程序,填写运行结果_________________. dic={'apple':2, 'orange':5, 'pear':3, 'banana':6, 'watermelon':1} print(sum(dic.values()))
参考答案和解析
D
相关考题:
考虑如下数组$multi_array,怎样才能从数组$multi_array中找出值cat?( )$multi_array= array(‘red’,’green’,42=’blue’,’yellow’=array(‘apple’,9=’pear’,’banana’,’orange’=array(‘dog’,’cat’,’iguana’))) A.$multi_array[‘yellow’][‘apple’][0]B.$multi_array[‘blue’][0][‘orange’][1]C.$multi_array[3][3][2]D.$multi_array[‘yellow’][‘orange’][1]
有以下程序: void sum(int a[]) {a[0]=a[-1]+a[1];} main() {int a[10]={1,2,3,4,5,6,7,8,9,10}; sum(&a[2]); printf("%d\n",a[2]); } 程序运行后的输出结果是( )。A.6B.7C.5D.8
窗体上画一个名称为Command1的命令按钮,然后编写如下程序: Optlon Base 1 Prlvete Sub Command1_Click() Dim s As Variant a=Array(1, 2, 3, 4, 5) Sum=0 For i=1 To 5 Sum=Sum_a(i) Next i X=Sum/5 For i=1 To 5 If a(i)>x Then Print a(i); Next i End Sub 程序运行后,单击命令按钮,在窗体上显示的内容是______。A.1 2B.1 2 3C.3 4 5D.4 5
在工程中的标准模块中定义了如下数据类型: Type fruit orange As Integer apple As Integer End Type 在窗体上有—命令按钮Command1,要求当单击命令按钮时在C:\根目录下的顺序文件myfrtac.txt 中写入一条记录,下列能够完成改操作的事件过程是______ 。A.Private Sub Command1_Click() Dim myfrt As fruit myfrt. range = 5 myfrt. apple = 10 Open “c:\myfrta. txt” For Output As #1 Print #1, myfrt. orange; myfrt. apple Close #1 End SubB.Private Sub Command1_Click() Dim myfrt As fruit myfrt. range= 5 myfrt. apple= 10 Open “c:\myfrtac. txt”For Input As #1 Print #1, myfrt, orange; myfrt. apple Close #1 End SubC.Private Sub Command1_Click() Dim myfrt As fruit myfrt. range= 5 myfrt. apple = 10 Open “c:\myfrtac. txt” For As #1 Print #1, myfrt. orange; myfrt. apple Close #1 End SubD.Private Sub Command1_Click() Dim myfrt As fruit myfrt. range = 5 myfrt. apple= 10 Open “c:\myfrtac..txt” For Output As #1 Print myfrt. orange; myfrt. apple Close #1 End Sub
有如下程序: Private Sub Form_Click() Dim i As Integer,Sum As Integer Sum=0 For i=2 To 10 If i Mod 2<>0 And i Mod 3=0 Then Sum=Sum+i End If Next Print Sum End Sub 程序运行后,单击窗体,输出结果为A.12B.30C.24D.18
请将香蕉banana用工具 H( )—Head( ),T( )—Tail( )从L中取出。 L=(apple,(orange,(strawberry,(banana)),peach),pear)
阅读如下程序, a = 1: b = 2: plus S, a, b: Print S:不能使其输出结果为3的plus过程为( )。 A、Sub plus(sum, a , b ): sum = a + b: End SubB、Sub plus(ByVal sum , a , b ): sum = a + b: End SubC、Sub plus(sum , ByVal a, ByVal b ): sum = a + b: End SubD、Sub plus(sum , ByRef a , ByRef b ): sum = a + b: End Sub
阅读下列程序: Function func(n As Integer)As Integer Sum = 0 For i = 1 To n Sum = Sum + (i + 1)* i Next i func = Sum End Function.Private Sub Command1_Click () Dim a As Integer a= 5 s = func (A)Print s End Sub 程序运行后,单击命令按钮,输出的结果为A.80B.60C.70D.15
有以下程序: void sum(int *A) { a[0] =a[1]; } main ( ) { int aa[10]={1,2,3,4,5,6,7,8,9,10}, i; for (i=2 ;i>=0;i--) sum(aa[i] ); print f ("%d\n",aa[0]); } 执行后的输出结果是A.4B.3C.2D.1
有以下程序:include void sum(int a[ ] ){a[0]=a[-1] +a[1];}main ( ){int a[10] = { 有以下程序:#include <stdio, h>void sum(int a[ ] ){ a[0]=a[-1] +a[1];}main ( ){ int a[10] = {1,2,3,4,5,6,7,8,9,10}; sum(a[2]); prinff("% d \n",a[2]); }程序运行后的输出结果是( )。A.6B.7C.5D.8
有以下程序:include void sum(int *a){a[0]=a[1];}main(){int aa[10]={1,2,3,4,5,6,7, 有以下程序: #include <stdio.h> void sum(int *a) { a[0]=a[1]; } main() { int aa[10]={1,2,3,4,5,6,7,8,9,10},i; for(i=2;i>=0;i--) sum(aa[i]); printf("%d\n",aa[0]); } 执行后的输出结果是( )。A.4B.3C.2D.1
有如下程序: Private Sub Form_Click( ) Dim i As Integer, Sum As Integer Sum = 0 For i = 2 To 10 If i Mod 2=0 And i Mod 3<>0 Then Sum = Sum + i End If Next Print Sum End Sub 程序运行后,单击窗体,输出结果为A.12B.30C.24D.18
下列程序的运行结果是______。main(){int a[6],i; for(i=2;i3))%5; print 下列程序的运行结果是______。 main() { int a[6],i; for(i=2;i<6;i++) {a[i]=4*(i-2*(i>3))%5; printf("%2d",a[i]); } }A.2 3 2 3B.1 2 1 2C.3 2 3 2D.2 2 2 2
有以下程序: void sum(int *A) {a[0]=a[1];} main() { int aa[10]={1,2,3,4,5,6,7,8,9,10},i; for(i=1;i>0;i--)sum(aa[i]); printf("%d\n",aa[0]); } 程序运行后的输出结果是______。A.4B.3C.2D.1
有如下程序: Option Base 1 Private Sub Form. Click() Dim arr,Sum Sum=0 alt=Array(1,3,5,7,9,11,13,15,17,19) For i=1 To 10 If arr(i)/3=arr(i)\3 Then Sum=Sum+arr(i) End If Next i Print Sum End Sub 程序运行后,单击窗体,输出结果为______。A. 25B.26C.27D.28
阅读程序: Option Base 1 Private Sub Form. Click() Dim arr,Sum Sum= 0 arr=Array(1,3,5,7,9,11,13,15,17,19) For i=1 To 10 If arr(i)/3=arr(i)\3 Then Sum=Sum+arr(i) End If Next i Print Sum End Sub 程序运行后,单击窗体,输出结果为A.13B.14C.27D.15
有以下程序: void sum(int * a) {a[0]=a[1];} main() { int aa[10]={1,2,3,4,5,6,7,8,9,10},i; for(i=1;i>0;i--)sum(aa[i]); print("%d\n",aa[0]); } 程序运行后的输出结果是 ______。A.4B.3C.2D.1
下列程序运行后的输出结果是______。Private Sub f(k,s) s = 1 for j = 1 To k s=s*j Next jEnd SubPrivate Sub Command1_ Click () Sum = 0 for i = 1 To 3 Call f(i, s) Sum = Sum + s Next i Print Sum End SubA.0B.3C.6D.9
阅读下列程序。Private Sub Command1_Click()Dim i As Integer, k As Integerk=2For i=1 To 3Print Fun(k) ;NextEnd SubFunction Fun(j As Integer)Static ba=0a=a + 1b=b + 1Fun=a b + jEnd Function程序运行后,单击命令按钮输出结果是A.2 3 4B.3 4 5C.5 6 7D.3 5 6
阅读下列程序: Private Sub Form Click() Dim i As Integer, sum As Integer For i = 2 To 10 If i Mod 2 <> 0 Then Print i; Else sum = sum + i End If Next i Print sum End Sub 程序运行后,单击窗体,在窗体上的输出结果是A.3 5 7 9 30B.1 3 5 7 9C.2 4 6 8 20D.11 15 17 19 20
运行以下程序后,显示的结果为 ______。 Dim x(5) x(0) =1 For i=1 To 5 x(i)=x(i-1)*i Print x(i) Next i EndA.1 2 3 4 5B.1 2 6 24 120C.1 2 6 12 20D.1 1 2 3 4
下面程序运行时,单击窗体后,窗体上显示的结果是( )。 Private Sub Form_Click Dim I As Integer Dim sum As Long Dim t1 As Long t1=1:sum=0 For 1=1 To 3 t1=t1*I sum=sum+t1 Next I Print sum End SubA.3B.9C.5D.6
有如下程序: Option Base 1 Private Sub Form_Click() Dim arr,Sum Sum=0 alt=Array(1,3,5,7,9,11,13,15,17,19) For i=1 To 10 If arr(i)/3=arr(i)13 Then Sum=Sum+alt(I) End If Next i Print Sum End Sub 程序运行后,单击窗体,输出结果为______。A.25B.26C.27D.28
以下关于Python自带数据结构的运算结果中正确的是哪一项? A.l = [1, 2, 3, 4, 5]; del l[2:4]; 则运算之后l为[1,2, 3]。B.basket = ['apple', 'banana', 'apple', 'orange'] ;fruit = set(basket);fruit2 = set(['apple', 'melo']); len(fruit |fruit2) 的结果是5。C.basket = ['apple', 'banana', 'apple', 'orange'] ;fruit = set(basket); len(fruit) 的运算结果是4。D.l = [2, 1, 3, 5, 4]; l.remove(3); l.sort(); 则运算之后l为[1, 2, 4, 5]
下面程序的运行结果是()。include void main(){static int a[][4]={ 1,2,3,4,5,6,7, 下面程序的运行结果是( )。#include <iostream.h>void main(){static int a[][4]={ 1,2,3,4,5,6,7,8,9,10,11,12};int i, j, sum=0;for(i=0;i<3;i++)for(j=0;j<4;j++)if(j>i)sum+=a[i][j];cout<<sum<<end1;}A.24B.30C.36D.40
单选题有以下程序 void sum(int a[]) { a[0]=a[-1]+a[1]; } main() { int a[10]={1,2,3,4,5,6,7,8,9,10}; sum(a[2]); printf("%d/n",a[2]); } 程序运行后输出结果是()A6B7C5D8
填空题表达式’apple.peach,banana,pear’.find(’ppp’)的值为()。