CORRECTION EXAMEN DE FIN DE FORMATION TDI THEORIQUE SESSION JUILLET 2012
EFF TDI Théorique 2012 corrigé
Télécharger correction EFF théorique TDI 2012 - ici -
Dossie1 : (6 points)
1)
2)
3)
4)
Dossie2 : (5 points)
1- SELECT COUNT(*) AS 'nombre de matchs' FROM Match
WHERE numJournee=12GROUP BY numJournee
WHERE nombreSpectateur = (SELECT MAX(nombreSpectateur) FROM Match)
(SELECT resultat=COUNT(numMatch)*3 FROM Match
WHERE (nombreButLocaux > nombreButVisiteurs and codeEquipeLocaux=112)
OR (nombreButLocaux < nombreButVisiteurs and codeEquipeVisiteurs=112)
UNION
SELECT Count(numMatch) FROM Match
WHERE (nombreButLocaux = nombreButVisiteurs)
and (codeEquipeLocaux=112 OR codeEquipeVisiteurs=112)) MyTable
AS
BEGIN
SELECT codeEquipeLocaux AS 'Code Equipe' FROM Match
WHERE nombreButLocaux > nombreButVisiteurs AND numJournee = @nbrjour
UNION
SELECT codeEquipeVisiteurs AS 'Code Equipe' FROM Match
WHERE nombreButLocaux < nombreButVisiteurs AND numJournee = @nbrjour
END
EXEC Q5 1;
6- CREATE TRIGGER question6 ON Match2 AFTER INSERT
ASDECLARE @loc int , @vis int
SELECT @loc= codeEquipeLocaux, @vis= codeEquipeVisiteurs FROM Inserted
IF (@loc=@vis)
BEGIN
RAISERROR ('ATTENTION: codeEquipeLocaux == codeEquipeVisiteurs :p',
16, 1);
Rollback
END
Dossie3 : (5 points)
1 & 2 ) java:
public class Camera {
protected int code;protected String type;
protected int orientation;
public Camera() {
super();
}
public Camera(int code, String type) {
super();
this.code = code;
this.type = type;
}
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public int getOrientation() {return orientation;
}
public void setOrientation(int orientation) {
this.orientation = orientation;
}
public void tourner(int sens) {
this.orientation = sens;
}
public void afficher() {
System.out.println("-Code: " + this.code + " Orientation:"
+ this.orientation);
}
}
3, 4 & 5) java:
public class CameraMobile extends Camera {
private int abs;private int ord;
public CameraMobile(String type, int code, int abs, int ord) {
super(code, type);
this.abs = abs;
this.ord = ord;
}
public CameraMobile() {
super();
}
10
public int getAbs() {return abs;
}
public void setAbs(int abs) {
this.abs = abs;
}
public int getOrd() {
return ord;
}
public void setOrd(int ord) {
this.ord = ord;
}
public void avancer(int d) {
switch (this.orientation) {
case 1:
this.ord += d;break;
case 2:
this.abs += d;break;
case 3:
this.ord -= d;break;
case 4:
this.abs -= d;break;
}
}
public void afficherPosition() {
System.out.println("-position: abs=" + this.abs + " ord=" + this.ord);
}
public void afficher() {
super.afficher();this.afficherPosition();
}
}
6) java:
public class classTest {
public static void main(String[] args) {// TODO Auto-generated method stub
CameraMobile cm1 = new CameraMobile("SUMSUNG", 213, 0, 0);
cm1.afficher();
// a
cm1.setOrientation(2);
cm1.afficher();
// b
cm1.setOrientation(4);
cm1.avancer(10);
cm1.afficher();
// c
cm1.setOrientation(1);
cm1.avancer(16);
cm1.afficher();
// d
cm1.setOrientation(2);
cm1.avancer(5);
cm1.afficher();
// e
cm1.setOrientation(3);
cm1.avancer(12);
cm1.afficher();
}
}
C# 1 et 2)
using System;
using System.Collections.Generic;using System.Linq;
using System.Text;
public class Camera
{
private int code;
private string type;
private int orientation;
public Camera() { }
public Camera(int code, String type)
{
this.code = code;
this.type = type;
}
public int Code
{
get { return code; }
set { code = value; }
}
public string Type
{
get { return type; }
set { type = value; }
}
public int Orientation
{
get { return orientation; }
set { orientation = value; }
}
public void tourner(int sens)
{this.orientation = sens;
}
public void afficher(){
Console.WriteLine("-Code: " + this.code + " Orientation:" +
this.orientation);
}
}
3, 4 et 5)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class CameraMobile:Camera {
private int abs;
private int ord;
public CameraMobile(string type, int code, int abs, int ord)
: base(code, type)
{
this.abs = abs;
this.ord = ord;
}
public CameraMobile()
{}
public int Ord
{
get { return ord; }
set { ord = value; }
}
public int Abs{
get { return abs; }
set { abs = value; }
}
public void avancer(int d)
{
switch (d)
{
case 1:
this.ord += d; break;
case 2:
this.abs += d; break;
case 3:
this.ord -= d; break;
case 4:
this.abs -= d; break;
}
}
public void afficherPosition()
{
Console.WriteLine ("-position: abs=" + this.abs + " ord=" + this.ord);
}
public void afficher()
{
base.afficher();
this.afficherPosition();
}
}
6)
1- class Program
2- {
3- static void Main(string[] args)
4- {5- CameraMobile cm = new CameraMobile("SONY", 113, 1, 4);
6- cm.afficher();
7- // a
8- cm.Orientation = 2;
9- cm.afficher();
10- // b
11- cm.Orientation = 4;
12- cm.avancer(10);
13- cm.afficher();
14- // c
15- cm.Orientation=1;
16- cm.avancer(16);
17- cm.afficher();
18- // d
19- cm.Orientation = 2;
20- cm.avancer(5);
21- cm.afficher();
22- // e
23- cm.Orientation = 3;
24- cm.avancer(12);
25- cm.afficher();
}
}
Dossie4 : (4 points)
Exercice 1 : (2 pts)
<html>
<head></head>
<body>
<!-- Q1 -->
<h1>Pour s'inscrire, remplir le formulaire suivant:</h1>
<form name="frm">
<table border="0" cellpadding="0" cellspacing="4">
<tr>
<td align="right">Nom:</td>
<td><input name="nom" type="text" size="50"></td>
</tr>
<tr>
<td align="right">Prénom:</td>
<td><input name="prenom" type="text" size="50"></td>
</tr><tr>
<td align="right">Date de naissance:</td>
<td><input name="day" type="text" value="jj" size="5" maxlength="2">
<input name="month" type="text" value="mm" size="5" maxlength="2">
<input name="year" type="text" value="aaaa" size="25" maxlength="4"></td>
</tr>
<tr>
<td align="right">Mot de passe:</td>
<td><input name="pass" type="password" size="50"></td>
</tr>
<tr>
<td align="right">Confirmer mot de passe:</td>
<td><input name="passC" type="password" size="50"></td>
</tr>
<tr align="center">
<td colspan="2"><input type="checkbox" id="condition" onClick="checkBox();"/><label
for="condition" >J'accepte les conditions</label>
</td>
</tr>
<tr align="right">
<td colspan="2" >
<input type="submit" value=" Valider " onClick="return validateForm();" id="valider"
disabled />
<input type="reset" value=" Annuler" />
</td>
</tr>
</table>
</form>
<!-- Q2 -->
<script language="javascript"
type="text/javascript">
function validateForm()
{
//a
if(""==document.forms.frm.nom.value) return false;
if(""==document.forms.frm.prenom.value) return false;
if(""==document.forms.frm.day.value) return false;
if(""==document.forms.frm.month.value) return false;
if(""==document.forms.frm.year.value) return false;
if(""==document.forms.frm.pass.value) return false;
if(""==document.forms.frm.passC.value) return false;
//b
var year = document.forms.frm.year.value;
if(isNaN(year) || year < 1900) return false;
var month= document.forms.frm.month.value;
if(isNaN(month) || month <1 || month>12) return false;
var day = document.forms.frm.day.value;
if(isNaN(day) || day <1 || day>31) return false;
//c
var pass = document.forms.frm.pass.value;var passc = document.forms.frm.passC.value;
if(pass !== passc) return false;
return true;
}
//d
function checkBox()
{
document.getElementById('valider').disabled =
!document.getElementById('condition').checked;
}
//Q3
setTimeout(window.close,20000);
</script>
</body>
</html>
---------------------------------------------------
Aucun commentaire:
Enregistrer un commentaire