Programming I and Laboratory O - Z
Module Programming I

Academic Year 2022/2023 - Teacher: FABRIZIO MESSINA

Expected Learning Outcomes

Knowledge and understanding: the primary objective of the course is the acquisition by students of the "philosophy" of structured programming, and the detailed knowledge of the syntax and semantics of the C programming language. The course pays particular attention to the development of well-written and well-structured code using the basic techniques for software development. 


Applying knowledge and understanding: we intend to provide the tools to achieve the following practical and professional skills:

  • Translating algorithmic ideas into code;

  • Designing, describing and implementing C programs;

  • Knowing how to use tools for debugging C programs;

  • Understanding and analysing third-party C code also in terms of efficiency;

  • Correctly referencing the documentation.

Making judgments: through the examination of numerous code examples and a substantial practical component that involves carrying out computer exercises, the learner will be able to analyse problems and design and implement related software solutions.

Communication skills: the student will acquire the necessary communication skills in the use of verbal / technical language in computer programming.

Learning skills: the course aims to provide the learner with the necessary theoretical and practical methodologies to be used in professional contexts and, in particular, the ability to formulate ad-hoc algorithms for solving new problems and the possibility of easily and quickly acquiring another programming language.

EXAM DATES

All exam dates are published on the website www.dmi.unict.it

IN ITINERE TESTS

There will be in itinere tests. Passing all the ongoing tests is equivalent to passing the theoretical test (1).

END OF COURSE TESTS

1. Theoretical test. This is a multiple choice test designed to verify the understanding of the basic elements of programming and the main characteristics of the C language. The test is not assigned a mark out of thirty (the test will receive an "admitted" or "not admitted" result).

2. Practical laboratory test. It is a series of exercises or a small project to be carried out in the classroom on the computer. The proof is deemed insufficient if the product code has compilation errors or if it does not produce an output compatible with the assignments of the task. A grade out of thirty will be assigned to the test.

3. Oral exam: a discussion on the test carried out on the computer, questions on the theoretical topics included in the program. The test allows to increase or decrease the grade obtained in test 2) (usually by a maximum of 3 points). If test 3) highlights the lack of basic competences, the student will have to repeat the three tests.

Learning assessment may also be carried out on line, should the conditions require it.

Course Structure


Lectures and presentation of schemes and algorithms.


Required Prerequisites

Attendance and passing of the final test of the computer science “corsi zero”.

Attendance of Lessons

Attending the lectures is not mandatory but strongly recommended.

Detailed Course Content

Introduction to programming

  • Problems; Algorithms; Flowcharts.

  • Types of information and their digital representation: booleans, integers, floats, strings, multimedia data. IEEE standard.

  • Outline of von Neumann's computational model: memory + processing unit.

  • Variables; Expressions; Assignments.

  • Programming languages: machine, assembly and high level.

  • Translation problem: compilation and interpretation.

  • Structured linear notation. Böhm-Jacopini theorem.

 The C language

  • Installation of the compiler;

  • First program: Editing, Compiling, Running, Debugging.

  • Constructs of the language.

  • Types of data; Predefined operators; Type conversions.

  • Basic I / O management: stdin, stdout, stderr.

  • Execution of commands as expression evaluation.

  • Flow control:

  • if-then-else;

  • switch;

  • while;

  • do-while;

  • for;

  • break, continue;

  • First examples of functions on atomic data, productive and non-productive functions,

  • Scope of variables.

  • Explicit memory management: motivations, techniques and basic functions.

  • Pointers: motivations and management. Address and dereferencing operators.

  • Arithmetic of pointers. Pointers and Arrays. Pointers as a function parameter. Dynamic memory allocation. The const modifier.

  • Arrays in C: introduction and exercises on creating, managing, accessing, modifying, and controlling the elements of an array. Multidimensional arrays.

  • Strings in C: introduction and exercises on creating, managing, accessing, modifying, and controlling the elements of a string.

  • Generation of pseudo-random numbers in C.

  • Functions on non-atomic data and how to pass parameters to a function. Inline functions. Function call management via activation stack. Composition of functions. 

  • Recursion: Via examples; Activation record; Recursion stack.

  • I Records (struct), unions, and enum.

  • Arguments to the main function.

 Files.

  • Functions on files: fopen, fclose, fseek, ftell, fread, fwrite

 First data structures

  • Implementation of a set through sorted array and unordered array.

  • Stacks and queues. Formal description and implementations.

  • Linked lists: simple, double. Formal description and implementations.

Sorting and search algorithms

(formal definition and examples of implementation with arrays and lists)

  • Selection Sort, Insertion sort and Bubble Sort

  • Sequential search and dichotomous search

Textbook Information

Il linguaggio C Fondamenti e tecniche di programmazione • 9/Ed. Paul J. Deitel - Harvey M. Deitel. ISBN: 9788891906236

Course Planning

 SubjectsText References
1Introduction to programming material provided by the teacher, textbook
2The C languagematerial provided by the teacher, textbook
3Constructs of the C language material provided by the teacher, textbook
4File management in Cmaterial provided by the teacher, textbook
5Basic and common data structurematerial provided by the teacher, textbook
6Sorting and search algorithmsmaterial provided by the teacher, textbook

Learning Assessment

Learning Assessment Procedures

Sample questions for the oral exam:

  • Memory management in C (types of memory and constructs to access them). Types of allocation

  • Types of data: what they are used for, differences between types, memory occupied. Type conversions

  • Variables and their visibility. Constants. #define directive.

  • Input / output management in C.

  • File management in C.

  • Structured programming, main control structures and their uses.

  • Utility and definition of arrays. Considerations on the representation of arrays in memory. Array indexing. Relation to pointers.

  • Usefulness and definition of pointers. Syntax and main advantages over non-pointer variables. Uses of pointers for passing parameters to function by reference.

  • Strings: definition and their usefulness. Main operations on strings.

Examples of frequently asked questions and / or exercises

Sample questions for the oral exam:

  • Memory management in C (types of memory and constructs to access them). Types of allocation

  • Types of data: what they are used for, differences between types, memory occupied. Type conversions

  • Variables and their visibility. Constants. #define directive.

  • Input / output management in C.

  • File management in C.

  • Structured programming, main control structures and their uses.

  • Utility and definition of arrays. Considerations on the representation of arrays in memory. Array indexing. Relation to pointers.

  • Usefulness and definition of pointers. Syntax and main advantages over non-pointer variables. Uses of pointers for passing parameters to function by reference.

  • Strings: definition and their usefulness. Main operations on strings.