Modules Flashcards

1
Q

This term is known as the Subunit of programming problem
- break down the programming problems into reasonable units, tackle one small task at a time.
- Also called subroutines, procedures,
functions, or methods

Understanding the Advantages
of Modularization

A

Modules

Understanding the Advantages
of Modularization

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are the 2 programming languages that use the module “subroutine”

Understanding the Advantages
of Modularization

A

(COBOL, RPG)
Subroutines

Understanding the Advantages
of Modularization

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are the 2 programming languages that use the module “functions”

Understanding the Advantages
of Modularization

A

(C, C++)
Functions

Understanding the Advantages
of Modularization

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the programming language that uses the module “procedures”

Understanding the Advantages
of Modularization

A

(VB)
Procedures

Understanding the Advantages
of Modularization

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What are the 2 programming languages that use the module “methods”

Understanding the Advantages
of Modularization

A

(C#, Java)
Methods

Understanding the Advantages
of Modularization

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

This term is known as the process of:

  1. Breaking down a large program into modules
  2. Smaller and manageable

Understanding the Advantages
of Modularization

A

Modularization

Understanding the Advantages
of Modularization

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What are the 3 reasons why modularization is important?

Understanding the Advantages
of Modularization

A

Reasons
* Abstraction or selective ignorance.
* Allows multiple programmers to work on a problem
* Reuse your work more easily

Understanding the Advantages
of Modularization

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Which one of the 3 parts of modularization is this?

  • Paying attention to important properties while ignoring nonessential details
  • This allows developers to interact with modules without needing to understand their internal complexities.
  • Selective ignorance

Modularization Provides
Abstraction

A

Abstraction

Modularization Provides
Abstraction

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What advantage of abstraction is this?

  • Use English-like vocabulary
  • One broad statement corresponds to dozens of machine instructions

Modularization Provides
Abstraction

A

Newer high-level programming languages

Modularization Provides
Abstraction

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

TRUE OR FALSE: Modules provide another way to achieve
abstraction

Modularization Provides
Abstraction

A

TRUE

Modularization Provides
Abstraction

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

TRUE OR FALSE

Rarely does a single programmer write a
commercial program through modularization

Modularization Allows Multiple
Programmers to Work on a Problem

A

TRUE

Modularization Allows Multiple
Programmers to Work on a Problem

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

TRUE OR FALSE: Professional software developers can write new programs quickly by dividing large programs into
modules through modularization

Modularization Allows Multiple
Programmers to Work on a Problem

A

TRUE

Modularization Allows Multiple
Programmers to Work on a Problem

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

This is one of the features of modular programs:

  • Allows individual modules to be used in a
    variety of applications
  • Many real-world examples of reusability

Modularization Allows You to
Reuse Your Work

A

Reusability

Modularization Allows You to
Reuse Your Work

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What are the basic steps (mainline logic) of a program?

Modularizing a Program

A

Main program

Modularizing a Program

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What are the 3 components to include in a module?

Modularizing a Program

A
  • Header
  • Body
  • Return Statement

Modularizing a Program

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

This part of a module includes the module identifier

Modularizing a Program

A

Header

Modularizing a Program

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

This part of a module contains all the statements in the module

Modularizing a Program

A

Body

Modularizing a Program

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

This is the part of a module that marks the end of the module and identifies the point at which control returns to the program or module that called the module

Modularizing a Program

A

Return Statement

Modularizing a Program

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

In naming this, it is
* Similar to naming a variable
* Module names are followed by a set of parentheses

Modularizing a Program

A

Naming a module

Modularizing a Program

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

TRUE OR FALSE
Module names must be one word

Modularizing a Program

A

TRUE

Modularizing a Program

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

TRUE OR FALSE
Module names can have NO meaning

Modularizing a Program

A

FALSE

Modularizing a Program

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

TRUE OR FALSE

Module names can have NO meaning

Modularizing a Program

A

FALSE

Modularizing a Program

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

TRUE OR FALSE

Modules frequently use a verb, because modules perform some action.
* Get, calculate, display

Modularizing a Program

A

TRUE

Modularizing a Program

24
Q

Two rules used for naming modules (same with
variable identifier)

Modularizing a Program

A
  • Most languages allow letters and digits
  • Some languages allow hyphens, underscore

Modularizing a Program

25
Q

When a main program wants to use a
module, what happens?

Modularizing a Program

A

“Calls” the module’s name

Modularizing a Program

26
Q

Symbol used to call a module is a rectangle with a bar across the top
* Place the name of the module you are
calling inside the rectangle
* Draw each module separately with its own sentinel symbols
* Sentinel value – represent an entry or exit point. Eof (end of file)

Modularizing a Program

A

Flowchart

Modularizing a Program

27
Q

These statements are used to determine what?
* Does not depend on a fixed set of rules
* Programmers do follow some guidelines
* Statements should contribute to the
same job

Modularizing a Program

A

Determine when to break down any
particular program into modules

Modularizing a Program

28
Q

Programmers do follow some guidelines, some companies may have these Rules:

  • A modules instructions should never take
    more than a page
  • A module should never have more than 30 statements
  • Never have a module with only one
    statement
  • A better policy is to place together statements that contribute to one specific task

What rules are they called?

Modularizing a Program

A

Arbitrary Rules

Modularizing a Program

29
Q

What is the highest level of cohesion where every element in the module is dedicated to a single and narrowly focused task?

Modularizing a Program

A

Functional cohesion

Modularizing a Program

30
Q

What is this process called?

  • Input, processing, and output statements
  • Variable and constant declarations

Declaring Variables and Constants
within Modules

A

Place any statements within modules

Declaring Variables and Constants
within Modules

31
Q
  1. Variables and constants declared in module are usable only within the module
  2. Can be seen and accessed by other parts of that module or block of code where they are declared

Declaring Variables and Constants
within Modules

A

Visible

Declaring Variables and Constants
within Modules

32
Q
  1. Variables and constants declared in module are usable only within the module
  2. Can be seen and accessed by other parts of that module or block of code where they are declared

Declaring Variables and Constants
within Modules

A

Visible

Declaring Variables and Constants
within Modules

33
Q

This where variables and constants are defined. it means they are valid and accessible within that specific part
of the code.

Declaring Variables and Constants
within Modules

A

In Scope

Declaring Variables and Constants
within Modules

34
Q

Term used to describe self-contained units that are easily transported

Declaring Variables and Constants
within Modules

A

Portable

Declaring Variables and Constants
within Modules

35
Q

A type of variable and constant:

  • Known to the entire program
  • Declared at the program level
    Visible to and usable in all the
    modules called by the program

Declaring Variables and Constants
within Modules

A

Global variables and constants

Declaring Variables and Constants
within Modules

36
Q

Mainline logic of almost every procedural computer program follows a general structure for declarations

Understanding the Most Common
Configuration for Mainline Logic

A

Declarations for global variables and constants

Understanding the Most Common
Configuration for Mainline Logic

37
Q

What type of task includes any steps you must perform at the beginning of a program to get ready for the rest of the program?

Such as displaying instructions to users, displaying reporting headings, opening any files the program requires.

Understanding the Most Common
Configuration for Mainline Logic

A

Housekeeping tasks

Understanding the Most Common
Configuration for Mainline Logic

38
Q

What type of task includes the following?

Doing the core work of the program
Repeated execution for each set of input data until there are no more

Understanding the Most Common
Configuration for Mainline Logic

A

Detail loop tasks

Understanding the Most Common
Configuration for Mainline Logic

39
Q

What type of task includes the steps you take at the end of the program to finish the application, which might include the displaying totals or other final messages and closing any open files

Understanding the Most Common
Configuration for Mainline Logic

A

End of job tasks

Understanding the Most Common
Configuration for Mainline Logic

40
Q

What type of chart is this?
* Shows the overall picture of how modules are related to one another
* Tells you which modules exist within a program and which modules call others
* Specific module may be called from several locations within a program

Creating Hierarchy Charts

A

Hierarchy chart

Creating Hierarchy Charts

41
Q

What is the tool used to develop the overall relationship of program modules before you write them?

Creating Hierarchy Charts

A

Planning tool

Creating Hierarchy Charts

42
Q

What is the tool used to see how modules are related after a program is written?

Creating Hierarchy Charts

A

Documentation tool

Creating Hierarchy Charts

43
Q

What is one of the features needed in good program design?

Use of program comments

Features of Good Program Design

A

Use program comments where
appropriate

Features of Good Program Design

44
Q

What is one of the features needed in good program design?

Use of Identifiers

Features of Good Program Design

A

Identifiers should be well-chosen (variable
name)

Features of Good Program Design

45
Q

What is one of the features needed in good program design?

Designing clear statements

Features of Good Program Design

A

Strive to design clear statements within your programs and modules

Features of Good Program Design

46
Q

What is one of the features needed in good program design?

Use of clear prompts

Features of Good Program Design

A

Write clear prompts and echo input (statements)

Features of Good Program Design

47
Q

What is one of the features needed in good program design?

Good programming

Features of Good Program Design

A

Continue to maintain good programming
habits as you develop your programming
skills (keep practicing)

Features of Good Program Design

48
Q

What type of comment fits the following?

  • Written explanations
  • Not part of the program logic
  • Serve as documentation for readers of the program

Using Program Comments

A

Using Program Comments

Using Program Comments

49
Q

Use an annotation symbol to hold information that expands on what is stored within another flowchart symbol.

Using Program Comments

A

Flowchart

Using Program Comments

50
Q

What are the 6 general guidelines in choosing identifiers for naming variables and constants?

Choosing Identifiers

A
  1. Give a variable or a constant a name that is a noun
  2. Give a module an identifier that is a verb
  3. Use meaningful names
    * Self-documenting
    * EmployeeLastName
  4. Use the system your language allows to separate words in long, multiword variable names
  5. Consider including a form of the verb to be
  6. Name constants using all uppercase letters separated by underscores (_)
    ex. BUTTON_LOGIN

Choosing Identifiers

51
Q

TRUE OR FALSE

Organizations sometimes enforce different rules for programmers to follow when naming variables
* Hungarian notation

Choosing Identifiers

A

TRUE

Choosing Identifiers

52
Q

What are the two rules in designing in clear statements?

Example:

Line 5 set someNumber = 2 + 4;
Line 6 set otherNumber = someNumber;

Designing Clear Statements

A
  • Avoid confusing line breaks
  • Use temporary variables to
    clarify long statements

Designing Clear Statements

53
Q

What are the three rules in avoiding confusing line breaks?

Avoiding Confusing Line Breaks

A
  • Most modern programming languages
    are free-form
  • Take care to make sure your
    meaning is clear
  • Do not combine multiple statements
    on one line

Avoiding Confusing Line Breaks

54
Q

What is the type of variable not used for input or output?

  • Working variable that you use during a
    program’s execution
  • Consider using a series of temporary
    variables to hold intermediate results

Using Temporary Variables to
Clarify Long Statements

A

Temporary variables or Work variable

Using Temporary Variables to
Clarify Long Statements

55
Q

What is the type of input used to describe the following?

  • Repeating input back to a user either in a
    subsequent prompt or in output
  • It confirms to the user what they entered,
    ensuring that the program received the correct input

Writing Clear Prompts and Echoing Input

A

Echoing Input

Writing Clear Prompts and
Echoing Input

56
Q

Every program you write will be better if
you follow what 5 steps?

Maintaining Good Programming Habits

A
  1. Plan before you code
  2. Maintain the habit of first drawing flowcharts or writing pseudocode
  3. Desk-check your program logic on paper
  4. Think carefully about the variable and module names you use
  5. Design your program statements to be easy to read and use

Maintaining Good Programming Habits