Solution for Example Exam

Written Dec, 21, 2008.

Part A :

Fold[Plus,0,NestList[(#+1)&,0,5]]

Map[Apply[Plus,#]&,Table[Table[i,{i,j}],{j,5}]]//Last

Select[Map[2 #&,Table[i,{i,1000}]],OddQ]~Join~{"lala"}

Part B :

First Question

index[lst_,element_]:=Module[{},
tmp=Select[Transpose[{lst,Table[i,{i,Length[lst]}]}],#[[1]]===element&];
If[Length[tmp]===0,-1,tmp[[1,2]]]
]

Note : There are better ways to do this.

Second Question

equalLength[lst_]:=Apply[And,
						Map[#==Length[First[lst]]&,
							Map[Length,lst]]]

Third Question :

xx={1,-1,2,-2};
yy={-1,3,2,-3};
ListPlot[Transpose[{xx,yy}],PlotStyle->PointSize[Large]]