Previous Up Next

8  Vrai ou Faux ? (d’un point de vue informatique)

Exercice 1  Les commandes suivantes affichent la valeur exacte 2 : répondre vrai ou faux et pourquoi ?
  1. ▫ 1+1:; itemv3-1
  2. ▫ 1.5+1/2 itemv4/2 itemvsqrt(4)
  3. ▫ evalf(sqrt(4)) itemv1^(1+1)+1^(1+1)
  4. ▫ (1+1)^(1+1)
  5. ▫ 1*1^(1+1) itemv1+1*1^1 itemv(1+1)*1^(1+1)
Exercice 2  Les commandes suivantes affectent la valeur exacte 2 à la variable c : répondre vrai ou faux et pourquoi ?
  1. itemvc:=2:; itemvc:=2 ▫ c==2
  2. ▫ c=2 itemvc:=4/2
  3. ▫ c:=3/1.5 itemvc:=(2+2)/2
  4. ▫ c:=(2.0+2)/2
  5. ▫ c:=2a/a
  6. ▫ c:=(2*a)/a itemvc:=2*a/a itemvc:=1:; c:=2*c
Exercice 3  Les commandes suivantes affectent à la variable c une expression valide : répondre vrai ou faux et pourquoi ?
  1. itemvc:=ab itemvc:=a*b ▫ c==a itemvc:= c==a
  2. ▫ c:=a+(a*b))/2
  3. ▫ c=a+a*b itemvc:=a/b
  4. ▫ c->a/b itemva/b=>c itemvc:=a/0 itemvc:=2*a/a
  5. ▫ c:=1: c:=2*c
Exercice 4  Les commandes suivantes affectent la valeur 1 à b : répondre vrai ou faux et pourquoi ?
  1. ▫ a:=1:; b=a itemva:=1:; b:=a
  2. ▫ a:=1:; b:='a':; a:=3:; b
  3. ▫ a:=1:; b:="a" itemvb:=a/a itemvb:=a^0
Exercice 5  Les commandes suivantes retournent la valeur exacte 2 : vrai ou faux et pourquoi ?
  1. itemv1/2^-1 itemva:=2 itemv2*a/a ▫ sqrt(4*a^2)/a
  2. ▫ simplify(sqrt(4*a^2)/a)
  3. ▫ sqrt(4*a^4)/(a*a) itemvsimplify(sqrt(4*a^4)/(a*a))
  4. ▫ expand(sqrt(4*a^4)/(a*a)) itemvnormal(sqrt(4*a^4)/(a*a))
  5. ▫ ln(a^2)/ln(a) itemvsimplify(ln(a^2)/ln(a))
  6. ▫ texpand(ln(a^2)/ln(a)) itemvnormal(texpand(ln(a^2)/ln(a))) itemv-ln(exp(-2))
  7. ▫ 1/exp(-ln(2)) itemvexp2pow(1/exp(-ln(2)))
Exercice 6  Les commandes suivantes définissent la fonction f qui à x associe x2 : vrai ou faux et pourquoi ?
  1. itemvf(x):=x^2 itemvf(a):=a^2 ▫ f := x^2
  2. ▫ f(x):=a^2 itemvf := a->a^2
  3. ▫ f(x):=evalf(x^2)
  4. ▫ f(x):=simplify(x^3/x)
  5. ▫ f(x):=simplify(x*x*a/a) itemvE:=x^2:;f:=unapply(E,x) itemvf:=unapply(simplify(x^3/x),x)
Exercice 7  Les commandes suivantes définissent la fonction f qui au couple (x,y) associe le produit xy : vrai ou faux et pourquoi ?
  1. ▫ f:=x*y
  2. ▫ f:=x->x*y itemvf:=(a,b)->a*b itemvf(x,y):=x*y
  3. ▫ f(x,y):=xy itemvf:=((x,y)->x)*((x,y)->y)
  4. ▫ f:=(x->x)*(y->y) itemvf:=unapply(x*y,x,y) itemvE:=x*y:;f:=unapply(E,x,y)
