1/140
Flashcards for reviewing lecture notes.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
Which type of relation in the class diagram?
Affects between classes (and not their instances).
How can you achieve if there are many classes in a class diagram to make their relationship cleared?
Split up the diagram.
When do we list a method in a derived class, if a method of the same name exists in the parent class?
If we declare or override it in the derived class.
When is the method of the parent class visible in the derived class?
Always, Only, if it is public, If we refer to it with the super keyword. If it is public or protected.
What is true about the dependency relation?
Weak association, The dependent object cannot create an instance of the class that generates the dependency, Strong association.
Which statement is false about generalization?
Java allows multiple generalizations, if we do not implement more than one interface. Java does not allow multiple generalization. Generalization is the opposite of specialization. In Java, we express it with the keyword extends.
What can be a generic parameter in Java?
Any type.
Which is considered an abstraction method?
Both. Usage of abstract methods. Usage of generic classes.
Can a generic class have an abstract method?
Yes.
Can an abstract class have a generic method?
Yes.
Which statement is false?
The collection groups any amount of data. The type of data stored in the collection is the same. In case of primitive types, we can instantiate the collection with the wrapper class of the primitive type. Arrays are not collections.
What data members can a static method use within its own class?
Members, that have getters Static members All members Static and public members
What can't we use a static attribute for?
For object attributes To define flags To define constant values For values shared by objects in the class
What types of exceptions must be caught or indicated?
None of the exceptions should be caught or indicated Exception and RuntimeException RuntimeException Exception
How can we define a custom exception?
We create an enum which contains the types of errors We create a simple class We cannot do that We derive our exception type from class Exception
Which statement is false about the serialization implemented by Java Serializable?
We can take a snapshot of the objects with it. Serialization saves both the state and relationships of an object and can deserialize them automatically. A typical tool to realize Remote Method Invokation (RMI). We can create a binary representation of the object.
What is the super class of the Swing controls?
JObject JFrame JControl JComponent
Which class represents the window in the Swing environment?
JFrame JWindow JPanel JDialog
Which method is used to define the behavior, that takes effect when we close the window?
enableExitOnClose(…) setAutoClose(…) setDefaultCloseOperation(…) setCloseBehavior(…)
Which pairs can be used to handle window events?
addWindowListener method - WindowEvents implementation addWindowEvents method - WindowAdapter implementation addWindowEvents method - WindowEvents implementation addWindowListener method - WindowAdapter implementation
Which statement is true?
The window icon file … …should be placed inside of the project folder always. …can be loaded both from the JAR of the program and from the file system the same way. …loading can be guaranteed to work always, if we place it in the JAR of the program. …could only be a bmp or ico file.
Which method can be used to add a mouse click handler to a Swing component?
addMouseListener addMouseWheelListener addMouseClickListener addMouseMotionListener
What should we do if we need to handle multiple types of mouse events?
We implement the MouseListener, MouseMotionListener, MouseWheelListener interfaces separately one by one. We create a class that implements all three interfaces (MouseListener, MouseMotionListener, MouseWheelListener). We need to add a separate interface implementation for each event. We derive an event handler class from the MouseAdapter.
What is the basic idea of programs that use event handlers?
While the program is running, certain activities are done as a result of events. The event object must be defined by the event handler. Errors are processed as events. We can respond to mouse clicks in separate functions.
Which statement is false about the event object?
It has a reference to where the event occurred. The source attribute that contains the source of the event always points to a real object. Carries the properties of the event. An appropriate event class can be created for similar types of events.
Which statement is false? The event handler function…
…receives as a parameter the triggered event to which it is currently responding. …contains the activity to be performed in response to that event. …used only to handle graphic event events. …can trigger other events while it is running.
Which statement is true?
The ButtonGroup is used to change the style of the assigned Buttons consistently. No more than one RadioButton can be selected in a JFrame at a time. ButtonGroup shows the RadioButtons in a visual frame. RadioButtons are in mutual exclusion when they are assigned to a ButtonGroup.
The NetBeans designer collects the initialization of visual elements in the following method…
initComponents initApplication initControls initializeComponents
The implementation of the event handler code of a button click can be found in the following interface
ActionListener ButtonClickListener EventClickListener ActionHandler
Which method of ActionListener should be implemented when we handle a button event?
onEvent handleClick onClick actionPerformed
What is true about the JList control?
JList stores the data, that has to be showned. The default model for JList is DefaultContainerModel. The type of data stored in the JList model is String. In the JList control, the selection of an element can be detected via the valueChanged event.
Which method of JTextField can be used to get the edited text?
getText getContent setText setContent
Which interface should be implemented if we want to be notified of a change in the value of the Slider?
ChangeListener ValueChangedListener StateChangeListener ScrollListener
Which method is used to obtain the content of a BufferedImage to draw on it?
getContent getGraphics getBitmap getImage
In which method can we redefine the drawing of a Swing UI component?
paintComponent drawComponent paint draw
Which method of Graphics2D can we use to draw? (Which one is an existing method?)
drawPie fillRectangle drawRoundRect clearRectange
Which statement is part of the Data Query Language?
SELECT * FROM table UPDATE table SET … CREATE TABLE tablename(…) INSERT INTO table (…) VALUES (…)
What is the Connection rollback () method used for?
Undoes database changes made since the connection was established. Revokes a user's access rights. Undoes the last transaction that was started but not yet committed. Cancels the last issued change request.
Which method call is incorrect on the rs variable of type ResultSet?
rs.getString(5); rs.getInt(2); rs.getInt(0); rs.getString("ADDR");
What do we call as Dirty Read?
Reading non committed data. Reading data stored in the wrong format. We are requesting too much data from the database manager. Reading finalized data.
What is true about a good database?
Ensures data integrity. All columns in each table are indexed. May contain redundancy. Keys can only consist of a single field.
What type does JPasswordField use to store data?
byte[] char[] String Character[] String
Which statement is true about JTable?
The table has a data object that implements the TableModel interface. The data is stored in the JTable. There is no default (abstract) implementation of TableModel. The fireTableStructureChanged method only invalidates the table structure.
Which methods of TableModel need to be implemented for minimal operation?
getValueAt getColumnName, getValueAt, getColumnClass getRowCount, getColumnCount, getValueAt getValueAt, getColumnName
To display the JTable, the Cell renderer uses the following type - display pair.
Number - TextField Boolean - CheckBox Date - DatePicker ImageIcon, Icon - PictureBox
Which statement is NOT TRUE about the condition?
The state has an identifier so it can be distinguished from the others. The state of the object can be described by the specific values of the attributes. The state persists as long as the values of the attributes of the objects satisfy the invariant assigned to the state. The termination of a state can occur suddenly by itself.
Which statement is FALSE?
When the object terminates, the object enters an out-of-system termination state. When the object expires, the state of the object is simply cleared. The termination of the state occurs as a result of an event. When the state of the object terminates, the object enters another state.
Which statement is true about the state diagram?
The nodes of the state diagram graph are events, the edges are state transitions. The state diagram can contain several initial states. A state diagram is a singly connected directed graph. A state diagram is an undirected graph.
The complexity of the state diagram can be reduced by the following method(s):
Generalization and aggregation of states. Aggregation of states. No way. Generalization of states.
Which statement is true?
The invariant of the aggregated and generalized states are the same. The invariant of the aggregated state is the disjunction of state invariants of the sub-states. The invariant of the generalized state is the disjunction of state invariants of the sub-states. The invariant of the generalized state is the conjunction of state invariants of the sub-states.
How do we mark the rendezvous point on a flowchart like activity diagram?
With a horizontal dashed line With a rectangle with rounded corners With a horizontal solid line With a diamond
In the collaboration diagram, between which objects does the collaboration take place?
Whose life cycle is interconnected. Instantized by the same object. Which are connected by an association. Which are instances of the same class.
Which diagram can be considered as an extension of the collaboration diagram?
Object diagram Class diagram Package diagram Component diagram
How do we mark the argument passed in the collaboration diagram during message sending?
With the envelope icon on the association. With a small arrow starts from a circle. With the message ID associated with the association. With the arrow pointing from the sender to the recipient.
How do we mark on a collaboration diagram if a message has multiple recipients?
With several arrows indicated on the association. The recipients are indicated by three rectangles that are shifted relative to each other. With multiplicity. We do not have the opportunity to do that.
Which is NOT a part of the user case diagram?
Users User accounts Usage relations User cases
How do we mark the user case on the user case diagram?
With a circle By making the name of the use case underlined With an ellipse With a rectangle
Threads
Sequence diagrams illustrate interactions between objects on a time axis going from the top to the bottom of the diagram. The lifeline of an object is the dashed line. The messages passed (that is, the method calls) between the objects are shown as the arrows. On the figure the arrows denote locking resources. We know that both threads need both resources. At which method call can we be sure that there is a deadlock? -At method 3
What will be the result of calling the wait() method of an object if the calling thread doesn't posess the monitor lock?
IllegalMonitorStateException will be thrown
What is the default priority of threads?
Default priority of a thread is 5 (NORM_PRIORITY)
Which possible outputs can this running code produce?
99999,99997,99977,99777,97777,77777 … 9 can’t follow a 7
What will be the result when running this code?
19
What will be the result when running this code?
False False Explanation: isAlive() returns true if the thread object’s “start()” has been called and hasn’t terminated yet. Here we never called it thus isAlive() always returns False
Which of these are atomic operations?
Reading/writing reference variables Reading/writing of all primitive types Both None of the above
Which statement is true of this code?
We can make the class thread-safe, if we make the run method synchronized. The class is thread-safe. We can make the class thread-safe, if we make the foo method static. This code throws an exception at runtime.
Which of these statements about immutable classes is not true?
The class should be final to avoid inheritance. All the attributes of the class should be declared as private final. We have to make a copy of the objects stored in attributes, when we return it in a getter method. The class should not contain any kind of methods, that change the state after the constructor.
Which of these SQL statements are DML statements?
update [table] set … delete from [table] … alter table … insert into [table] …
Which of these is an incorrect way to access the data in a ResultSet?
String value0 = rs.getString(0); String value1 = rs.getString(1); int value2 = rs.getInt(2); int value3 = rs.getInt(“ADDR_LN1”);
What information cannot be obtained from the SQLException object?
SQL status code. Driver / Database specific error code. Database request causing the error. Description of the error that occurred.
Which of the following statements is true?(If it has option D then D is correct if not A is correct)
CallableStatement extends the PreparedStatement interface. This interface can be used to call SQL stored procedures. Statement extends the PreparedStatement interface and is used when the SQL query does not need to be run multiple times. PreparedStatement is used to start static queries (eg select * from table), therefore PreparedStatements cannot be parameterize Batch processing of SQL statements is possible using PreparedStatement.
Which of the following statements is true?
PreparedStatement extends the CallableStatement interface. This interface can be used to call SQL stored procedures. Statement extends the PreparedStatement interface and is used when the SQL query does not need to be run multiple times. PreparedStatement is used to start static queries (eg select * from table), therefore PreparedStatements cannot be parameterized. Batch processing of SQL statements is possible using PreparedStatement.
How to start a new database transaction?
By requesting a Transaction object from Connection and calling that begin () method. By requesting a Transaction object from Connection and setting its autoCommit property to false. By calling the beginTransaction method of the Connection. By setting the autoCommit property of the Connection to false and executing an SQL statement.
When do we use the transaction on databases?
To run stored procedures To perform multiple operations atomically For a linked table query To name transfers
Which connection is usually interpreted with a connection table?
1-n connection B. m-1 connection C. m-n connection D. 1-1 connection
Which one is not part of the Entity-Relationship diagram?
Attribute Entity Keys Class
Which one is not true about the relationship between JTable and the model?
JTable does not contain data The model can be redefined The model cannot notify JTable of the change The representation of the model may differ from the data queried by JTable
What are the principal quality metrics of software?
Delivery time, implementation cost, hardware and software requirements. Maintainability, reliability,safety, efficiency, usability. Modifiability, Extensibility, Resolution, Reusability, Reliability. Ergonomics, usability, compatibility, hardware and software requirements.
Which of these is the structure of a user story?
USER … IN USE CASE … WITH RELATION … AS A … USE … TO … WHEN …APPLYING … IN ORDER TO … GIVEN … WHEN … THEN …
What is the correct order of requirements analysis steps?
feasibility analysis, requirement exploration, requirement specification, requirement validation requirement exploration, requirement specification, requirement validation, feasibility analysis requirement exploration, requirement validation, requirement specification, feasibility analysis requirement exploration, requirement specification, feasibility analysis, requirement validation
Which of these is not a software development process?
waterfall evolution scrum prototyping
Which of these are the relations of a UML use case diagram?
dependency, composition, usage, nesting precedes, include, usage, generalization usage, nesting, import), dependency interface, implementation, include
What is the UML deployment diagram used for?
Describe the sequence of steps required to install the software on a given machine. It depicts all the error possibilities that you may encounter during installation. Describe the software components according to how to install them in an installation package. Depict the physical placement of software components (on different machines) with therequired software environment.
Which OOP design principle is violated by the singleton design pattern? The singleton pattern guarantees that there is only a single instance created from a class which can be accessed through a static method.
Single Responsibility Principle Open/Closed Principle Liskov Substitution Principle Dependency Inversion Principle
Which of these techniques can be used to implement dependency inversion?
observer MVC (modell-view-controller) dependency injection generalization
What is Test Driven Development (TDD?
A software development method in which tests are written before the actual programcode iswritten. Test method to ensure that test cases cover all program units and are performed in the appropriate order. A general principle that states that all instructions in program code should be verified using unit tests (100% code coverage). A testing method in which unit tests are first performed on classes (and their methods), then integration tests are used to check the combined behavior of the classes, and finally system tests are used to check the behavior of the entire software.
Which the following features is not provided by unit testing frameworks?
Create manual test cases in separate program units (classes). Generate test cases automatically, that covers all scenarios, by analyzing the code. Assert statements, which compare the expected and the return values. Creation of test reports, which lists the passed/failed tests.
In the case of Unit testing, the parts of the program must be separated from each otherand boundaries must be established between them. One possible solution to this is to use objects that mimic the behavior of other objects. What are these objects called?
A. Mock objects B. Modules C. Units D. Atoms
What is the starting point of object-oriented design?
Functions Activities Entities and relations Architecture
How do we express that an object is related to several objects of a class?
With composition With multiplicity With an array type attribute With aggregation
Which of these can we assign constraints to on a class diagram?
Relation Attribute Method parameters All
Which of these relations is between classes?
Association Dependency Inheritance Aggregation
Which diagram is not part of the dynamic model?
State diagram Sequence diagram Activity diagram Component diagram
What cannot have a state on a state diagram?
Name Invariant Precondition Parameter
Which method can reduce the complexity of the state diagram?
Generalization Aggregation By generalization and aggregation None of the others
Which statement is true?
The invariant of generalization is the disjunction of the invariants of states The invariant of generalization is the conjunction of the invariants of states The invariant of aggregation is the disjunction of the invariants of states The states obtained by the two methods have no invariant
Which diagrams are part of the static model?
Class Diagram, Object Diagram Class Diagram, State Diagram Object diagram, Sequence diagram Object Diagram, Activity Diagram
Based on the following implementation, which relationship exists exactly between the car and theengine?
Association Aggregation Composition Generalization
Based on the following implementation, which relationship exists exactly between the car and the engine?
Association Aggregation Composition Generalization
What is the relationship between the Person and Phone classes in the class diagram below?
Association Aggregation Composition Generalization
What kind of methods do we have to implement when we would like to use instances of our own class as keys in a HashMap?
== operator hashCode(…) method equals(…) method hashCode(…) and equals(…) methods