CIT301: Structured Programming Course Guide

CIT301 STRUCTURED PROGRAMMING Course Team

  • Dr. Moses Ekpenyong - Developer/Writer
  • Prof. Stephen Olabiyisi - Content Editor
  • Dr. Francis B. Osang – HOD/Internal Quality Control Expert

CIT 301 COURSE GUIDE

  • National Open University of Nigeria Headquarters
  • Printed, 2022
  • ISBN: 978-058-557-5

CONTENTS

  • Introduction
  • Course Objectives
  • Working Through this Course
  • Study Units
  • References and Further Readings
  • Presentation Schedule
  • Assessment
  • How to get the Most from the Course
  • Facilitation

INTRODUCTION

  • CIT301: Structured Programming is a 3-credit unit course.
  • Targeted towards BSc in Computer Science and related fields.
  • Divided into 8 modules and 20 study units.
  • Covers programming languages, principles of abstraction and modularity, structured programming, C language, operators, control statements, functions, arrays, structures, and pointers in C.

COURSE OBJECTIVES

Upon completion, students should be able to:

  • Define programs and classify programming languages.
  • State advantages and disadvantages of high and low-level languages.
  • State characteristics of a good program.
  • Explain phases of program development.
  • Describe functions and procedures in programming.
  • Illustrate function structure in C.
  • Define class in Object-oriented programming.
  • Explain modularity concepts.
  • Discuss header files, module implementation, and main programs in C.
  • List and apply C language characters, variables, data types, and constants.
  • Utilize operators in C programming and describe control structures.
  • Differentiate between monolithic and modular programming.
  • Utilize arrays, strings, and pointers in C.

WORKING THROUGH THIS COURSE

  • Study all units in progression.
  • Complete self-assessment exercises and tutor-marked assignments (TMAs).
  • Submit TMAs timely (30% of total marks).
  • Prepare for final examination (70% of total marks).

STUDY UNITS

  • Module 1: Programming Languages
    • Unit 1: Computer Programming
    • Unit 2: Characteristics of a Good Program
    • Unit 3: Phases of Program Development
  • Module 2: Abstraction and Modularity
    • Unit 1: Introduction to Abstraction
    • Unit 2: Modular Programming
    • Unit 3: Modular Interface
  • Module 3: Elements of Structured Programming
    • Unit 1: Overview of Structured Programming
    • Unit 2: Programming Language Paradigms
  • Module 4: Structured Programming with C
    • Unit 1: Overview of C
    • Unit 2: C Program Design
    • Unit 3: Executing a C Program
  • Module 5: Introduction to C Programming Language
    • Unit 1: Element of C
    • Unit 2: Data Type
    • Unit 3: Variables, Statements, Expressions
  • Module 6: Operators and Control Statements
    • Unit 1: Operators
    • Unit 2: Overview of Control Statements
  • Module 7: Functions and Arrays in C Programming Language
    • Unit 1: Overview of Functions in C
    • Unit 2: Arrays
    • Unit 3: Fundamentals of Strings
  • Module 8: Structure and Pointers in C
    • Unit 1: Structure and Pointers

REFERENCES AND FURTHER READINGS

  • Refer to all study units for in-depth reading.

PRESENTATION SCHEDULE

  • Specific dates for TMAs and tutorials will be provided.

ASSESSMENT

  • Assessment is composed of TMAs and a final exam.
  • TMAs contribute 30% and the final exam contributes 70% of the total score.

HOW TO GET THE MOST FROM THE COURSE

Distance Learning Strategies
  1. Read the course guide thoroughly.
  2. Organize a study schedule to cover all material.
  3. Be proactive in contacting your tutor for assistance.
  4. Regularly complete self-assessment exercises.
  5. Ensure timely submission of assignments.
  6. Engage with all study units and references.
  7. Review objectives regularly.
  8. Practice programming on your computer as needed.

FACILITATION

  • Details on tutorials including timings and locations will be shared.
  • Attend tutorials for direct interaction with tutors.

MODULE 1: PROGRAMMING LANGUAGES

UNIT 1: COMPUTER PROGRAMMING

CONTENTS

1.0 Introduction
2.0 Intended Learning Outcomes
3.0 Main Contents

  • 3.1 Classification of Programming Languages
  • 3.2 Low Level Language
  • 3.3 High Level Language
  • 3.4 Features of High-Level Language
    4.0 Conclusion
    5.0 Summary
    6.0 Tutor-Marked Assignment
    7.0 References/Further Reading