Exercice 8  Les commandes suivantes définissent la fonction f1 qui à x associe 2*x : vrai ou faux et pourquoi ?
  1. ▫ f(x):=x^2:; f1(x):=diff(f(x))
  2. ▫ f1:=diff(x^2) itemvf1:=unapply(diff(x^2),x) itemvf(x):=x^2:; f1:=function_diff(f)
  3. ▫ f(x):=x^2:; f1:=diff(f)
  4. ▫ f(x):=x^2:; f1:=diff(f(x)) itemvf(x):=x^2:; f1:=unapply(diff(f(x),x),x)
  5. ▫ f(x):=x^2:; f1:=x->diff(f(x))
Exercice 9  Les commandes suivantes affectent à A l’expression 2*x*y : vrai ou faux et pourquoi ?
  1. itemvA:=diff(x^2*y) ▫ A:=x->diff(x^2*y) itemvA:=diff(x^2*y,x)
  2. ▫ A:=diff(x^2*y,y)
  3. ▫ A:=diff(x*y^2,y) itemvA:=normal(diff(x*y^2,y)) itemvA:=normal(diff(x^2*y^2/2,x,y)) itemvA:=normal(diff(diff(x^2*y^2/2,x),y))
Exercice 10  Les lignes de commande suivantes affichent un losange : vrai ou faux et pourquoi ?
  1. itemvlosange(1,i,pi/3) ▫ losange((1,0),(0,1),pi/3) itemvlosange(point(1,0),point(0,1),pi/3)
  2. ▫ parallelogramme(0,1,1+i) itemvparallelogramme(0,1,1/2+i*sqrt(3)/2) itemvquadrilatere(0,1,3/2+i*sqrt(3)/2,1/2+i*sqrt(3)/2) itemvpolygone(0,1,3/2+i*sqrt(3)/2,1/2+i*sqrt(3)/2)
  3. ▫ polygonplot(0,1,3/2+i*sqrt(3)/2,1/2+i*sqrt(3)/2)
  4. ▫ polygonplot([0,1,3/2,1/2],[0,0,sqrt(3)/2,sqrt(3)/2])
  5. ▫ polygone_ouvert(0,1,3/2+i*sqrt(3)/2,1/2+i*sqrt(3)/2) itemvpolygone_ouvert(0,1,3/2+i*sqrt(3)/2,1/2+i*sqrt(3)/2,0)
Exercice 11  Les lignes de commande suivantes affichent le cercle unité : vrai ou faux et pourquoi ?
  1. itemvcercle(0,1) ▫ arc(-1,1,2*pi) itemvarc(-1,1,pi), arc(-1,1,-pi)
  2. ▫ plot(sqrt(1-x^2)) itemvplot(sqrt(1-x^2)), plot(-sqrt(1-x^2)) itemvplotimplicit(x^2+y^2-1,x,y)
  3. ▫ plotparam(cos(t),sin(t)) itemvplotparam(cos(t)+i*sin(t)) itemvplotparam(cos(t)+i*sin(t),t) itemvplotparam(exp(i*t))
  4. ▫ plotparam(cos(t)+i*sin(t),t,0,pi) itemvplotparam(cos(t)+i*sin(t),t,0,2*pi) itemvplotpolar(1,t) itemvplotpolar(1,t,-pi,pi) itemvplotpolar(1,t,0,2*pi)
Exercice 12  Les commandes suivantes retournent la liste [1,2,3,4,5] : vrai ou faux et pourquoi ?
  1. itemvl:=[1,2,3,4,5] ▫ l:=op([1,2,3,4,5]) itemvl:=nop(1,2,3,4,5)
  2. ▫ l:=seq(i,i=1..5)
  3. ▫ l:=seq(j=1..5)
  4. ▫ l:=seq(j,j=1..5)
  5. ▫ l:=seq(j,j,1..5) itemvl:=seq(j,j,1,5) itemvl:=seq(j,j,1,5,1) itemvl:=[seq(j,j=1..5)] itemvl:=nop(seq(j,j=1..5))
  6. ▫ l:=[k$k=1..5] itemvl:=[k$(k=1..5)]
  7. ▫ l:=[k+1$(k=0..4)] itemvl:=[(k+1)$(k=0..4)] itemvl:=cumSum([1$5])
  8. ▫ l:=sort(5,2,3,1,4) itemvl:=sort([5,2,3,1,4])
  9. ▫ l:=makelist(k,1,5) itemvl:=makelist(x->x,1,5)
