# FUNDAMENTALS OF PROGRAMMING A

## Learning outcomes of the course unit

The main aim of the course is to provide students with the fundamental techniques of imperative programming through the use of the imperative subset of the C ++ programming language. The course also aims at providing students with the ability to apply analytical techniques to solve simple practical problems (such as, for instance, problems of calculus and sorting) and to translate these solutions into executable programs. Finally, the course develops analytical and abstraction skills and it aims at improving the ability related to the decomposition of problems into sub-problems.

Taking Dublin Indicators into account:

Knowledge and understanding

During the course, the main ideas related to imperative programming are introduced. Particular emphasis is dedicated to the comprehension of algorithmic techniques on which imperative languages rely. Most of the suggested literature is in italian, even though proper english words are used during classes, in order to help students in reading also international scientific papers and books. During the course, students are encouraged to learn fundamentals of programming, using C++ as programming language. Students also acquire adequate knowledge of computers architecture and information representation. Moreover, students are able to comprehend applications of mathematics to computer science.

Applying knowledge and understanding

Acquired theoretical knowledge is applied to solve specific problems, which are typically related to mathematics. During the course, some exercise sessions are dedicated to the solutions of problems, using the C++ language. Many solving methods are applied to mathematical and numerical problems and they are presented from an algorithmic point of view. Students are able to use computational instruments as a support to mathematical processes and as a way to acquire new information.

Making judgments

Exercises proposed during classes can be solved individually or in groups and they often can be solved in different ways. Students can compare their approach to the solutions proposed by other students and to the solutions shown during classes. Such comparisons enhance the development of specific skills which are useful to better understand the considered problems.

Communication skills

Discussions during classes and exercise sessions allow students to improve their communications skills. Such discussions concern specific algorithmic techniques to solve the proposed problems and they focus on advantages and disadvantages of the proposed approaches. Students learn to work individually and in groups.

Learning skills

The study of algorithmic techniques and their application to heterogeneous problems help students to improve in-depth comprehension of the topics. Acquired knowledge can be adapted to solve problems which may be different from those specifically seen during classes. Students acquire computational techniques useful to work in groups and autonomously.

## Prerequisites

Basic notions on functions, set theory, and logics.

## Course contents summary

Computer architecture and information representation are introduced in the first part of the course. Then, the fundamental of imperative programming are presented, using C++ as reference programming language. In particular, the concepts of variable, data type, algorithm, and expression are examined and functions and recursive functions are introduced.

## Course contents

1) Information Representation

- Definition of alphabet, string, language and examples

- Definition of information

- Binary encoding and properties

- Representation of texts

- Representation of sounds

- Representation of images

- Representation of videos

- Redundant encoding

- Huffman encoding and applications

- Representation of integer and rational numbers and base conversion

- Representation of numbers in computers

2) Computers Architecture

- Problems and solutions

- Definition of process, program, algorithm

- Machine hierarchy (hints)

- Computer architecture (CPU, memories)

3) Programming

- Variables and data types

- Assignment and expressions

- Functions and recursive functions

- Selection statements

- Iterative statements

- Flux diagram and pseudocode

- Arrays

- Structs

- File manipulation

- Computational cost of algorithms (hints)

- Pointers (hints)

## Recommended readings

- D. Mandrioli, S. Ceri, L. Sbattella, P. Cremonesi, G. Cugola. Informatica arte e mestiere, McGraw-Hill, 2014.

Additional material:

- Exercises on elly.smfi.unipr.it

- L.J. Aguilar. Fondamenti di programmazione in C++ , McGraw-Hill, 2008.

- R. Miller, D. Clark, B. White, e W. Knottenbel: An Introduction to the

Imperative Part of C++, 1999, disponibile su WEB all'indirizzo http:

//www.doc.ic.ac.uk/~wjk/C++Intro/CourseStructure.html#S

- Notes at http://people.math.

unipr.it/gianfranco.rossi/Teaching/FondProgr/index.html

## Teaching methods

The majority of the course consists in frontal lessons. Some exercise sessions will be scheduled.

The slides used to support lessons and the source code of programs shown during classes will be uploaded at the end of the lessons on the Elly platform. To download the material, students need to enroll in the online course. Slides and programs in C++ are considered an integral part of teaching material.

## Assessment methods and criteria

The final exam consists in a written test (duration: 3h) and a programming test (duration: 3h). The written test includes questions and exercises concerning all the topics addressed during the course. Results of the written test will be uploaded on esse3 as soon as possible and they will be communicated to students before the programming test. Students are admitted to the programming test only if they passed the written one. The final grade is obtained as the average of the evaluations of both tests. In order to pass the exam, it is necessary that both the written and the programming tests are sufficient (evaluation equal to 18 or greater).