(Spring 2019) Software configuration: Rain classroom papers (Chapter 6)

6-1 maintainability

1 minute multiple choice question 1

The following three scenarios involving software maintenance activities are called ___

1 iOS App upgrade under 10, so that it can run in 11 iOS;
2 user reports a functional bug, the bug fix and re-publish;
3 to improve performance, release a patch

A prophylactic, integrity, corrective
B adaptability, corrective, integrity
C perfect, adaptability, prophylactic
D error correction, preventive, adaptability

The correct answer: B

2 multiple choice questions 2 points

On software maintenance and evolution argument, the right is ___

A design and development phase is necessary to consider the future of maintainability, rather than wait until after the software publisher to consider
B frequent changes in software code, may lead to increased software complexity and quality of decline in
most of the cost of software development from C in the maintenance phase
D software maintenance software development team is working in the "operation and maintenance engineer"

The correct answer: ABC

3 multiple choice questions 2 points

The following ___ can improve software maintainability

A high cohesion, low coupling
responsibility for each class B should be as single
C follow design principles LSP Class
D abstract modules should not depend on a particular module
E to avoid generating class "indicates leakage"
F. To reduce code complexity, improve code readability

The correct answer: ABCDEF
Answer Analysis:
A Obviously, this is the maintainability of the most basic principles
SRP B "single responsibility principle"
C LSP principle
D OCP principle
E principle of information hiding
F apparently

Multiple choice question 4 2 points

About maintainability say, it is inappropriate ___

A greater number of classes used in the development, the more difficult to protect
the smaller the impact of existing code B extended range of new features, the higher the maintainability
of a method of client calls the class C, the desired method of the more parameters, future maintenance costs may be greater the
more the overload and override class-D structure in use, the higher maintenance costs

The correct answer: A
Answer Analysis:

How many Class A and maintainability not directly related

B This is the "maintainability" goal

C interface to be as small as possible, many parameters, interactive complex and difficult to maintain

D overload and excessive ovverride, understandability affect the code, it will certainly cause some degree of decreased maintenance

5 1 minute multiple choice questions

About "Open - Closed Principle" (OCP) to say, is not correct ___

A can be extended by adding a new class in the class structure existing
B class structure when expanded, or should not have as little change in code written
C to support the OCP, the client should not be used directly concrete classes, but should as far as possible using the interface
D clients to use an interface to call the method, the object can be avoided by declaring a specific implementation class

The correct answer: D

6 1 minute multiple choice questions

Notes for the maintainability of OO design principles, is not correct __
A demand for client classification, a set of methods used by the client together into the same interface, the other methods of separating out
B if the client code appears a call to a specific implementation class, the interface is preferably introduced into the client to avoid direct contact class
C to reduce the coupling between classes as possible, and the more delegation between classes, the greater the degree of coupling may be.
When D when demand changes, first consider modifying the original code, and then consider adding new classes to meet the

The correct answer: D

6-2 for maintainability design patterns

1 minute multiple choice question 1

About Factory Method pattern, is not correct is __

A If you do not want to specify the type of object to specifically created in client code, using this mode suitable
B define an interface, which comprises a factory method, and then complete the objects of different sub-types in its different implementation class creates an instance of
C plants the method can be implemented as static, ie static factory method
D using the factory method to create an object instance is an interface type, use the instanceof can not know the specific type of client code

The correct answer: D

2 multiple choice questions 2 points

Factory Method (FM), and Abstract Factory (AF) mode, the error is __

A AF mode to create a number of different types of object instances follow the rules fixed with the client in order to solve problems
B AF mode when you create each type of instance, essentially using the FM mode
C Client can not use only one of the AF implementation class to create a single instance of an object must be at the same time create a plurality of different types of object instances
D Client can be used to replace multiple FM AF mode, can achieve the same object
E to be changed if different types of objects with fixing instances, only the need to expand the new abstract factory class can achieve

The correct answer: CD
Answer Analysis:

For option C: AF implementation class provides several factory methods to create a different type of object instances, respectively, Client can call only one and ignore the other. Of course, doing so would be meaningless abstract factory method.

2 min 3 multiple choice questions (pending)

About Builder mode, the error is __

