Document information
- University
- Politecnico di Milano
- Degree programme
- Mathematical Engineering
- Subject
- Informatica A
- Classification
- Exam · First midterm
- Content
- Exam paper only
- Original format
- Text
- Searchable text
First midterm exam for Informatica A in the Mathematical Engineering degree programme at Politecnico di Milano. The document covers: 1 Informatica A Cognome ________________________________ Matricola _______________________ Nome ________________________________ Firma _______________________ Valore indicativo degli esercizi, voti parziali e voto finale: 1 ( 2 p. ) __________ 2 ( 4 p. ) __________ 3 ( 4 p. )
First midterm exam for Informatica A in the Mathematical Engineering degree programme at Politecnico di Milano. The document covers: 1 Informatica A Cognome ________________________________ Matricola _______________________ Nome ________________________________ Firma _______________________ Valore indicativo degli esercizi, voti parziali e voto finale: 1 ( 2 p. ) __________ 2 ( 4 p. ) __________ 3 ( 4 p. )
Import quality: text was extracted directly from the original document.
Representative passages recognised in different parts of the material. The full extracted text remains available to search, while this compact preview makes the page easier to read.
1 Informatica A Cognome ________________________________ Matricola _______________________ Nome ________________________________ Firma _______________________ Valore indicativo degli esercizi, voti parziali e voto finale: 1 ( 2 p. ) __________ 2 ( 4 p. ) __________ 3 ( 4 p. ) __________ 4 ( 4 p. ) __________ ( 14 p. ) _________ 2 1 (2 p.) Build the truth table of the following Boolean expression. not ( (not A) or ( B and C ) ) or ( A and (C or B) ) Represent in two's complement the binary numbers equivalent to A = 77dec and B = –123dec, then compute the sum (A+B) and the difference (A–B) in two's complement. 3 Esercizio 2 (4 punti) SCRIVI the printed output of the following code. #include<stdio.h> #define N 8 void t(int n, int p, int*i, int*f) { if( i>=f ) printf(" NOT FOUND \n"); else if( n == *i ) printf(" : odd[%d] \n",p); else t( n, p+1, i+1, f ); } void d( int n, int *v ) { if( n%2 ) t( n, 0, v, v+N ); else { printf(" -> %d", n/2); d(n/2, v); } } int main(){ int odd[4*N]={1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47}, x[N]={7,18,24,17,88}, i=0; while( x[i] > 0 ) { printf("[%d]", x[i]); d( x[i++], odd ); } return 0; } 4 Esercizio 3 (4 punti) Consider the fo llowing type declarations describing the data structure needed for the management of a dentist’s schedule. typedef struct { int day, month, year; } date; typedef struct { int hour, minute; } time; typedef struct { char SSN[100], surname[100], name[100]; data BirthDate; } person; typedef struct { person patient[1000]; int patientNumber; //number of array cells containing valid data } patientList; typedef struct { char PatientSSN [100]; date d; time t; } visit typedef struct { visit visits[1000]; int visitsNumber; //number of array cells containing valid data } VisitList; Write a C function…
First page of the document.