![](https://static.youtibao.com/asksite/comm/h5/images/m_q_title.png)
分析下列程序段,写出程序运行结果()s=1for n=1 to 3s=s+nprint snext
A.1 4 7
B.4 7 10
C.2 4 6
D.2 4 7
![](https://static.youtibao.com/asksite/comm/h5/images/m_q_a.png)
D、2 4 7
![](https://static.youtibao.com/asksite/comm/h5/images/solist_ts.png)
A.1 4 7
B.4 7 10
C.2 4 6
D.2 4 7
D、2 4 7
写出下列程序段的输出结果。(假设此栈中元素的类型是char)
voide main()
{stack s;
char x,y;
InitStack(s)
x=‘1’,y=‘0’
push(s,x);
push(s,x);
push(s,y);
push(s,x);
push(s,‘e’);
push(s,x);
pop(s,x);
push(s,‘h’);
while(!stackEmpty(s))
{pop(s,y);
printf(y);
}
prinft(x)
}
写出下列程序的运行结果。
#include void Fun(){int num=20;cout<< "The Fun's num is"<< num<< endl;
}void main(){int num=10;cout<< "The main's num is "<< num<< endl;Fun();{int num=30;
cout<< "The Field's num is "<< num<< endl;}cout<< "The main's num is "<< num<< endl;}
A.9
B.10
C.15
D.24
阅读下列程序,请写出程序的运行结果。
public class C
{
public static void main(String[] args)
{
String text="public static void main(String[] args)";
int theCount=0;
int index=-1;
String theStr="i";
index=text.indexOf(theStr);
while(index>=0)
{
++theCount;
index+=theStr.length();
index=text.indexOf(theStr,index);
}
System.out.println("The Text contains"+theCount+"i");
}
}
阅读下列程序并写出程序运行结果。
Public Sub change1(ByVal x As Integer, ByVal y As Integer)
Dim t As Integer
t = x
x = y
y = t
End Sub
Public Sub change2(x As Integer, y As Integer)
Dim t As Integer
t = x
x = y
y = t
End Sub
Private Sub Form_Click()
Dim a As Integer, b As Integer
a = 22: b = 33
change1 a, b
Form1.Print "A1="; a, "B1="; b
a = 22: b = 33
change2 a, b
Form1.Print "A2="; a, "B2="; b
End Sub
写出程序运行时,单击窗体Form1上的输出结果。
请写出如下程序的执行结果。
s = 0 for i in range(1, 11):
if i % 2 == 0:
continue
if i % 10 == 5:
break
s=s+i print(s)
A.10
B.30
C.1030
D.3010