A Client not a bunch of objects to be scattered, but a complete object (consisting of several small objects)
B Client does not need to know how each part of creation, how a combination of these details completely hidden in the Director category among
C Builder in construction when the internal parts of complex objects, we need to follow a strict order of construction
D can support a wide variety of building products, as long as the realization of a concrete builder classes for each product can be

The correct answer: C

1 minute multiple choice question 4

Insert pictures described herein
in the mode shown in FIG builder, each responsible for "portion" approach is assembled _

A Builder的buildPart()
B Builder的getResult()
C ConcreteBuilder的getResult()
D Director分的construct()

The correct answer: D
Answer Analysis:

construct () is responsible for calling each "section" of the build method, meaning each is about a part of the object gradually constructed. While the getResult () is the result (single object) is obtained after assembly.

5 1 minute multiple choice questions

About Bridge mode of argument, it is not correct ____

A through delegation + inheritance relationship between two particular classes, to avoid direct "contact" between the concrete class
relationships between two concrete object B Bridge mode is set up in the translation stage, realized during the operating phase delegation
C Bridge mode, the relationship between the two objects are stored permanently in the ADT
D Bridge achieve two inheritance inheritance tree, the relationship between different subclasses of the two trees is dynamically determined in the client code, client's specific needs

The correct answer: B

6 1 minute multiple choice questions

About proxy mode, the statement is not correct __

A purpose is to establish a separation between the code and the class code particular client accessed
Proxy classes A and B actually performing tasks Client actually requested, or both implement the same interface with the same parent
Client must know the code for the Proxy class C Proxy's name and a new object instance, or can not use the features
of the Proxy class D Client can be requested to implement lazy initialization, lazy loading, etc., to reduce the burden to perform specific tasks like

The correct answer: C
Answer Analysis:

Option C: Of course you can use the factory method to proxy to hide, invisible to client.

1 minute multiple choice question 7

About composite mode, not correct to say that __

This mode is used to solve the problem A "recursive comprising", a plurality of objects constituting a runtime tree structure
of all nodes in the tree structure B, implement the same interface or inherit from the same class, in line with the principles of LSP
C each object has a node type Field set, storage node object of its lower number of elements> 0 within the set
D of the tree structure is dynamically at runtime client codes built up in accordance

The correct answer: C

8 1 minute multiple choice questions

About observer mode, it is not correct ___

A mode set the delegation to-many relationship between a subject and a target group of observer objects
B Observer object to invoke object subject attach () method, the subject is added to the object's own "fan" queue
C when the object is subject when the state changes, which each observer callback object update () method
D in Java, for each particular observer class inherits from the observer Java classes

The correct answer: D

9 1 minute multiple choice questions

About visitor mode is not correct __

A mode may be the operation of a certain defined ADT ADT extracted from the original implementation class out separately on the implementation class visitor
Example B to pass into the ADT original visitor different implementation class, can be done on the object instance ADT different operations, but without changing the original ADT code
C is visit the ADT, a need to provide accept (Visitor v) a method facilitates transmitting an external visitor instance come
D is visit the ADT, may be provided, such as accept (Visitor v1, Visitor v2) method, to make a combination of two support ADT externally operable

The correct answer: A
Answer Analysis:

A Option: This option is similar to the form, but this is not the intention of visitor patterns

Option D: all of a sudden expansion of the two operations? It can actually be achieved.

10 multiple choice questions 2 points

The following about Java in -able and -ator saying is not correct __

A Comparator is an interface, the method of its class to be implemented is the compareTo (T A)
B the Comparable is an abstract class, subclass needs to be implemented is Compare (T A1, T A2)
C the Iterable is an interface Iterator () is the class to implemented method
D Iterator is an abstract class, method subclasses to be achieved are the hasNext (), Next (), Remove ()
E Observable is an abstract class, one of the ways subclasses to achieve is the notifyObservers ()
F. the Observer is abstract class, subclass one of the ways to achieve that update (...)

The correct answer: ABDF

6-3 maintainability construction techniques

1 minute multiple choice question 1

About State design pattern is not correct is __

A delegation mechanism using the state transition behavior delegated to a plurality of separate class to complete State
B each particular State class objects representing a certain state can be achieved, and for the completion status can be carried out in this state transition, returned to the client a new state instance
C avoids the use of if / else structure ADT internal code implementing a state transition condition may support future extensions
D ADT they need to provide an accept (state s) in a procedure similar to judge The current status is the final state

