← Back
ExamFirst midtermExam paper only

28 11 14

Study material for Fondamenti di Informatica, shared by the Studwiz community and reviewed by moderators.

Fondamenti di InformaticaFirst midterm

Document information

What's included in this study material

Study material for Fondamenti di Informatica, shared by the Studwiz community and reviewed by moderators.

Import quality: text was extracted directly from the original document.

Extracted content from the 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.

Page 1

Politecnico di Milano - Dipartimento di Elettronica, informazione e Bioingegneria Prof. Mauro Negri Fondamenti di Informatica I prova in itinere | 28 novembre 2014 Matricola ____________ Cognome _______________________ Nome _________________________ Durata prova: 2 ore Istruzioni LE RISPOSTE DEVONO ESSERE SCRITTE SU QUESTO PLICO (anche sul retro dei fogli) Non separare questi fogli. Si può utilizzare la matita. L’uso di cellulari, libri, eserciziari, appunti o calcolatrici durante lo svolgimento della prova comporta l’annullamento della prova. Non è possibile uscire dall’aula durante la prova tranne in casi eccezionali. Esercizio 1 (5 punti) ______________________________ Esercizio 2 (5 punti) ______________________________ Esercizio 3 (5 punti) ______________________________ Esercizio 4 (3 punti) ______________________________ Esercizio 5 (4 punti) ______________________________ Esercizio 6 (8 punti) ______________________________ Punteggio totale ______________________________ pp. 2 / 5 Esercizio 1. Eseguire il seguente programma C e mostrare il risultato nel formato previsto dal codice. #include <stdio.h> typedef struct { int f; int *fp; int s[4];} elemento; elemento d,u, *p; int i; int *q; int main() {p=&u; p->f=4; (p->s)[0]=11; (p->s)[1]=12; (p->s)[2]=13;(p->s)[3]=14; (*p).fp=&(p->s[3]); q= u.fp; printf("\nf:%i s0:%d s1:%d s2:%d s3:%d",p->f,u.s[0],u.s[1],u.s[2],u.s[3]); q=q-3; *q=10; q++; *q=6; q++; *q=8; u.f=7; *(u.fp)=*q+10; printf("\nf:%i s0:%d s1:%d s2:%d s3:%d",p->f,u.s[0],u.s[1],u.s[2],u.s[3]); d.f= *q; p=&d; q=u.s; q=q+3; for(i=0;i<4;i++) (*p).s[i]= *(q-i); printf("\nf:%i s0:%d s1:%d s2:%d s3:%d",p->f,u.s[0],u.s[1],u.s[2],u.s[3]); printf("\nf:%i s0:%d s1:%d s2:%d s3:%d",d.f, d.s[0],d.s[1],d.s[2],d.s[3]); } //results f:4 s0:11 s1:12 s2:13 s3:14 f:7 s0:10…

Preview

First page of the document.

First page: 28 11 14