Page 597 - IT2
P. 597

PARTIE 2: PRATIQUE (80 PTS)


              DOSSIER 1 : LANGAGE DE PROGRAMMATION STRUCTURE (26 PTS)

              Exercice 1 (12 pts)
              Quel est le résultat d’affichage du programme suivant :

              #include             <stdio.h>
              int f1(int *y, int x)
              {
                 printf("debut f1 : x=%d, *y=%d\n", x,*y); //2 pts
                     int z=2;
                 x = z*2;
                 *y = x-4;
                 printf("fin f1 : x=%d, *y=%d\n", x,*y); //4 pts
                 return (*y+5);
              }


              void  main()
              {
                     int  x=-1, y=0;
                 printf("debut main : x=%d, y=%d\n", x,y);  //2 pts
                 y=f1(&x, y);
                 printf("fin main : x=%d, y=%d\n", x,y);  // 4 pts
              getchar();
              }


              Exercice 2 : (14 pts)

              Soit le programme suivant :
              #include      <stdio>
              void f1(char s[], char res[])
              {
                int j = 0;
                for ( int i = 0; s[i] != '\0'; )
                { int cmpt = '1';
                  char c = s[i];
                  for ( i=i+1; ((c == s[i]) && (cmpt != '9')); i=i+1, cmpt=cmpt+1 );

                  res[j] = c ; j=j+1;
                  res[j] = cmpt;  j=j+1;
                }
                res[j] = '\0';
              }
              void main()
              {
                     char res[100];
                     char s2[] = "aaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbcddde";
                    Filière                    Epreuve                       Session               4/7
                TDI (CDS de 1 à 2)           Synthèse V1                    Juillet 2014
                                           www.itlearning-settat.com

                                    Email: admission@itlearning-settat.com
                                                    Tél.:0661077812
   592   593   594   595   596   597   598   599   600   601   602