执行以下程序后,假设用户输入123,则输出结果为: n=int(input('请输入一个三位正整数:')) a=n//100 b=n//10%10 c=n%10 print(a,end=',') print(b,end=',') print(c)
A.1,2,3,
B.1, 2, 3
C.1,2,3
D.1,2, 3
第1题:
窗体上有一个Text1文本框,一个Command1命令按钮,并有以下程序
Private Sub Command1_click()
Dim 11
If Textl.Text<>”123456”Then
n=n+1
print“口夸输入错误”&n&次”
End If
End Sub
希望程序运行时得到左图所示的效果,即:输入口令,单击“确认口令”命令按钮,若输入的口令不是“123456”,则在窗体上显示输入错误口令的次数。但上面的程序实际显示的是右图所示的效果,程序需要修改。下面修改方案中正确的是
A.在Dim n语句的下面添加一句:n=O
B.把Print“口令输入错误”&n&“次”改为Print“口令输入错误”+n+“次”
C.把Print“口令输入错误”&n&“次”改为Print“口令输入错误”&Str(n)&“次”
D.把Dim n改为Static n
第2题:
单击命令按钮,并在对话框内依次输入5,7,6下列程序段的执行结果为______。 Private Sub Command1_Click() Dim n AS Integer, a As Integer, b As Integer, c As Integer n = 0 For i = 1 To 3 a = InputBox ("请输入数字") n = n+a*a If n > 50 Then GoTo ex End If Next i ex: Print n End Sub
A.25
B.74
C.85
D.110
第3题:
以下程序的执行结果是______
include<iostream.h>
include<iomanip.h>
void print(int n)
{
if(n!=0)
{
print(n-1);
for(int i=1;i<=n;i++=
cout<<setw(3)<<i;
cout<<endl;
}
}
void main()
{
print (4);
}
第4题:
在窗体画一个命令按钮,然后编写如下过程,程序运行后,单击命令按钮,在输入对话框中输入234,输出结果为 ______。 Function Fun(ByVal num As Long)As Long Dim k As Long k=1 num=Abs(num) Do While num k=k* (num Mod 10) num=num\10 Loop fun=k End Function Private Sub Command1_Click() Dim n As Long Dim r As Long n=In put Box("请输入一个数") n=CLng(n) r=Fun(n) Print r End Sub
A.20
B.24
C.9
D.28
第5题:
下列程序段的执行结果为 m=1 n=1 Select Case m Case 1 Select Case n Case 0 print"A" Case 1 Print"B" End Select Case 2 Print"C" End Select
A.A
B.B
C.C
D.0
第6题:
下列程序段的执行结果为______。 Private Sub Command1_Click() n = 0 For a = 1 To 20 For b = 1 To 20 For c = 1 To 20 If a * a + b * b - c * c Then n=n+l End If Next c Next b Next a Print n End Sub
A.9
B.12
C.10
D.11
第7题:
下面的程序执行时,可以从键盘输入一个正整数,然后把该数的每位数字按逆序输出。例如:输入7685,则输出5 8 6 7;输人1000,则输出0 0 0 1。请填空。 Private Sub Command1_Click Dim x As Integer X=InputBox(“请输入一个正整数”) While x> 【11】 Print x Mod 10; x=x\10 Wend Print 【12】 End Sub
第8题:
若有以下程序:
include <iostream>
using namespace std;
class Sample
{
private:
const int n;
public:
Sample(int i) :n(i) {)
void print()
{
cout<<"n="<<n<<end1;
}
};
int main()
{
sample a(10);
a.print();
return 0;
}
上述程序运行后的输出结果是【 】。
第9题:
窗体上有一-个Text1文本框,一个Command1命令按钮,并有以下程序:
Private Sub Command1 Click( ) Dim n If Text1.Text<>"123456"Then n=n+1 Print"口令输入错误”&n&”次" End If End Sub希望程序运行时得到左图所示的效果,即:输入口令,单击“确定口令’’命令按钮,若输入的口令不是“123456”,则在窗体上显示输入错误口令的次数。但上面的程序实际显示的是右图所示的效果,程序需要修改。下面修改方案中正确的是( )。
A.在Dim n语句的下面添加一句:n=0
B.把Print“口令输入错误”&n&“次”改为Print“口令输入错误”+n+“次”
C.把Print“口令输入错误”&n&“次”改为Print“口令输入错误”&Str(n)&“次”
D.把Dim n改为Static n
第10题:
下面程序的运行结果为 #include<iostream.h> class A { static int n; public: A(){n=1;} A(intnum){n=num;} void print(){cout <<n;} }; int A∷n=2; void main() { Aa,b(3); a.print(); b.print(); cout <<end1; }
A.11
B.13
C.23
D.33
第11题:
在窗体上画一个命令按钮,然后编写如下程序: Function funl(ByVal Bum As Long)As Long Dim k As Long k = 0 Bum=Abs(Bum) Do While Bum k=k+(Bum Mod 10) Bum=Bum\10 Loop fun1=k End Function Private Sub Command1_Click() Dim n As Long n=InputBox("请输入一个数") Print fun1(n) End Sub 程序运行后,单击命令按钮,在对话框中输入234,输出的结果为
A.3
B.4
C.9
D.10
第12题:
单击命令按钮,下列程序段的输出结果为______。 Private Sub Command1_Click() Dim n As Integer n = 5 While n <= 10 n = n + 2 Print n; Wend End Sub
A.5 7 9 11
B.6 8 10
C.7 9 11
D.6 8 10 12
第13题:
以下程序的执行结果是【 】。
include<iostream.h>
include<iomanip.h>
void pnnt(int n)
{
if (n!=0)
{
Print(n-1);
for (int i=1;i<=n;i++)
cout<<setw(3)<<i;
cout<<endl;
}
}
void main()
{
print(4);
}
第14题:
阅读下面的程序: Private Sub Form_Click() Dim m,n As Integer m=InputBox("请输入M的值") m=Val(m) m1=m n=InputBox("请输入N的值") n=Val(n) n1=n Do While n<>0 remin=m Mod n m=n n=remin Loop Print m1,n1,m End Sub 程序运行后,单击窗体,在对话框中分别输入16和24,则程序在窗体上的输出结果为
A.16 24 4
B.16 24 8
C.24 16 6
D.24 16 8
第15题:
有以下程序: #include <iostream> using namespace std; int main () { int n; cin>>n; if (n++<10) cout<<n<<end1; else cout<<n--<<end1; return 0; } 若执行该程序时从键盘上输入9,则输出结果是( )。
A.11
B.10
C.9
D.8
第16题:
单击命令按钮,并在对话框内输入6,下列程序段的执行结果为______。 Private Sub Command1_Click() Dim n As Integer n=InputBox ("请输入日期") Select Case n Case Is <= 0 n=InputBox("错误!请重新输入日期!") Case Is>7 n=InputBox("错误!请重新输入日期!") Case 1 To 3 Print "江苏" Case 4 To 5 Print "浙江" Case 6 To 7 Print "双休日" End Select End Sub
A.错误!请重新输入日期!
B.江苏
C.浙江
D.双休日
第17题:
执行以下程序段,并输入1.23,则程序的输出结果应是【 】。
N=Str(InputBox(“请输入一个实数:”))
p=IiaStr(N,".")
Print Mid(N,p)
第18题:
下面程序的运行结果为 #include < iostream.h > class A { static int n; public: A( ){n=1;} A(int num){ n = num;} void print( ){cout<< n;} }; int A::n=2; void main( ) { A a,b (3); a.print( ); b.print( ); cout<< end1; }
A.11
B.13
C.23
D.33
第19题:
下列程序段的执行结果为 m=1 n=1 Select Case m Case 1 Select Case n Case 0 Print" * * 0 * *" Case 1 Print" * *1* *" End Select Case 2 Print" * * 2 * *" End Select
A.**0**
B.**1**
C.**2**
D.0
第20题:
下列程序的输入值分别为100,10则执行结果为非作歹______ 。 m=Val (inputbox (“请输入数学1”) ) n=Val (inputbox (“请输入数学2”) ) If n*m=0 Then MsgBox “两数能不能为0” Exit Sub If m<n Then t=m: m=n: n=t End If End If DO R=m Mod n m=n n=f Loop While r<>0 Print m
A. 10
B.100
C.50
D.250
第21题:
先在 窗体上添加一个命令按纽,然后编写如下程序: Function fun(ByVal nm As Long)As Long Dim k As Long k=1 num=Abs(num) Do While num k=k*(num Mod 10) num=num\10 Loop fun=k End Function Private Sub Command1_Click() Dim n As Long Dim r As Long n=InputBox(“请输入一个数”) n=CLng(n) r=fun(n) Print r End Sub 则在程序运行后,单击命令按纽,在对话框中输入“100”,输出结果是______。
A. 0
B.100
C.200
D.300
第22题:
执行以下程序段,如果在对话框中输入8,输出结果是"Hello"的是______。
A.n = InputBox("请输入一个数") Select Case n Case 7 To 1 Print "Hello" End Select
B.n = InputBox("请输入一个数") Select Case n Case Is>1, Is < 6 Print "Hello" End Select
C.n = InputBox("请输入一个数") Select Case n Case Is > 5, 1, 3 To 10 Print "Hello" End Select
D.n=InputBox("请输入一个数") Select Case n Case 1, 5, Is > 9 Print "Hello" End Select
第23题:
单击命令按钮时,下列程序的执行结果为 Private Sub Command1_Click Dim x As Integer, y As Integer x=12:y=32 Call Proc(x,y. Print x; y End Sub Public Sub Proc(n As Integer, ByVal m As Integer. n=n Mod 10 m=m Mod 10 End Sub
A.1232
B.232
C.23
D.123
第24题:
下列程序段的执行结果为 m=1 n=1 Select Case m Case 1 Select Case n Case 0 Print" * * 0 * *" Case 1 Print" * *.* *" End Select Case 2 Print"* *,2 * *," End Select
A.* * 0 * *
B.* * 1 * *
C.* * 2 * *
D.0