面向对象程序设计MultipleChoice_3_第1页
面向对象程序设计MultipleChoice_3_第2页
面向对象程序设计MultipleChoice_3_第3页
全文预览已结束

下载本文档

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

文档简介

Multiple Choice Quiz 3 1 Which of the following statements about constructors in Java is true a A constructor must be defined as public b A class can define more than one constructor c A constructor must be defined as static d A class must define at least one constructor 2 Which is the Java keyword used to denote a class method a class b private c final d static 3 If a class contains a constructor that constructor will be invoked a once the first time an object of that class is instantiated b each time an object of that class is instantiated c once at the beginning of any program that uses that class d each time an object of that class goes out of scope 4 Which of the following statements about class variables in Java is not true a All objects have their own copy of the class variable defined in the instantiated class b Non static methods in a class can access the class variable defined in the same class c Class variables require the modifier static in the declarations d Class variables do not need the reference to the object of the instantiated class to access them 5 Consider the following Java program segment import java io public class Test public Test System out println default public Test int i System out println non default public static void main String args Test t new Test 2 Which of the following will be output during execution of the program segment a The line of text default b The line of text non default followed by the line of text default c The line of text default followed by the line of text non default d The line of text non default 6 Which of the following categorizations can be applied to both the data fields and the methods in a Java class a default and non default b native and non native c abstract and non abstract d static and non static 7 From within a child class its parent class is referred to via the keyword a parent b base c super d this 8 Which is a Java access modifier used to designate that a particular data field will not be inherited by a subclass a default b private c protected d final 9 When a subclass defines an instance method with the same return type and signature as a method in its parent the parent s method is said to be a private b overloaded c hidden d overridden 10 Consider the following Java class definitions public class Object1 protected String d return Hi public class Object2 extends Object1 protected String d return super d Which of the following statements is are true regarding the definitions Class Object2 inherits from class Object1 Class Object2 overrides method d Method d returns equivalent results when executed from either class a I and II only b III only c I and III only d I II and III 11 What is used to indicate that a method does not return a value a the keyword void b the name of the class to which it belongs c the keyword static d the omission of the return type 12 The return type for a method that returns nothing to its caller is a false b not specified in the method definition c void d null 13 The term class variable is a synonym for a an instance variable b a private data field c a read only variable d a static data field 14 If the method int sum int a int b is defined in a Java class C which

温馨提示

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

评论

0/150

提交评论