NIIT_MMS1期末试卷2015春A.docx_第1页
NIIT_MMS1期末试卷2015春A.docx_第2页
NIIT_MMS1期末试卷2015春A.docx_第3页
NIIT_MMS1期末试卷2015春A.docx_第4页
NIIT_MMS1期末试卷2015春A.docx_第5页
全文预览已结束

下载本文档

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

文档简介

NIIT-1(C#) 课程 期末 A 试卷 考试形式 闭卷 考试用时 2h,本试卷共 5页,另请加答题纸 张,草稿纸 张题号一二三四五六七八九十总分合分人得分 一、单项选择题(每小题2分,共30分) 1. Which of the following options is correct way of declaring a variable?A. rectangle.area B. no_of_countsC. 9_rank D. private2. Which of the following options is not a technique to implement polymorphism?A. Method overloading B. Operator overloadingC. Method overriding D. Information hiding3. Which of the following options are not the possible states of a mobile phone?A. Off B. RingC. Vibrate D. Color4. Identify the output of the following code snippet:Console.WriteLine(“DrbbTom Wilkins”);A. DrbbTom Wilkins B. Dr Tom WilkinsC. Tom Wilkins D. Drb bTom Wilkins5. If x is -10 and y is 3, then predict the value of variable x after execution of the following statement: x%=y;A. -3 B. 3 C. -1 D. 16. Which of the following statements is the correct syntax of declaring a character array?A. char ch; B. char ch ; C. char ch; D. char ch ;7. Which of the following methods of the Array class will return the member of items in an array? A. GetLength() B. GetValue() C. Indexof() D. Sort()8. Consider the following code snippet: class Succes Public void calculate() How will you derive a class named Reward from the preceding class? A. class Reward : Success B. class Success : Reward C. class Reward : Success D. class Success : Reward9. You want to create a class named Army that consists of various attributes and methods. You want to ensure that this class should not be inherited by any other class. A. By declaring the class as static B. By declaring the class as abstract C. By declaring the class as sealed D. By declaring the class and its attributes and methods as abstract10. Which of the following classes will you use to write binary data to a stream? A. StringWriter class B. FileStream class C. StreamWriter class D. BinaryWriter class11. Which of the following states says that a thread is runnable? A. Sleeping B. Suspended C. Blocked D. Waiting12. Which of the following statements is NOT true about implementing polymorphism? A. You can implement polymorphism by implementing an interface. B. You can also achieve polymorphism by using inheritance. C. You can implement polymorphism by using encapsulation. D. You can implement polymorphism by using abstract classes.13. Consider the following statements. Statement A:Static variables retain their values even after the function to which they belong has been executed. Statement B:Static functions can access static as well as non-static variables. Which of the following options is corrent with respect to the preceding statements? A. Statement A is true and statement B is false. B. Statement A is false and statement B is true. C. Both statements A and B are true. D. Both statements A and B are false.14. Which of the following type s is a reference type variable? A. Structure B. Enumeration C. Integer D. Array15. Which of the following operators will evaluate an expression to true only if all the conditions being evaluated are true? A. & B. | C. = D. !=请将结果填入下表中题号12345678910答案题号1112131415答案二、 填空题(每小题2分,共12分)1. The access specifier allows a class to hide its member variable and member methods from other classes.2. The block in the if_else construct is optional and can be omitted.3. The statement is used to skip all the subsequent instructions and take the control back to the loop.4. is a method that has the same name as the class and has no return type.5. All the classes in the C# programming language extend from the base class.6. User-defined exception classes are derived from the .三、 判断题(每小题1分,共12分)1.Once the classes are created, they can be placed in libraries so that they can be reused in other programs that have similar requirements.2. We can implement information hiding in programs with the help of access specifiers. 3. Classes needed to be designed in such a way that the dependency between the classes is minimal.4. In case of a logical OR operator(|), if the first condition evaluates to true, the second condition is not evaluated.5. The WriteLine() method is used to write on the screen. To read the input provided by the users, you can use the ReadLine() method.6. The private members of a class are not visible outside the class. 7. Overloading a binary operator is similar to overloading a unary operator, except that a unary operator requires an additional parameter.8. In the while loop, the while statement always checks the condition after executing the statements within the loop.9. A class may have multiple constructors with different arguments.10. In the list of parameters for a method, param arrays should not be the last parameter.11. Interface enables a class to inherit multiple behaviors from multiple interfaces.12. When an instance of the Thread class is created, the thread enters the started state.请将结果填入下表中(正确的在题号下方写T, 错误的在题号下方写F)题号123456789101112答案四、 阅读程序写结果(每小题6分,共18分)1. 【程序1】using System;class Test const int N = 6; public static void Main() int a = 0; for (int i = 1; i N; i+) int c = 0, b = 1; a += 3; c = a + b; Console.Write(0,6, c); Console.WriteLine(); 运行结果为:2【程序2】using System;class Calculate static int number; public void Display(int num) Console.WriteLine(num); public Calculate() Console.WriteLine(Instantce Constructor invoked); number+; Display(number); static Calculate() Console.WriteLine(Static Constructor invoked); number = 15; number+; Calculate() Console.WriteLine(Destructor invoked); static void Main(string args) Calculate Cal1 = new Calculate(); Calculate Cal2 = new Calculate(); 运行结果为:3. 【程序3】using System;class Test public static void Main() int a = 2, 4, 6, 8, 10, 12, 14, 16, 18, 20 ; for (int i = 0; i a.GetLength(0); i+) Console.Write(0,4, ai); if (i + 1) % 4 = 0) Console.WriteLine(); Console.WriteLine(); 运行结果为:五、 程序填空(每空2分,共8分) /*The following Code implements the StreamWriter class to accept data from a user and write the same into the file*/using System;using ;Class FileWrite public void WriteData()FileStream fs=new FileStream(“Myfile.txt”,FileMo

温馨提示

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

最新文档

评论

0/150

提交评论