1.0 INTRODUCTION
  • A program is a finite set of sequenced instructions.
  • Programming involves writing commands in programming languages.
  • Two major types of programming languages: Low level and High level.
2.0 INTENDED LEARNING OUTCOMES

By the end of this unit, you should be able to:

  • Define programs and classify programming languages
  • State advantages and disadvantages of high- and low-level languages
3.0 MAIN CONTENTS
3.1 CLASSIFICATION OF PROGRAMMING LANGUAGES
  • Low Level Language:
    • Closer to machine language; faster and more efficient use.
    • Examples include Machine Language and Assembly Language.
    • Machine Language:
      • Native language of the computer, directly understood.
      • Advantages: Fast, efficient, no translation needed.
      • Disadvantages: Bulky, difficult to read and write, prone to errors.
    • Assembly Language:
      • Uses mnemonics for easier coding but requires translation (assembler).
      • Advantages: Simplifies complex tasks, more memory efficient.
      • Disadvantages: Cumbersome, expensive, requires knowledge of machine architecture.
  • High Level Language:
    • Abstracts details of hardware; human-readable forms.
    • Examples include Java, C++, Python, etc.
    • Advantages: Easier to learn, portable across systems.
    • Disadvantages: Slower execution than low-level languages.
3.2 LOW LEVEL LANGUAGE
  • Closer to machine and hardware, efficient in resource usage.
  • Machine Language:
    1. Native (binary);
    2. Executes directly by CPU;
    3. Fast and efficient but hard to learn.
  • Assembly Language:
    1. Utilizes mnemonics;
    2. Requires an assembler for translation;
    3. Easier than machine language; machine-dependent.
3.3 HIGH LEVEL LANGUAGE
  • Easier to program;
  • Examples include: Pascal, C, FORTRAN, COBOL, JAVA, etc.
  • Advantages:
    • Easier to write, maintain and understand programs.
    • More adaptable across different systems.
  • Disadvantages:
    • Slower than low-level languages.
    • May consume more system resources.
3.4 FEATURES OF HIGH-LEVEL LANGUAGE
  1. Machine independence;
  2. Problem-oriented;
  3. Readability and portability;
4.0 CONCLUSION
  • Two major categories exist in programming.
  • Understanding these helps in selecting the right language for programming tasks.
5.0 SUMMARY
  • Definitions of terms provided; differentiation between programming languages.
6.0 TUTOR-MARKED ASSIGNMENT
7.0 REFERENCES/FURTHER READING
  • Fundamentals of Structured Programming, Lubia Vinhas, 2016
  • Structured Programming with C++ by Kjell Backman, 2012

MODULE 1: PROGRAMMING LANGUAGES

UNIT 2: CHARACTERISTICS OF A GOOD PROGRAM

CONTENTS

1.0 Introduction
2.0 Intended Learning Outcomes
3.0 Main Content

  • 3.1 Characteristics of a Good Program
  • 3.2 Phases of Program Development
    4.0 Conclusion
    5.0 Summary
    6.0 Tutor-Marked Assignment
    7.0 References/Further Reading
1.0 INTRODUCTION
  • Characteristics are crucial for success in programming.
2.0 INTENDED LEARNING OUTCOMES

By the end of this unit, you should be able to:

  • List and describe characteristics of a good program;
  • Identify phases in program development.
3.0 MAIN CONTENT
3.1 CHARACTERISTICS OF A GOOD PROGRAM
  1. Portability: Must run on multiple machines.
  2. Reliability: Must function as expected under different conditions.
  3. Efficiency: Optimal resource usage, time, and memory.
  4. Clarity and Simplicity: Simple, easy to read and understand.
  5. Understandability/Readability: Code should be clear for users and other developers.
  6. Flexibility/Adaptability/Maintainability: Easy to modify and maintain the program.
3.2 PHASES OF PROGRAM DEVELOPMENT
  1. Problem definition/analysis.
  2. Algorithm selection or development.
  3. Program design.
  4. Coding programming statements.
  5. Compiling.
  6. Testing/running and debugging.
  7. Documentation.
  8. Maintenance.
4.0 CONCLUSION
  • Characteristics ensure effective programming.
  • Adhering to these phases assures program reliability.
5.0 SUMMARY
  • Review and assessment of the outlined characteristics and phases is essential.
6.0 TUTOR-MARKED ASSIGNMENT
7.0 REFERENCES/FURTHER READING
  • Fundamentals of Structured Programming, Lubia Vinhas, 2016
  • Structured Programming with C++ by Kjell Backman, 2012

