VisualBasic编程与应用作业2答案
分类: 计算机
时间: 2024-04-30 05:44:47
作者: 全国等级考试资料网
一 、选择题
1.C 2.A 3.B 4.A 5.C 6.B 7.B 8.B 9.1
10.D 11.D 12.A 13.C 14.D 15.B 16.C 17.D 18.C
二、问答题
1.改正下列语句中的错误:
(1)A$ = abc (2)Print a = 34 + 23
(3)X = 5 y = 6 (4)Print ’’ c = ’’:5 + 6
(5)Text1. Print ’’ # # # # # # # # ’’ (6)A * 5 = B +2
解答:
(1)缺少引号,应改为:A$ = ’’ abc ’’。
(2)改为:Print ’’ a = ’’;34 + 23
(3)改为:x= 5:y = 6
(4)改为:Print ’’c = ’’; 5 + 6
(5)文本框不支持Print 方法,应改为:Print ’’# # # # # # # # ’’或Picturel.
Print ’’# # # # # # # #’’。
(6)这是一个关系表达式,不是赋值语句。
2.写出下列语句的输出结果,并上机验证:
(1)Print ’’ 25 + 32 ’’; 25 + 32
(2)X = 12.5 Print ’’x = ’’ ;x
(3)a % = 3.14156 Print a %
(4)Print ’’ China ’’;’’ Beijing ’’,’’ Tianjin ’’;’’ Shanghai ’’,’’ Wuhan ’’,Print ’’Nanjing ’’;
Print ’’ Shenyang ’’,’’ Chongqing ’’;’’ Wulumuqi ’’
Print ,,’’ Guangzhou ’’,,’’ Chengdu ’’
(5)Print Tab (5);100;Space $ (5) ;200; Tab(35);300
Print Tab(10);400;Tab(23);500;Space $ (5) ;600
解答:
(1)25 + 32 = 57
(2)x = 12.5
(3)3
(4)ChinaBeijing TianjinShanghai Wuhan NanjingShenyang
ChongqingWulumuqi (这两个字符串在上一行)
Guangzhou Chengdu
(5) 100 200 300
400 500 600
3.写出下列语句的输出结果:
Sub Form_Click()
A = 10: b = 15: c = 20: d = 25
Print A; Spc(5); b; Spc(7); c
Print A; Spc(8); b; Space$(5); c
Print c; Spc(3); "+"; Spc(3); d;
Print Spc(3); "="; Spc(3); c + d
End Sub
解答:
10 15 20
10 15 20 首页 1 2 3 4 尾页
1.C 2.A 3.B 4.A 5.C 6.B 7.B 8.B 9.1
10.D 11.D 12.A 13.C 14.D 15.B 16.C 17.D 18.C
二、问答题
1.改正下列语句中的错误:
(1)A$ = abc (2)Print a = 34 + 23
(3)X = 5 y = 6 (4)Print ’’ c = ’’:5 + 6
(5)Text1. Print ’’ # # # # # # # # ’’ (6)A * 5 = B +2
解答:
(1)缺少引号,应改为:A$ = ’’ abc ’’。
(2)改为:Print ’’ a = ’’;34 + 23
(3)改为:x= 5:y = 6
(4)改为:Print ’’c = ’’; 5 + 6
(5)文本框不支持Print 方法,应改为:Print ’’# # # # # # # # ’’或Picturel.
Print ’’# # # # # # # #’’。
(6)这是一个关系表达式,不是赋值语句。
2.写出下列语句的输出结果,并上机验证:
(1)Print ’’ 25 + 32 ’’; 25 + 32
(2)X = 12.5 Print ’’x = ’’ ;x
(3)a % = 3.14156 Print a %
(4)Print ’’ China ’’;’’ Beijing ’’,’’ Tianjin ’’;’’ Shanghai ’’,’’ Wuhan ’’,Print ’’Nanjing ’’;
Print ’’ Shenyang ’’,’’ Chongqing ’’;’’ Wulumuqi ’’
Print ,,’’ Guangzhou ’’,,’’ Chengdu ’’
(5)Print Tab (5);100;Space $ (5) ;200; Tab(35);300
Print Tab(10);400;Tab(23);500;Space $ (5) ;600
解答:
(1)25 + 32 = 57
(2)x = 12.5
(3)3
(4)ChinaBeijing TianjinShanghai Wuhan NanjingShenyang
ChongqingWulumuqi (这两个字符串在上一行)
Guangzhou Chengdu
(5) 100 200 300
400 500 600
3.写出下列语句的输出结果:
Sub Form_Click()
A = 10: b = 15: c = 20: d = 25
Print A; Spc(5); b; Spc(7); c
Print A; Spc(8); b; Space$(5); c
Print c; Spc(3); "+"; Spc(3); d;
Print Spc(3); "="; Spc(3); c + d
End Sub
解答:
10 15 20
10 15 20 首页 1 2 3 4 尾页