Informazioni sul documento
- Università
- Politecnico di Milano
- Corso di laurea
- Mathematical Engineering
- Materia
- Informatica A
- Classificazione
- Esame · Primo parziale
- Contenuto
- Testo d’esame
- Formato originale
- Testo
- Testo ricercabile
Primo parziale di Informatica A per il corso di Mathematical Engineering presso Politecnico di Milano. Materiale proveniente dall’archivio storico Studwiz e classificato per la consultazione online.
Primo parziale di Informatica A per il corso di Mathematical Engineering presso Politecnico di Milano. Materiale proveniente dall’archivio storico Studwiz e classificato per la consultazione online.
Qualità dell’importazione: il testo è stato estratto direttamente dal documento originale.
Passaggi rappresentativi riconosciuti nelle diverse parti del materiale. Il testo completo resta presente nella pagina per la ricerca, mentre l’anteprima compatta rende più semplice la lettura.
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…
Prima pagina del documento.