首页 > 大学本科
题目内容 (请给出正确答案)
[单选题]

分析下列程序段,写出程序运行结果()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

答案
收藏

D、2 4 7

如果结果不匹配,请 联系老师 获取答案
您可能会需要:
您的账号:,可能还需要:
您的账号:
发送账号密码至手机
发送
安装优题宝APP,拍照搜题省时又省心!
更多“分析下列程序段,写出程序运行结果()s=1for n=1 t…”相关的问题
第1题
写出下列程序的运行结果。#include void Fun(){int num=20;cout<< "The Fun's num i
写出下列程序的运行结果。#include void Fun(){int num=20;cout<< "The Fun's num i

写出下列程序的运行结果。

#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;}

点击查看答案
第2题
阅读下列程序,请写出程序的运行结果。import java.applet.*;import javax.swing.*;import java

阅读下列程序,请写出程序的运行结果。

import java.applet.*;

import javax.swing.*;

import java.awt.event.*;

public class C extends Applet implements ActionListener

{

int n=0;

JButton button;

public void init()

{

setSize(400,100);

button=new JButton("");

add(button);

button.addActionListener(this);

}

public void actionPerformed(ActionEvent e)

{

n++;

button.setText(n+"");

}

}

点击查看答案
第3题
‍下面程序段运行的结果为()。‎#include‎int f();‎int f()‎{static int i=0;‎int s=1;s+=i;‎i++;‎ return s;}‎void main()‎{int i,a=0;‎for(i=0;i<5;i++)‎ a+=f();‎ printf("%d/n",a);}

A.25

B.15

C.20

D.24

点击查看答案
第4题
下列程序的运行结果为【 】。 include <stdio.h> main() { static char str1[40];

下列程序的运行结果为【 】。 include <stdio.h> main() { static char str1[40]; char str2140]; strcpy(str2,"China"); strcat(str1,str2); strcat(str1," is a great country !"); printf("%s %s ",str2,strl); printf("%d %d\n",strlen(str2),strlen(str1)); }

点击查看答案
第5题
运行下列程序段之后,标签Label1 显示的结果为()。 A = 10 : B = 30 : If A < B Then Label1.Text = B & A

A.10

B.30

C.1030

D.3010

点击查看答案
第6题
写出程序运行结果。classPoint{intx,y;Point(intx,inty){this.x=x;this.y=y;System.out.println

写出程序运行结果。

classPoint{

intx,y;

Point(intx,inty){

this.x=x;

this.y=y;

System.out.println("父类构造函数被调用!");

}

}

classCircleextendsPoint{

intradius;

Circle(intr,intx,inty){

super(x,y);

this.radius=r;

System.out.println("子类构造函数被调用!");

}

}

publicclasstestInherence{

publicstaticvoidmain(Stringargs[]){

Circlec1=newCircle(2,2,2);

}

}

运行结果:

点击查看答案
第7题
请在该程序段右侧写出其输出结果。fun3(int x){static int a=3;a=x;return(a);}main(){int k=2,m

请在该程序段右侧写出其输出结果。

fun3(int x)

{static int a=3;

a+=x;

return(a);}

main()

{int k=2,m=1,n;

n=fun3(k);

n=fun3(m);

printf("%d\n",n);)

点击查看答案
第8题
请在该程序段右侧写出其输出结果。int aa[3][3]={{2},{4},{6}};main(){int j,*p=&aa[0][0];for(j=

请在该程序段右侧写出其输出结果。

int aa[3][3]={{2},{4},{6}};

main()

{int j,*p=&aa[0][0];

for(j=0;j<2;j++)

{if(j==0)

aa[j][j+1]=*p+1;

else ++P;

print(("%d",*p);}

}

点击查看答案
第9题
请在该程序段右侧写出其输出结果。main(){int n[3],j,k,l;for(j=0;j<3;j++)n[j]=0;l=3:for(j=0;j<

请在该程序段右侧写出其输出结果。

main()

{int n[3],j,k,l;

for(j=0;j<3;j++)

n[j]=0;

l=3:

for(j=0;j<l;j++)

for(k=0;k<l;k++)

n[k]=n[j]+1:

print(("%d\n",n[1]);

}

点击查看答案
第10题
运行以下程序,输出结果为()。lst=[ '1' , int('1') , eval('1') , (1)

运行以下程序,输出结果为()。lst=[ '1' , int('1') , eval('1') , (1) ] s=set(lst) print(len(s))

点击查看答案
第11题
运行以下程序,输出结果为()。s='a1b2c3d4' lst=[] n=len(s) for i in range(0,n,2): ls

运行以下程序,输出结果为()。s='a1b2c3d4' lst=[] n=len(s) for i in range(0,n,2): lst.append(s[i:i+2] ) print(lst[-3])

点击查看答案
退出 登录/注册
发送账号至手机
密码将被重置
获取验证码
发送
温馨提示
该问题答案仅针对搜题卡用户开放,请点击购买搜题卡。
马上购买搜题卡
我已购买搜题卡, 登录账号 继续查看答案
重置密码
确认修改