MODULE 2: ABSTRACTION AND MODULARITY

UNIT 3: OVERVIEW OF ABSTRACTION

CONTENTS

1.0 Introduction
2.0 Intended Learning Outcomes
3.0 Main Content

  • 3.1 Abstraction
  • 3.2 Functions and Procedures
  • 3.3 Classes
  • 3.4 Abstraction Costs and Benefits
    4.0 Conclusion
    5.0 Summary
    6.0 Tutor-Marked Assignment
    7.0 References/Further Reading
1.0 INTRODUCTION
  • Abstraction in programming provides simplification and efficiency in code development.
  • It allows human comprehension at the functional level.
2.0 INTENDED LEARNING OUTCOMES

By the end of this unit, you should be able to:

  • Describe the concept of abstraction;
  • Discuss the costs and benefits of abstraction.
3.0 MAIN CONTENT
3.1 ABSTRACTION
  • Allows separation of concerns and simplification in programming.
  • Historical view of programming languages shows increasing use of abstraction.
  • Higher level languages reduce code complexity and aid maintainability.
3.2 FUNCTIONS AND PROCEDURES
  • Grouping code into functions allows for clarity and reusability.
  • Well-defined functions can take parameters and return results, essential for modular programming.
  • Example function structure in C programming language: int sort(int[] array) { // function body }
3.3 CLASSES
  • Abstraction through classes in Object-Oriented Programming encapsulates data and functions.
  • C++ language allows complex data types, enhancing code clarity.
3.4 ABSTRACTION COSTS AND BENEFITS
  • Higher levels of abstraction may incur performance penalties.
  • Effective abstraction improves maintainability and reduces complexity.
  • Careful consideration is important to balance performance with abstraction.
4.0 CONCLUSION
  • Abstraction is critical in program design, enhancing clarity and usability.
5.0 SUMMARY
  • Overview and understanding of abstraction's relevance in programming are essential for efficient practices.
6.0 TUTOR-MARKED ASSIGNMENT
7.0 REFERENCES/FURTHER READING
  • Fundamentals of Structured Programming, Lubia Vinhas, 2016
  • Structured Programming with C++ by Kjell Backman, 2012

MODULE 6: OPERATORS AND CONTROL STATEMENTS

UNIT 1: OPERATORS

CONTENTS

1.0 Introduction
2.0 Intended Learning Outcomes (ILOs)
3.0 Main Content

  • 3.1 Arithmetic Operators
  • 3.2 Relational Operators
  • 3.3 Logical Operators
  • 3.4 Bitwise Operators
  • 3.5 Assignment Operators
  • 3.6 Increment and Decrement Operators
  • 3.7 Conditional Operators
  • 3.8 Misc Operators
  • 3.9 Operators Precedence in C
    4.0 Conclusion
    5.0 Summary
    6.0 Tutor-Marked Assignment
    7.0 References/Further Reading
1.0 INTRODUCTION
  • Operators are essential to perform mathematical and logical processes.
  • C language includes various operators to facilitate computations.
2.0 INTENDED LEARNING OUTCOMES (ILOs)

By the end of this unit, you should be able to:

  • Define operators and their types in C;
  • Demonstrate use of operators in expressions.
3.0 MAIN CONTENT
3.1 ARITHMETIC OPERATORS
  • Used for calculations such as addition, subtraction, multiplication, division, and modulus.
3.2 RELATIONAL OPERATORS
  • Compare values and return boolean results (true/false).
3.3 LOGICAL OPERATORS
  • Perform logical operations and evaluate the conjunctions of boolean values.
3.4 BITWISE OPERATORS
  • Operate on bits and allow fine control over individual bit manipulations for int and char types.
3.5 ASSIGNMENT OPERATORS
  • Used to assign values to variables; combine operations with an assignment.
3.6 INCREMENT AND DECREMENT OPERATORS
  • Modify variable values through incrementing or decrementing by 1.
3.7 CONDITIONAL OPERATORS
  • Used for inline conditional evaluations, following the syntax: condition ? expr1 : expr2;
3.8 MISC OPERATORS
  • Additional operators included in C programming, providing further functionality.
3.9 OPERATORS PRECEDENCE IN C
  • Determines the order in which operations are executed in expressions.
4.0 CONCLUSION
  • Understanding operators is essential for effective programming in C.
5.0 SUMMARY
  • Operators facilitate operations in code, affecting control logic and data manipulation.

### 6.0 TUTOR-MARKED ASSIGNMENT

Note

For more study material follow the course guide diligently and utilize the references cited in the modules.