高级程序员考试题_第1页
高级程序员考试题_第2页
高级程序员考试题_第3页
高级程序员考试题_第4页
高级程序员考试题_第5页
全文预览已结束

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、高级程序员闭卷测试题一、选择(共20分,每题5分)1下列数组初始化语句哪些是正确的。ABA. int nums = new int0,1,2,3,4;B. int num_1 = new int0,1,new int0,1,2,new int0,1,2,3 ;C. int num_2 = 0,1,0,1,2,0,1,2,3;2选择正确答案填入括号。通过使用 base 关键字可以从派生类中访问基类成员( )。可以从静态方法中访问基类成员( )。AB 正确错误3下列数据对象类型中,哪些是从ICollection接口上派生的。在您认为正确的选项括号中打“”符号。ABEG A. List<T&g

2、t; ( ) B. ArrayList ( ) C. Buffer ( ) D. BitMap ( ) E. Queue ( ) F. SortedList ( ) G. Stack ( ) H. Convert ( ) I. Stream ( )4下列哪些是ICollection接口中的方法或属性。在您认为正确的选项括号中打“”符号。 A. Add ( ) B. CopyTo ( ) C. RemoveAt ( ) D. Count ( ) D. Insert ( ) E. GetEnumerator ( ) G. Clear ( )二、查看下面代码,划掉错误或无效代码,简单说明原因。将正确

3、的代码写在上方空白处。(共45分)第1题:5分using System;using System.Drawing;public class UserListBox : ListBoxpublic UserListBox() protected override void OnDrawItem(DrawItemEventArgs e) Rectangle rect = e.Bounds; using (Graphics gs = new Graphics() using (SolidBrush bs = new SolidBrush(Color.Blue) gs. FillEllipse (bs

4、, rect);第2题:5分using System;using System.Drawing;public class UserClasspublic UserClass ()public void DrawRectangle(Graphics gs, Rectangle rc)using (SolidBrush bs = new SolidBrush(Color.Blue) gs.DrawRectangle(bs, rc); 第3题:5分public struct Person public string Name; public string Nationality; public Pe

5、rson() Name = "张三" Nationality = "汉族" public Person(string name, string nationality) Name = name; Nationality = nationality; 第4题:30分using System;using System.Drawing;public class Class1private const int DEFAULT_WIDTH = 100;private const int DEFAULT_HEIGHT = 100;private const Poin

6、t m_locator = new Point(0, 0);private Size m_pictureSize = new Size(DEFAULT_WIDTH, DEFAULT_HEIGHT);public Class1() public Point Locator get return m_locator; public Size PictureSize get return m_pictureSize; set if (value != null) m_pictureSize = value;public class Class2 : Class1public Class2(int p

7、ictureWidth) this.PictureSize.Width = pictureWidth;public class Class3 : Class2public Class3(int ws) : base(CalcWidth(ws)public int CalcWidth(int ws) int width = 0;foreach (int w in ws) width += w;return width;三、请阅读下面的代码。 问按如下所示方式调用代码段void DrawRectangleWithString(),可否得到(图1)所示的输出结果?如果不能,请指出问题出在那里?(20

8、分)(图1)using System;using System.Windows.Forms;using System.Drawing;using System.Drawing.Drawing2D;using System.Runtime.Serialization;using System.Security.Permissions;namespace DrawShapes public partial class Form1 : Form public Form1() InitializeComponent(); private void Form1_Paint(object sender,

9、PaintEventArgs e) Rectangle newRect = new Rectangle(30, 30, 500, 20); float angle = 15; DrawRectangleWithString(e.Graphics, newRect, angle); public void DrawRectangleWithString(Graphics graphics, Rectangle rect, float angle) string str = "如果程序正确的话,本字符串将沿着下面画出的一个矩形长边长边排列" Matrix rotateMatri

10、cs = new Matrix(); Point centerPos = new Point(rect.Left, rect.Top); rotateMatrics.RotateAt(angle, centerPos); graphics.Transform = rotateMatrics; graphics.DrawString(str, new Font("宋体", 11), Brushes.Red, rect); GraphicsPath graphicsPath = new GraphicsPath(); graphicsPath.AddRectangle(rect

11、); graphicsPath.Transform(rotateMatrics); graphics.SmoothingMode = SmoothingMode.HighQuality; graphics.DrawPath(Pens.Blue, graphicsPath); graphicsPath.Dispose(); 五、下面的代码段中存在错误或无效代码, 请指出。(15分)static void HasRows(SqlConnection connection) using (connection) SqlCommand command = new SqlCommand( "SELECT CategoryID, CategoryName FROM Categories;", connection); connection.Open(); SqlDataReader reader = new SqlDataReader (); if (r

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论