Exercice 13  Les commandes suivantes retournent la liste [1.0,0.5,0.25,0.125,0.0625] : vrai ou faux et pourquoi ?
  1. itemv0.5^[0,1,2,3,4] ▫ 2^(-[0,1,2,3,4]) itemv2.0^(-[0,1,2,3,4]) itemv2^-evalf([0,1,2,3,4]) itemvevalf(2^(-[0,1,2,3,4]))
  2. ▫ seq(2^(-n),n=0..4) itemvevalf([seq(2^(-n),n=0..4)])
  3. ▫ 1/evalf(2^n$(n=0..4))
  4. ▫ evalf(2^n$(n=0..4))^(-1) itemv[evalf(2^n$(n=0..4))]^(-1) itemvevalf(nop(2^n$(n=0..4))^(-1)) itemva:=[]:; (a:=append(a,0.5^k))$(k=0..4):; a
  5. ▫ makelist(k->2^(-k),0,4) itemvf:=x->2.0^(-x):; makelist(f,0,4)
Exercice 14  Soit l la liste [1,0,2,0,3]. Les lignes de commande suivantes retournent l’entier 10203 : vrai ou faux et pourquoi ?
  1. itemvl*10^[4,3,2,1,0] ▫ l*10^[0,1,2,3,4] itemvrevlist(l)*10^[0,1,2,3,4] itemvl*seq(10^n,n,4,0,-1) itemvexpr(char(sum(l,48))) itemvl*nop(seq(10^n,n=(4..0))) itemvl*10^nop(j$(j=4..0))
  2. ▫ l*10^(j$(j=4..0))
  3. ▫ l*10^(j$(j=4..0)) itemvl*nop(10^j)$(j=4..0))
Exercice 15  Soit n l’entier 10203. Les lignes de commande suivantes retournent la liste d’entiers [1,0,2,0,3] : vrai ou faux et pourquoi ?
  1. ▫ (floor(n/10^k)-floor(n/10^(k+1))*10)$(k=4..0) itemv[(floor(n/10^k)-floor(n/10^(k+1))*10)$(k=4..0)]
  2. ▫ seq(iquo(n,10^k)-10*iquo(n,10^(k+1)),k=4..0) itemvnop(seq(iquo(n,10^k)-10*iquo(n,10^(k+1)),k=4..0)) itemvrevlist(convert(n,base,10)) itemvsum(asc(string(n)),-48)
  3. ▫ string(n)
  4. ▫ mid(string(n),k,1)$(k=0..4)
  5. ▫ [mid(string(n),k,1)$(k=0..4)] itemv[expr(mid(string(n),k,1))$(k=0..4)]
Exercice 16  Le polynôme P=X4+2X2+3 a été affecté par la commande P:=X^4+2*X^2+3. Les lignes de commande suivantes affichent le polynôme réciproque 3*X^4+2*X^2+1 : vrai ou faux et pourquoi ?
  1. itemvpoly2symb(revlist(symb2poly(P))) ▫ X^4*subst(P,X,1/X) itemvnormal(X^4*subst(P,X,1/X))
  2. ▫ normal(subst(P,X,1/X)) itemvnormal(subst(P/X^4,X,1/X)) itemvnormal(X^degree(P)*subst(P,X,1/X)) itemvgetNum(subst(P,X,1/X))
  3. ▫ f:=unapply(P,X):; part(f(1/X),1) itemvf:=unapply(P,X):; part(normal(f(1/X)),1)

Previous Up Next