- Programming 1
- Summary
Course Syllabus
Obiettivi
Alla fine del corso lo studente dovrà essere in grado di:
(DdD 1) descrivere il ciclo di compilazione/esecuzione e la sintassi–semantica di base del linguaggio C;
(DdD 2) progettare e implementare programmi imperativi di piccole-medie dimensioni che manipolano dati in memoria e su file;
(DdD 3) valutare soluzioni alternative sotto il profilo della gestione della memoria e validazione dell'input;
(DdD 4) documentare il codice e spiegare in modo chiaro le scelte progettuali;
(DdD 5) consultare autonomamente la documentazione tecnica ed estendere le competenze acquisite a nuovi linguaggi o strumenti.
Contenuti sintetici
Paradigma imperativo con il linguaggio C: struttura del programma, controllo di flusso, funzioni e ricorsione, array, stringhe, puntatori, strutture, I/O formattato e su file.
Programma esteso
Modulo | Argomenti principali
- Fondamenti | Hardware & software, tool-chain gcc/clang, gdb
- Primi passi | main, #include, printf/scanf, operatori
- Controllo di flusso | if, switch, while, for, do…while, logici
- Funzioni | Prototipi, scope, classi di memoria, ricorsione, math
- Array & stringhe | Ordinamento, ricerca, libreria stringhe
- Puntatori | Aritmetica, array-pointer, const, puntatori a funzioni, malloc/free
- Strutture & enum | struct, union, typedef
- I/O avanzato & file | Stream, formattazione, file sequenziali e random-access
L’ordine potrà subire lievi variazioni didattiche.
Prerequisiti
Logica elementare, aritmetica di base e uso essenziale del computer.
Modalità didattica
L’insegnamento è composto da:
lezioni frontali, prevalentemente in modalità erogativa;
esercitazioni, in modalità erogativa e interattiva;
sessioni di lavoro assistito in laboratorio, prevalentemente in modalità interattiva.
Inoltre, verranno resi disponibili on-line sia le slide e gli esercizi svolti in classe che vari tipi di esercizi mirati (quiz, domande pratiche) da svolgere individualmente da parte degli studenti.
Lingua di erogazione: italiano.
Materiale didattico
P. Deitel, H. Deitel – Il linguaggio C. Fondamenti e tecniche di programmazione (9ᵃ ed., Pearson, 2023).
Slide, esempi di codice e fogli di esercizi forniti dal docente.
Periodo di erogazione dell'insegnamento
Primo semestre
Modalità di verifica del profitto e valutazione
La verifica dell'apprendimento comprende una prova scritta e un colloquio orale facoltativo.
Nella prova scritta si richiede di:
rispondere a domande a risposta multipla e aperte, che hanno lo scopo di verificare la preparazione dello studente sulle varie parti del programma;
svolgere al computer alcuni esercizi di programmazione in linguaggio Java, con lo scopo di verificare se lo studente è in grado di applicare le tecniche di programmazione viste durante le lezioni e le esercitazioni, e di implementare tali tecniche nel linguaggio di programmazione Java.
Ciascuna delle due parti sarà valutata in trentesimi e il voto della prova scritta sarà la media dei voti delle due parti. Entrambe le prove devono essere superate con un voto ≥ 18/30.
La prova scritta potrà essere sostituita da due prove parziali erogate in itinere, organizzate e valutate allo stesso modo della prova scritta ma più semplici e riguardanti ciascuna solo una parte del programma. Entrambe le prove devono essere superate con un voto ≥ 18/30.
Al colloquio orale, oltre alla discussione dello scritto, possono essere fatte domande su tutti gli argomenti del corso.
Orario di ricevimento
Su appuntamento via e-mail al docente.
Sustainable Development Goals
Aims
By the end of the course the student will be able to:
(DdD 1) describe computer architecture, the compile–link–run cycle and the basic syntax and semantics of the C language;
(DdD 2) design and implement small/medium-sized imperative programs manipulating data in memory and on files;
(DdD 3) evaluate alternative solutions in terms of memory handling and input validation;
(DdD 4) document source code and clearly present design choices;
(DdD 5) autonomously consult technical documentation and transfer the acquired skills to new languages or tools.
Contents
Imperative programming with C: program structure, control flow, functions and recursion, arrays, strings, pointers, structures, formatted and file I/O.
Detailed program
Module | Main topics
- Foundations | Hardware & software, tool-chain gcc/clang, gdb
- First steps | main, #include, printf/scanf, operators
- Control flow | if, switch, while, for, do…while, logical operators
- Functions | Prototypes, scope, memory classes, recursion, math
- Arrays & strings | Sorting, search, string library
- Pointers | Arithmetic, array-pointer, const, function pointers, malloc/free
- Structures & enum | struct, union, typedef
- Advanced I/O & files | Streams, formatting, sequential and random-access files
The sequence may change slightly for teaching purposes.
Prerequisites
Elementary logic, basic arithmetic and basic computer skills.
Teaching form
The teaching consists of:
lectures, mainly in delivery mode;
exercises, in delivery and interactive mode;
assisted work sessions in the laboratory, mainly in interactive mode.
In addition, both the slides and exercises done in class and various types of targeted exercises (quizzes, practical questions) to be done individually by students will be made available online.
Language: Italian.
Textbook and teaching resource
P. Deitel, H. Deitel – Il linguaggio C. Fondamenti e tecniche di programmazione (9ᵃ ed., Pearson, 2023).
Slides, code examples and exercise sheets provided by the teacher.
Semester
First semester
Assessment method
The learning assessment includes a written test and an optional oral interview.
In the written test, the student is required to:
answer multiple choice and open questions, which aim to verify the student's preparation on the various parts of the program;
carry out some programming exercises in Java language on the computer, with the aim of verifying whether the student is able to apply the programming techniques seen during the lessons and exercises, and to implement these techniques in the Java programming language.
Each of the two parts will be evaluated in thirtieths and the grade of the written test will be the average of the grades of the two parts. Both tests must be passed with a grade ≥ 18/30.
The written test may be replaced by two partial tests administered in itinere, organized and evaluated in the same way as the written test but simpler and each concerning only one part of the program. Both tests must be passed with a grade ≥ 18/30.
During the oral exam, in addition to the discussion of the written exam, questions can be asked on all the topics of the course.
Office hours
By appointment arranged by e-mail.