set-9
415. Which would you use if you wanted a relatively permanent connection between sender & receiver objects?
- Attribute, or global
- Parameter, or local
- Both A and B
- Only parameter
Show me the answer
Answer: 1. Attribute, or global
Explanation:
- An attribute or global variable provides a relatively permanent connection between sender and receiver objects, as it persists throughout the object’s lifecycle.
416. Which would you use if you didn’t want a permanent connection?
- Parameter, or local
- Attribute, or global
- Both A and B
- Only Attribute
Show me the answer
Answer: 1. Parameter, or local
Explanation:
- A parameter or local variable provides a temporary connection between sender and receiver objects, which is useful when a permanent connection is not needed.
417. ______ is the way to achieve global visibility.
- Use a global variable in C++,
- Static (or class) variable (in C++ or Java) or
- The .Singleton pattern (a static method that returns the object)
- All of them
Show me the answer
Answer: 4. All of them
Explanation:
- Global visibility can be achieved using global variables, static/class variables, or the Singleton pattern. All these methods provide a way to access an object globally.
418. Design class diagrams (DCD) provides details of the software classes along with ______
- Parameters
- Visibility
- Use cases
- Methods
Show me the answer
Answer: 4. Methods
Explanation:
- Design Class Diagrams (DCD) provide details of software classes, including their methods, attributes, and relationships. Methods are a key part of class design.
419. A Class consists of which of these abstractions?
- Set of the objects
- Attributes
- Operations
- All of the mentioned
Show me the answer
Answer: 4. All of the mentioned
Explanation:
- A class consists of a set of objects, attributes (data), and operations (methods). These abstractions define the structure and behavior of the class.
420. A class is divided into which of these compartments?
- Name Compartment
- Attribute Compartment
- Operation Compartment
- All of the mentioned
Show me the answer
Answer: 4. All of the mentioned
Explanation:
- A class is divided into compartments for the class name, attributes, and operations. These compartments organize the information about the class in a UML diagram.
421. An attribute is a data item held by which of the following?
- Class
- Object
- All of the mentioned
- None of the mentioned
Show me the answer
Answer: 3. All of the mentioned
Explanation:
- An attribute is a data item held by both classes and objects. It represents the state or characteristics of the class or object.
422. What Does a Composite name consist of in a UML Class and object diagram?
- Delimiter
- Simple names
- Digits
- All of the mentioned
Show me the answer
Answer: 4. All of the mentioned
Explanation:
- A composite name in UML consists of simple names, digits, and delimiters. It is used to create unique and meaningful names for classes and objects.
423. Select which one is model static data structures.
- Deployment diagram
- Class diagrams
- Activity diagrams
- Interaction diagrams
- All of the above
Show me the answer
Answer: 2. Class diagrams
Explanation:
- Class diagrams model static data structures, showing the classes, attributes, and relationships in a system. They provide a static view of the system’s structure.
424. Select the diagrams that are used to explain data structures, and the static snapshots parts of the things place in the class diagrams.
- Use case
- Collaboration
- Object
- Sequence
- None of these
Show me the answer
Answer: 3. Object
Explanation:
- Object diagrams are used to explain data structures and provide static snapshots of the objects and their relationships at a specific point in time.
425. ______ select from the following in which engineering and reverse engineering can be applicable
- Tagged values
- Stereotypes
- Class diagram
- Both 1 and 2
Show me the answer
Answer: 5. Both 1 and 2
Explanation:
- Engineering and reverse engineering can be applied to tagged values and stereotypes in UML. These elements provide additional information about the model and can be used in both forward and reverse engineering processes.
426. ______ are part of the class operation specification format?
- Name
- Parameter list
- Return-type list
- All of the mentioned
Show me the answer
Answer: 4. All of the mentioned
Explanation:
- The class operation specification format includes the operation name, parameter list, and return-type list. These elements define the behavior of the operation.
427. Which among these are the rules to be considered to form Class diagrams?
- Class symbols must have at least a name compartment
- Compartment can be in random order
- Attributes and operations can be listed at any suitable place
- None of the mentioned
Show me the answer
Answer: 1. Class symbols must have at least a name compartment
Explanation:
- Class symbols in UML must have at least a name compartment. The order of compartments (attributes, operations) is not random and follows a standard convention.
428. Given this class diagram, suppose we execute the following code:
- In Minivan
- In Minivan or Car
- In Minivan, Car, or Vehicle
- In Car
- In Car or Vehicle
Show me the answer
Answer: 3. In Minivan, Car, or Vehicle
Explanation:
- The
drivesOnRoad()
method could be defined in Minivan, Car, or Vehicle, as Minivan inherits from Car, which inherits from Vehicle. The method could be overridden in any of these classes.
429. Given this class diagram, suppose there is a method pass, defined in Car as
Suppose imp is an instance of Car (or one of its subtypes).
When I invoke the above method using imp.pass(pokey), what must be true of actual parameter pokey?
- Its actual type is Car
- Its actual type is Car, SportsCar, or Minivan
- Its actual type is Car or Vehicle
- It depends on the actual type of imp
- None of the above
Show me the answer
Answer: 2. Its actual type is Car, SportsCar, or Minivan
Explanation:
- The parameter
pokey
must be of typeCar
or one of its subtypes (SportsCar
orMinivan
). This is because the methodpass
is defined to accept a parameter of typeCar
.
430. Given the below class diagram and code fragment, what happens?
- The code compiles and executes fine
- Code fails at compile time, error in line 2
- Code fails at compile time, error in line 5 [correct]
- Code fails at execution time, error in line 2
- Code fails at execution time, error in line 5
Show me the answer
Answer: 3. Code fails at compile time, error in line 5
Explanation:
- The code fails at compile time because the
Garage
class does not have aparkCar
method defined. This results in a compilation error in line 5.
431. Implementation in an OOP language requires writing source code for:
- Class and interface definitions
- Method definitions
- Both A and B
- None
Show me the answer
Answer: 3. Both A and B
Explanation:
- Implementation in an OOP language involves writing source code for both class and interface definitions, as well as method definitions. These are essential components of object-oriented programming.
432. Basic class definitions can be written from the design class diagrams. Which of the following information can be extracted:
- Class name
- Attributes: name, type and access specifier
- Method: name, return type, parameters and their types, and its access specifier
- All of the above
Show me the answer
Answer: 4. All of the above
Explanation:
- Design class diagrams provide all the necessary information to write basic class definitions, including class names, attributes (name, type, access specifier), and methods (name, return type, parameters, and access specifier).
433. During the creation of methods form interaction diagram, the sequence of messages in an interaction diagram translates to a series of statements in the method definitions. Is this statement true?
- Yes
- No
Show me the answer
Answer: 1. Yes
Explanation:
- The sequence of messages in an interaction diagram translates directly to a series of statements in the method definitions. This helps in implementing the behavior defined in the interaction diagram.
434. One-to-many relationships are common. For example, a Sale is associated with a group of SalesLineItem objects. In OO programming languages, these relationships are usually implemented using collection objects such as Vectors, Lists, Maps, arrays and so on. In which phase these relations are maintained?
- CREATING CLASS DEFINITIONS FROM DCDS
- CONTAINER/COLLECTION CLASSES IN CODE
- ORDER OF IMPLEMENTATION
- EXCEPTIONS AND ERROR HANDLING
Show me the answer
Answer: 2. CONTAINER/COLLECTION CLASSES IN CODE
Explanation:
- One-to-many relationships are implemented using container/collection classes such as Vectors, Lists, or Maps. These relationships are maintained during the implementation phase.
435. How to maintain the visibility to a group of other objects? For example, a Sale must maintain visibility to a group of SalesLineItem instances. Which phases handles these?
- CREATING CLASS DEFINITIONS FROM DCDS
- CONTAINER/COLLECTION CLASSES IN CODE
- ORDER OF IMPLEMENTATION
- EXCEPTIONS AND ERROR HANDLING
Show me the answer
Answer: 2. CONTAINER/COLLECTION CLASSES IN CODE
Explanation:
- Visibility to a group of objects (e.g., a Sale maintaining visibility to SalesLineItem instances) is handled using container/collection classes during the implementation phase.
436. In order of implementation phase, Classes need to be implemented (and ideally, fully unit tested) from least-coupled to most-coupled. Is this statement true?
- Yes
- No
Show me the answer
Answer: 1. Yes
Explanation:
- Classes should be implemented and unit tested from least-coupled to most-coupled to ensure that dependencies are managed effectively and testing can be done incrementally.
437. ______ are anomalous situations during a program’s execution.
- Exceptions
- Errors
- Delay
- Noise
Show me the answer
Answer: 1. Exceptions
Explanation:
- Exceptions are anomalous situations that occur during a program’s execution, such as invalid input or resource unavailability. They are used to handle unexpected events gracefully.
438. The unexpected situations that may occur during program execution are
- Running out of memory
- Resource allocation errors
- Inability to find a file
- Problems in network
- All of the above
Show me the answer
Answer: 5. All of the above
Explanation:
- Unexpected situations during program execution include running out of memory, resource allocation errors, inability to find a file, and network problems. These are all examples of exceptions.
439. Every try statement should be followed by at least one catch statement; otherwise ______ will occur.
- No execution
- Null
- Zero
- Compilation error
Show me the answer
Answer: 4. Compilation error
Explanation:
- In most programming languages, a
try
block must be followed by at least onecatch
block or afinally
block. If not, a compilation error will occur.
440. State whether the following statements are True or False.
- A catch can have comma-separated multiple arguments.
- Throwing an Exception always causes program termination.
- True, False
- False, True
- True, True
- False, False
Show me the answer
Answer: 1. True, False
Explanation:
- A
catch
block can have multiple arguments separated by commas in some languages (e.g., Java 7+). However, throwing an exception does not always cause program termination; it depends on whether the exception is caught and handled.