Final for Intermediate Computing
Based on Java naming conventions BankAccount: A) Class name B) Variable name D) Constant name E) package name
A) Class name
If a method does not return a value, the method is defined with following as a return type: A) static B) blank C) void D) null
C) void
In Java, a block of code is denoted with: A) Blank line B) [ ] C) { } D) ( )
C) { }
In Java, the parameters for a method are contained in: A) < > B) [ ] C) { } D) ( )
D) ( )
Subclasses inherit all attributes and methods, and are therefore able to access private components of the super class (T/F)?
False
The interface is the private view of a class, while the implementation is the public external view (T/F)?
False
When overriding a method in a subclass, you may choose to change the return type (T/F)?
False
Enumerations provide which benefits: A) Defined listed list of legal values B) Can be used inside a case statement C) The ordinal value can be used for ordering the list D) All of the above E) None of the above
A) Defined listed list of legal values
The three parts of a class definition in a class UML are: A) Name, attributes, methods B) Name, constructors, methods C) Attributes, constructors, methods D) MLT - something something sandwich
A) Name, attributes, methods
Which are true of a Java Abstract Class: A) You cannot create instances of an abstract class B) An abstract class cannot contain instance variables C) All of the methods are abstract D) All of the above E) None of the above
A) You cannot create instances of an abstract class
In OO design, composition is best described as a: A) has-a relationship B) is-a relationship C) One-to-many relationship
A) has-a relationship
In Java, the end of a statement is denoted with a: A) New line B) ; C) / D) #
B) ;
The CRC in CRC cards stands for: A) Classes, relationships, collaborations B) Classes, responsibilities, collaborations C)Classes, relationships, capabilities D)Capabilities, responsibilities, collaborations
B) Classes, responsibilities, collaborations
Attributes represent the current state of the object because they: A) Are the blueprints for the object B) Store information about the object C) Determine whether or not an object is used at a specific moment D) Are descriptive of the object's behavior
B) Store information about the object
All of the following are true of event driver programming except: A) Program execution centers around events and responding to them B) The program will execute beginning to end in sequence each time C) Involves coding listeners to listen for specified events D) Control is passed from object to object depending on the sequence of events
B) The program will execute beginning to end in sequence each time
Based on Java naming conventions bankAccount: A) Class name B) Variable name D) Constant name E) package name
B) Variable name
In OO design, inheritance is best described as a: A) has-a relationship B) is-a relationship C) One-to-many relationship
B) is-a relationship
Which of the following NOT a benefit of using inheritance: A)Allows for creating new classes that share some general behavior with a super class without duplicating code B) Allows the programmer to take advantage of polymorphism C) Allows subclasses to access the private instance variables of the super class. D) Allows for existing programs to continue to use instances of the original class, and new programs to utilize the new specialized class
C) Allows subclasses to access the private instance variables of the super class.
You can determine if a relationship is a good candidate for inheritance by following a simple rule: A) The superclass is more stable than the subclass B) The class has not already reused C) Class B is a Class A D) The class has not already been part of composition code.
C) Class B is a Class A
Private methods are meant to be part of the implementation and not the public interface, private methods are invoked: A) By other classes B) By other objects C) From within the class D) Only from the main method
C) From within the class
What is NOT a feature of procedural programming? A) The data is distinct from the process B) Typically includes global variables that are maintained by the program C) Utilizes abstraction to hide unnecessary details from the programmer D) The functions in a program, do not have a direct relationship with each other
C) Utilizes abstraction to hide unnecessary details from the programmer
The issues with updating an existing class to add additional functionality are: A) Every instance of the existing class gets the new features, even if they do not need them B) It may require creating and maintaining multiple versions of the same methods, which can lead to unnecessary complexity C) It requires recompiling the existing class and any existing programs that use it. D) All of the above E) A and B
D) All of the above
Which are true of a Java Interface: A) You cannot create instances of an interface B) An interface cannot contain instance variables C) All of the methods are abstract D) All of the above E) None of the above
D) All of the above
Based on Java naming conventions MAX_VOLUME: A) Class name B) Variable name C) Method name D) Constant name E) package name
D) Constant name
All of the following classes are used in the Java Swing and AWT packages except: A) JComponent B) JFrame C) JPanel D) JWindow
D) JWindow
What is NOT a feature of object oriented programming? A) Uses object that interact to solve a problem B) Uses self-contained objects that maintain their own data C) Utilizes abstraction to hide unnecessary details from the programmer D) The functions in a class, do not have a direct relationship with each other.
D) The functions in a class, do not have a direct relationship with each other.
The issues with creating a new class that replicates the implementation of another class while adding additional functionality are: A) It requires you to re-implement existing code B) It introduces duplication of code that will need to be maintained in parallel C) It requires recompiling the existing class and any existing programs that use it D) All of the above E) A and B
E) A and B
Based on Java naming conventions util: A) Class name B) Variable name C) Method name D) Constant name E) package name
E) package name
Declaring a class final means that any subclass cannot add additional instance variables (T/F)?
False
Generalization-specialization is the idea that as you make your way down the inheritance tree, things get more generalized (T/F)?
False
In OO design, the attributes and behaviors are contained within a single object, whereas in procedural design, the attributes and behaviors are normally separated (T/F)?
True
Inheritance allows for polymorphism, which allows for object instances of a subclass to respond differently to the same method call (T/F)?
True
Multiple objects can be instantiated from a single class (T/F)?
True
Overloading a method allows a programmer to use the same method name over and over, as long as the signature of the method is different each time (T/F)?
True
The super keyword is used to call methods in the superclass from within the sub class (T/F)?
True
You can recognize constructors because they have the same name as the class (T/F)?
True
An interface can be thought of as contract that requires a developer to comply with the specifications of an API (T/F)?
True
Cohesion refers to how well the attributes and methods in a class fit together (T/F)?
True
Declaring a method final means that any subclass cannot override the method (T/F)?
True
In Java, a subclass can only extend a single class, but an interface can extend multiple interfaces (T/F)?
True