Multiple Choice Questions for Refactoring

  • 1 Refactoring is important when you:
    1. add a routine
    2. add a class
    3. fix a defect
    4. All of above

  • 2 Class interface refactoring that make better class is to _______________.
    1. move a routine to another class
    2. eliminate a routine
    3. hide a class variable
    4. encapsulate unused class

  • 3 Class implementation refactoring improve with following class level.
    1. Change reference objects to value objects
    2. Change value objects to reference objects
    3. Change member class or data placement
    4. a and b
    5. a and c

  • 4 Statement level refactoring that improve the use of individual statements is:
    1. Move an expression inline
    2. Decompose a Boolean expression
    3. Replace an expression with a routine

  • 5 Data level refactoring that improve the use of variables and other kinds of data is to _________.
    1. move an expression inline.
    2. replace an expression with a class.
    3. introduce a global variable routine.

  • 6 Select the two reasons that leads to refactoring
    1. A routine is too long
    2. A class has Strong cohesion
    3. Global variables are not used
    4. Code is duplicated.

  • 7 Which of the following refactoring is not the refactoring that improve code at the individual-routine level.
    1. Extract routine/extract method
    2. Move a routine’s code inline
    3. Substitute a simple algorithm for a complex algorithm
    4. Replace an expression with a routine
    5. Combine similar routines by parameterizing them

  • 8 Which level of refactoring suggests that if a variable is used for more than one purpose (for example i, j, temp, and x), then create separate variables for each usage, with a more specific name.
    1. Statement-Level Refactoring
    2. Data-Level Refactoring
    3. Routine-Level Refactoring

Contact Us
Write to Us View Help
Subject Expert Logo

Subject Expert

Learn and Evaluate

Follow Us
© 2020 - Subject Expert