下列程序运行后的输出结果是______。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 Sub
A.0
B.3
C.6
D.9
第1题:
有以下程序: #include<string.h> void f(char*s,char*t) { char k; k=*s; *s=*t; *t=k; s++; t--; if(*s) f(s,t); } main( ) {char str[10]="abcdefg",*p; p=str+strlen(str)/2+1; f(p,p-2); printf(~%s\n",str); } 程序运行后的输出结果是 ______。
A.abcdef
B.gfedcba
C.gbcdefa
D.abedcfg
第2题:
有以下程序
#include<stdio.h>
void fun(int *s)
{ static int j=0;
do { s[j]=s[j]+s[j+1]; )while(++j<2);
}
main( )
{ int k,a[10]={1,2,3,4,5);
for(k=1;k<3;k++)fun(a);
for(k=0;k<5;k++)printf(”%d”,a[k]);
printf("\n");
}
程序运行后的输出结果是
A) 12345
B)23445
C)34756
D) 35745
第3题:
下列程序运行后的输出结果是( )。 public class Sun { public static void main(String args[]) { int i,j,s; s=0; for(i=1;i<=3;i++) for(j=0;j<=i-1;j++) s=s+1; System.out.println(s); } }
A.6
B.5
C.4
D.3
第4题:
下面程序的输出结果是( )。#include <iostream>using namespace std;void main(){int s;for(int k=2;k<6;k+=2)s=1;for(int j=k; j<6;j++) s+=j;cout<<s<<end1;
A.9
B.1
C.11
D.10
第5题:
下面程序的输出结果是( ) #include<iostream> using namespace std; int main() { int s: for(int k=2;k<6;k+=2){ s=1; for(int j=k, j<6;j++)s+=j; } cout<<s<<end1: }
A.9
B.1
C.11
D.10
第6题:
9、计算运行下列程序段后s的值: After running the following program segment, the value of s is: n=10; s=0; for(k = 1; k < n - 1; k++) for(j = n; j >= k; j--) s = s + 1;