20810536-2 - INTRODUCTION TO COMPUTER SCIENCE - module 2

Objectives

Provide the basic elements of Computer Science, giving concepts, methods and tools to address the technological evolution and the large variety of applications.
Particular objectives are:
- introduce IT as a discipline for automatic problem solving;
- examine the basic concepts of computer programming using methods and tools, partly formal and partly pragmatic, and taking into account the qualitative aspects of efficiency and correctness;
- present the main data structures and algorithms.

At the end, students will be able to face a programming problem in all its parts, namely by:
- understanding, analyzing and formalizing the problem;
- designing a solution algorithm;
- implementing the algorithm in the Julia scientific language;
- carrying out correctness tests;
- critically judging the project in terms of code readability and efficiency, reusability, and maintainability.

Programme

* Basic concepts *

Problems, algorithms, and programs
Computer architecture
Languages and Compilation
Style and conventions
I / O, variables and constants

* Operations *

Information representation
Binary arithmetic
Types of data
Expressions
Boolean algebra

* Control structures *

Selection
Iteration
Functions

* Data structures *

Array
Strings
Matrices
Sets
Lists
Tuples
Datasets


* Advanced concepts *

Integrated development environments
Errors
Libraries
File
*Data analytics*

Data analytics techniques
Basic machine learning techniques

Prerequisiti

The course does not require any prerequisite.

Core Documentation

A. Bellini, A. Guidi, "Linguaggio C. Una guida alla programmazione con elementi di Python", VI Edizione, McGraw-Hill.

Reference Bibliography

W. McKinney, “Python for Data Analysis”, Open Edition, https://wesmckinney.com/book/ A. Géron, “Hands-on Machine Learning with Scikit-Learn, Keras, and TensorFlow”, free early release available on line.

Attendance

Attendance is not compulsory, but it is strongly recommended.

Type of evaluation

The exam consists of a written test including programming exercises, exercises on Boolean algebra, binary arithmetic and data analytics, multiple choice questions, theoretical questions regarding the course program to be carried out in the laboratory.

Esempi Domande

The following program contains a function main (), which must not be changed. Extend it by creating a function, called estraiIntero, which:

• has as a unique formal parameter consisting of an array of characters, named stringa, and
• has return type int.

Implement the function so that the input string, which is supposed to only contain numerical symbols, be converted into the corresponding integer.
In the event that the string received as a parameter should be empty, the function will have to return the integer 0.
In the event that the string received as a parameter should contain a number larger than the largest positive 32-bit integer, the circularity of the representation of the integers must be exploited.

For example, if the string received as a parameter is "1234", the function will have to return the integer 1234. If the string received as a parameter is "00547", the function will have to return the integer 547. If the string received as a parameter is "", the function will have to return the integer 0. If the string received as a parameter is "2147483648", the function will have to return the integer -2147483648

Note: the ASCII code for the character '0' is 48; The ASCII code for the character '1' is 49; The ASCII code for the character '2' is 50, and so on.
Note: you can use the POW function, defined in math.h. Example of use: POW (3, 4) is equivalent to three raised to the fourth and returns 81.
Note: It is not allowed to use the atoi function defined in stdblib.h, or any other function belonging to other libraries that implements the required behavior.
Note: in a comment that precedes the function estraiIntero provide its specification (expressed as input, pre-conditions, output, post-conditons) and the type of the problem it solves.