Software Engineering II MCQs with Answers
Practice important Software Engineering II MCQs with answers and explanations.
Chapter: 43
Q1261:
Which method in the final code directly returns the frequent renter points?
A. getPoints()
B. frequentRenterPoints()
C. rentalPoints()
D. getFrequentPoints()
Correct Answer:
B
Chapter: 43
Q1262:
Eliminating temps helps in making methods _______.
A. Longer
B. More dependent
C. Smaller and modular
D. More confusing
Correct Answer:
C
Chapter: 43
Q1263:
What is the main reason for moving the rental charge calculation to the Movie class?
A. To reduce code
B. To improve readability
C. To reduce dependency on other objects' attributes
D. To increase performance
Correct Answer:
C
Chapter: 43
Q1264:
In the Movie class, what does the charge method primarily depend on?
A. Number of days rented
B. Movie title
C. Rental ID
D. User information
Correct Answer:
A
Chapter: 43
Q1265:
What is the switch statement in the Movie class based on?
A. Movie name
B. Movie price code
C. Rental ID
D. Customer ID
Correct Answer:
B
Chapter: 43
Q1266:
In the charge method, which case multiplies days rented by 3?
A. REGULAR
B. CHILDRENS
C. NEW_RELEASE
D. OLD_MOVIE
Correct Answer:
C
Chapter: 43
Q1267:
In the context, why is passing the length of rental preferred over passing movie type?
A. Type information is less volatile
B. Type information is more volatile
C. Length is more secure
D. Length is easier to compute
Correct Answer:
B
Chapter: 43
Q1268:
Which method is used in the Rental class after moving charge to Movie class?
A. rentalCharge()
B. charge(daysRented)
C. calculateAmount()
D. movieCharge()
Correct Answer:
B
Chapter: 43
Q1269:
In the updated Rental class, what does the charge() method return?
A. _tape.movie().charge(_daysRented)
B. _movie.tape().charge(_daysRented)
C. _daysRented.movie().charge(_tape)
D. tape()._daysRented.charge(_movie)
Correct Answer:
A
Chapter: 43
Q1270:
What problem can arise from chaining method calls across package boundaries?
A. Compilation error
B. Slower performance
C. Increased coupling
D. Easier debugging
Correct Answer:
C
Chapter: 43
Q1271:
Which field is made private static final in the Movie class?
A. NEW_RELEASE
B. TAPE
C. RENTAL_ID
D. MOVIE_NAME
Correct Answer:
A
Chapter: 43
Q1272:
What does the method newRegular(String name) in Movie class return?
A. A New Release movie
B. A Regular movie
C. A Children's movie
D. A New Movie
Correct Answer:
B
Chapter: 43
Q1273:
Which pattern is recommended to handle changing movie classifications?
A. Singleton pattern
B. Observer pattern
C. State pattern
D. Adapter pattern
Correct Answer:
C
Chapter: 43
Q1274:
Why can't we use subclasses directly to change movie classification?
A. Subclasses are immutable
B. Objects cannot change class during lifetime
C. Subclasses cannot have methods
D. Subclasses are hard to implement
Correct Answer:
B
Chapter: 43
Q1275:
How are new Price objects managed in the new design?
A. Using arrays
B. Using static methods returning singletons
C. Using dynamic arrays
D. Using manual memory management
Correct Answer:
B
Chapter: 43
Q1276:
What type of method is Price.regular()?
A. Constructor
B. Static method
C. Abstract method
D. Instance method
Correct Answer:
B
Chapter: 43
Q1277:
In the new Price hierarchy, what is the superclass?
A. RegularPrice
B. ChildrensPrice
C. NewReleasePrice
D. Price
Correct Answer:
D
Chapter: 43
Q1278:
The method beNewRelease() in Movie class changes the price to which type?
A. Price.regular()
B. Price.newRelease()
C. Price.childrens()
D. Price.oldRelease()
Correct Answer:
B
Chapter: 43
Q1279:
Price classes implement their own version of which method?
A. charge(int daysRented)
B. movieName()
C. rentalID()
D. calculateDiscount()
Correct Answer:
A
Chapter: 43
Q1280:
The Price class is designed as an ________.
A. Interface
B. Abstract class
C. Final class
D. Enum
Correct Answer:
B