The correct answer: D

Multiple choice question 2 1 point

Here Insert Picture description
about Memento mode is not correct _

A Originator need memo category
B Memento object represents a "backup" in a historical state
C Originator Memento classes using management class and a series of historical Caretaker state, ready for backup and restore
D notes and recovery operation by the client-side code initiate, rather than initiated by the Originator Memento class and class

The correct answer: C

3 1 minute multiple choice questions

the Caretaker {class
List new new MS = the ArrayList <> ();
public void addMemento (Memento m) {
ms.add (m);
}
public Memento getMemento (I int) {
return ms.get (I);
}
}
if the client-side want to restore the state of the current time from the most recent backup of the i-th inverse of the code "?" should be ___

A i
B i-1
C ms.size()-i
D ms.size()-i+1

The correct answer: C

1 minute multiple choice question 4

the Caretaker {class
List new new MS = the ArrayList <> ();
Memento getMemento (I int) {
return ms.get (?);
}
Memento REPEAT (I int) {
return ms.get (??);
}
}
Client with getMemento after (i) to resume the countdown i-th backup status, I would like to call repeat (i) to undo this recovery, that is, back to the state before recovery, then the above code "??" should be ___

Ms.size A () - I
B + I. 1
C ms.size () -. 1
above D ABC are unable to do so

The correct answer: D

5 1 minute multiple choice questions

About Table-driven construction, is not correct is ___

A code in the complex, and if-else statement is separated from the switch-case code out by the complete lookup
table B driven programming operating efficiency will be much lower than conventional if-else and switch-case manner, the need to compromise between
C of unknown origin "table", either the final variable in the code, it can be an external file or database (read from a file or program is running into the library)
D benefit is that when the rules change, the business logic code without modification, improved maintainability

The correct answer: B
Answer Analysis:

B: If the table is fianl variables in the code, its efficiency is higher than if / else statement.

6 multiple-choice questions 2 points

The following statement on Grammar, is not correct ___

A grammar-driven programming to follow apply to the text data of the specific format from the external read and parse them scene
B Regular grammar means can be simplified to the expression after a grammar that does not contain any non-production terminating node
C is not always regular expression grammar Regular
D the parse Tree parser is obtained according to the particular grammar after analyzing the results of a string
E in the grammar operator, | precedence over the + and *

The correct answer: CE

1 minute multiple choice question 7

:: = B EN * F. M?
B :: =>
E :: =: |; |. 8
N :: = - | ^
M :: = D | O | P
following string matches the syntax definition __?

A :-^[
B B:^D
C :—D
D ❤️

The correct answer: C

8 1 minute multiple choice questions

Which of the following string contents of the regular expression is represented by the equivalent of ____

A

(cbc)
c(bc)
B

? [z] + (y by ) *
? \ w + (y) (to be)
C

(a|b|c*)(d?)
(a|b|c
)(c|d)
D

([^ ABC] + X *) +
^ A BC + X
correct answer: C

9 1 minute multiple choice questions

In Java regular expressions, \ d and \ w represent __

A [0-9] [a-zA-Z_0-9]
B A whitespace character [^0-9]
C 1 [ \t\n\x0B\f\r]
D [^0-9] [^\s]

The correct answer: A

10 multiple choice questions 2 points

__ The following string is in line with legal strings following regular expression?

(.[a-z]+.)+[a-z]+(:[0-9]+)?
A hit.edu.cn
B hit.ed.u.c.n:88880?
C .hit.ed.u.cn:088888
D .hit.ed.u.cn

The correct answer: C
Correction: four options are not right. According to the structure of the syntax, the string is divided into three parts, respectively, wherein the first portion matches a "point" before and after a group of letters, in accordance with this rule, option C and D ".hit." Match first out, followed by of "ed" in part 2 is matching syntax, and "ed" behind the "." will not match up.

11 multiple choice questions 1 minute

From a linguistic point of view, the Java compiler javac __ corresponds with the Java source code corresponding to the AST corresponding to __

A Parser generator, Grammar
B Parser, Grammar
C Parser, Parse tree
D Parser generator, Parse tree
正确答案:C


  1. -zA-a Z_0-9 ↩︎

Published 113 original articles · won praise 1067 · Views 170,000 +

Guess you like

Origin blog.csdn.net/JAck_chen0309/article/details/105022475