CSE 205
A method that may throw an un-checked exception must either catch that exception or declare that it throws an exception in its header.
False
If you declare no constructors in your class, the compiler will not create a default constructor
False
If you do not declare a default constructor in your class, the compiler will always create a default constructor for you
False
A class from which you can create objects is called a concrete class.
True
A method that may throw a checked exception must either catch that exception or declare that it throws an exception in its header.
True
All methods in an interface are automatically public
True
An advantage of composition is the fact that we can sometimes reuse classes that we have already written, instead of having to design and write new classes.
True
The benefit of data hiding is that we can make an object truly responsible for what it knows and what it does
True
In general, data hiding means that an object keeps what it knows private
True
The Java keyword throw is used to catch an exception.
False
The equals method and the == operator perform the same actions.
False
The finally block of a try/catch structure will execute only if an exception occurs in the try block.
False
You cannot have an object reference whose type is an abstract class.
False
Every Java program consists of at least one _____.
a) class definition b) none of these c) while loops d) condition e) System.out.println statement. Answer: a) class definition
Data hiding makes encapsulation work
True
Members that are public in the derived class are visible in the super class.
False
An object is an instance of a class.
true
Which object oriented element best allows us to designing and implementing families of related types that share outward similarities, but have specialized behaviors?
a) Composition b) Polymorphism c) Inheritance d) Encapsulation e) Data Hiding f) none of these g) Message Passing Answer: b) Polymorphism
The object oriented element that allows us to build more complex objects out of simpler objects is.
a) Data Hiding b) Composition c) Inheritance d) Polymorphism e) none of these f) Encapsulation g) Message Passing Answer: Composition
Which object oriented element is best defined as "an object should have complete authority over its responsibilities"?
a) Data Hiding b) Inheritance c) Message Passing d) none of these e) Polymorphism f) Composition Answer: a) Data Hiding
Which object oriented element is best defined as "objects best viewed as packages of responsibility"?
a) Inheritance b) Composition c) Polymorphism d) Data Hiding e) none of these f) Encapsulation g) Message Passing Answer: c) Encapsulation
Encapsulation is about assigning responsibilities to objects
True
Objects encapsulate state
True
The differences between value types and reference types applies to parameters
True
The finally block of a try/catch structure will execute if an exception occurs in the try block.
True
The finally block of a try/catch structure will execute if no exception occurs in the try block.
True
Which object oriented element is used to define "has a" relationships?
a) Polymorphism b) Composition c) Inheritance d) Message Passing e) Encapsulation f) none of these g) Data Hiding Answer: b) Composition
What structure is commonly used to iterate over all the elements of a two dimensional array?
a) a single loop b) none of these c) a nested loop d) a recursive function e) an else-if ladder Answer: c) a nested loop
Methods used to access an object's private data are called _______
a) actors and stages b) getters and putters c) getters and setters d) none of these e) actors and viewers b) getters and setters
In Java an expression like the one below will evaluate to ______.new Bunny("Flopsy", 8)
a) an object b) a Bunny c) an object reference d) a null reference e) none of these Answer: c) an object reference
The purpose of a constructor is to _____.
a) build an object in memory b) initialize an object to a valid state c) none of these d) clear space in memory for an object Answer: b) initialize an object to a valid state
Constructor methods are not inherited.
True
Data hiding can allow us to separate the information from its representation
True
During what activity do we directly analyze the language pf the problem to identify objects, their attributes and their behaviors
a) class outlining b) none of these c) noun/verb analysis d) problem description e) use case diagramming Answer: c) noun/verb analysis
Creating an object of a class is called _____.
a) classification b) genesis c) none of these d) instantiation Answer: d) instantiation
When there are no remaining references to an object, the object will be _______
a) destroyed b) none of these c) created d) instantiated e) initializedAnswer: Answer: a) destroyed
Operations are things an object _____.
a) does b) calls c) knows d) resembles e) none of these f) delegates Answer: a) does
If a reference type variable does not store a reference to an object, then it stores _____.
a) none of these b) an empty string c) a null reference d) a boolean e) a default reference c) a null reference
The java keywords "public" and "private" are called _____
a) none of these b) buffers c) scope modifiers d) access modifiers Answer: d) access modifiers
The most widely used modeling tool for software design and construction is ______
a) none of these b) flowcharts c) pseudocode d) The United Modeling Language (UML) Answer: d) The United Modeling Language (UML)
Creating an object of a class is called _______
a) none of these b) genesis c) instantiation d) classification Answer: c) instantiation (probably, definitely not none of these)
Method overloading distinguishes between methods based on _____
a) number of lines of code b) use of loops c) none of these d) argument count only Answer: c) none of these
In Java class members are declared with the keyword ______
a) static b) global c) local d) void Answer: a) static
Which of the following is/are true about arrays? Choose all that apply.
a) the elements of an array are accessed by an integer index b) the elements of an array all located contiguously in memory c) the elements of an array all have the same data type d) an array is a set of variables e) none of these Answer: a, b, c, d
Immediately after the object's variables are initialized _________
a) the object is destroyed b) the object is suspended c) a constructor is called d) the object is ready for use e) none of these Answer: c) a constructor is called
A subclass that inherits instance variables from its super class may not declare additional instance variables.
a) true b) false Answer : b) false
An object and the variable that refers to it are two different things.
a) true b) false Answer: a) true
You can always use a sub-class object in place of a super class object.
a) true b) false Answer: a) true
An object's operations are implemented as _____.
a) variables b) methods c) classes d) none of these Answer: b) methods
In Java a variable must...
a) zeroed before it can be used b) be normalized before it can be used c) be deleted before it can be used d) be initialized before it can be used e) None of the above Answer: e): None of the above If "declared before it can be used" is an option choice, choose that instead of e)...
Attributes are things an object _____
a)none of these b) calls c) knows d) does e) delegates f) resembles answer: c) knows