




已阅读5页,还剩4页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
一、选择题一、选择题 1. 下列程序所计算的数学式是下列程序所计算的数学式是() inta=0, i=2; while(i=0;j-) Console.Write (“00”, numsj); Console.WriteLine(); 答案:答案:10 8 36 12 24 24 12 36 8 10 2、 class Fruit public string color; public string shape; public Fruit(string c, string s) color = c; shape = s; class Test public static void Main() Fruit Orange = new Fruit(“orange“, “round“); Console.WriteLine(“0,1“, Orange.color, Orange.shape); 答案:答案:orange, round 3、using System; class Point public int x,y; public Point(int x ,int y) this.x=x; this.y=y; class Test static void Main() Pointp=new Point(5,6); Console.WriteLine(“x=0“,p.x); Console.WriteLine(“y=0“,p.y); 答案:答案:x=5 y=6 4、class Decon1 public Decon1( ) Console.WriteLine(“调用构造函数调用构造函数 Decon1”); Decon1( ) Console.WriteLine(“调用析构函数调用析构函数 Decon1”); class Decon2 public Decon2( ) Console.WriteLine(“调用构造函数调用构造函数 Decon2”); Decon2( ) Console.WriteLine(“调用析构函数调用析构函数 Decon2”); class Test public static void Main() Decon1dec1=new Decon1( ); Decon2dec2=new Decon2( ); 答案:答案:调用构造函数调用构造函数 Decon1 调用构造函数调用构造函数 Decon2 5、usingSystem; class Test public void myMeth( ) int j; for(j=1;j=5) j=j*2; Console.WriteLine(j ); return; else j=j*3; Console.WriteLine(j ); return; static void Main( ) Test lei=new Test( ); lei.myMeth( ); 答案:答案:16 7、using System; class Test public void Swap(int x,int y) int k; k=x; x=y; y=k; static void Main() int a=8, b=68; Console.WriteLine(“a=0, y=1“, a, b); Testsw=new Test(); sw.Swap(a, b); Console.WriteLine(“a=0, y=1“, a, b); 答案:答案:a=8,b=68 a=8,b=68 8、using System; class TestoverLoad public void print(int i) Console.WriteLine(“输出的整数输出的整数=0“,i); public void print(strings) Console.WriteLine(“输出的字符串输出的字符串=0“,s); public void print(double d) Console.WriteLine(“输出的双精度数输出的双精度数=0“,d); classtest public static void Main( ) TestoverLoadapp=new TestoverLoad( ); app.print(6); app.print(“理解方法重载了吗?理解方法重载了吗?“) ; app.print(3.14); 答案:答案:输出的整数输出的整数=6 输出的字符串输出的字符串=理解方法重载了吗?理解方法重载了吗? 输出的双精度数输出的双精度数=3.14 9、classA public int count; public A() count = -1; public A(int n) count = n; class Test static void Main() Aa = new A(); Console.WriteLine(“count=0“, a.count); Ab = new A(5); Console.WriteLine(“count=0“, b.count); 答案:答案:count=-1 count=5 10、有以下程序,计算结果、有以下程序,计算结果 static void Main(string args) Console.Write(“输入一整数输入一整数“); String s = Console.ReadLine(); int num = int.Parse(s);
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2024-2025学前教育学原理期末试卷及答案
- 《计量学基础》试卷及答案
- 2025精麻药品培训考试试题库及参考答案
- 虚拟交互式可视化-洞察与解读
- 2025年事业单位招聘考试综合类结构化面试真题模拟试卷(工商类)
- 2025年事业单位招聘考试综合类职业能力倾向测验真题模拟试卷(长春)
- 2025年事业单位招聘考试面试真题模拟试卷权威解读集
- 2025年事业单位招聘考试综合类职业能力倾向测验真题模拟试卷(昆明)
- 2025年事业单位招聘面试真题模拟试卷:计算机科学与信息技术
- 递归诊断模型-洞察与解读
- 采购业务审计培训
- 2025-2026学年冀美版(2024)小学美术二年级上册(全册)教学设计(附目录P284)
- 服装色彩构成课件
- 化工仪表检修与维护课件
- 2025年华为软件开发工程师招聘面试题库及答案解析
- 程序化广告课件
- 电工基础课件
- 四川省石渠县2025年上半年公开招聘辅警试题含答案分析
- 真菌生物膜毒力因子-洞察及研究
- 基孔肯雅热危害及预防课件
- 副校长在任职宣布会上的表态发言材料
评论
0/150
提交评论