môn pascal 2
1.Trong pascal phÝm F2 co chuc nang:
_Luu chuong trinh trong khi soan thao
2.To hop phim Crtl + F9 co tac dung:
_Chạy chương trinh
3.To hop phim Alt + x co tac dung:
_Thoat khoi man hinh
4.kieu byte bieu dien cac gia tri so nguyen tu:
_0 den 255
5.Shortint la kieu:
_So nguyen
6.Char la kieu:
_Ki tu
7.Bang ma ASCII co bnh ky tu
_256
8.do dai toi da cua bien 1 kieu string co the chua toi da bnh ky tu
_255
9.SQR(x) la ham:
_binh phg cua 1 so nguyen hay so thuc
10.SQRT(x)la ham
_can bac 2 cua x
11.SUCC(x) la ham
_cho gia tri dung sau x
12.PRED(x) lµ hµm:
_Cho gia tri dung truoc x
13.hay doc doan ma sau va xem may in ra kq =??
var
r: Real;
i: Integer;
begin
r := Abs(-2);
i := Abs(-1);
writeln(r+i);
end.
_KQ:3
14.hay doc doan ma sao va xem may in ra kq=?? neu ng dung nhap chu Hanoi ?
Var
S: String;
i:Integer;
begin
Writeln(' vao S=');
Readln (S);
i=Length(S);
Writeln('length = ',i );
end. &
_KQ:5
15.vs cac gtri sau cua bien M, cho biet
M[0, 0, 0] = 0
M[0, 0, 1] = 1
M[0, 1, 0] = 2
M[0, 1, 1] = 3
M[1, 0, 0] = 4
M[1, 0, 1] = 5
M[1, 1, 0] = 6
M[1, 1, 1] = 7
_M la bien mang 3 chieu kieu nguyen
16. lenh Read(x) co nghia la j
_doc du lieu tu ban pim vao bien x nhug ko xuong dong
17.cau chuc chung 1 chg trinh pascal nhu sau:
program ... ;
uses ... ;
label ... ;
const ... ;
type ... ;
var ... ;
procedure ... ;
function ... ;
begin
menh de var dung de lam j
_khai bao bien
18.lenh For ... to ... do de lam j ?
_thuc hien pep lap tuan tu vs so vong lap co dinh truoc
19.lenh Writeln(int(sqrt(3))) in ra man hinh gtri nao
_1
20.vs doan ma sau vong lap se dung khi nao
repeat
Write('Vao gtri i=')
ReadLn(I);
until (I >= 0) and (I <= 9);
_khi i la gtri bat ky trong khoang [0,9]
21.I se nhan gtri nao khi gap doan ma sau
I:=7;
Min:=2;
Max:=6;
if (I < Min) or (I > Max) then I := 0;
_0
22.P se nhan gtri nao khi gap doan ma sau
p:=2;
if P <> 2 then
Writeln('P=',20);
else
Writeln('P=',120);
_120
23.tim cho sai trong cac khai bao sau:
var
X, Y, Z: real;
I, J, K: Integer;
Done Error: Boolean;
Vector: array[1..10] of real;
Name: string[15];
_sai dong : Done Error: Boolean
24.tim cho sai o doan ma sau
with Date(I) do
begin
month := 1;
year := year + 1;
end;
_ko sai dong nao
25.lenh write(x:5:2) co y nghia j
_In ra man hinh ndung bien x, danh 5 vi tri pan nguyen, 2vi tri pan thap pan
26.co bnh lan lap
begin
Randomize;
repeat
Writeln (Random(1000));
until KeyPressed;
_ko biet dc
27.doan ma sau in kq nao
s:=0;
For i:=1 To 2 Do
For j=1 to 2 Do
s:=s+i*j;
Writeln('S=',S)
_9
28.doan ma sau in kq nao
For i:=1 To 3 Do
Begin
S:=0;
For j=1 to 2 Do
S:=S+i*j;
End
Writeln('S=',S)
_18
29.doan ma sau in kq nao
S=0
For i:=1 To 3 Do
For j=1 to 2 Do
Begin
S:=S*i*j;
Writeln('S=',S);
End
_0
30.doan ma sau in kq nao
Var
a,b: Boolean;
Begin
a: =15>12;
b:=1=4;
if a=b then write('Hello') else write('goodbye');
End
_Goodbye
31.Chuong tring sau in kq bnh
Program ViDu;
Var
S,i:Integer;
Begin
I:=1;
S:=2;
S:=S+I;
S:=S*S;
Writeln(S);
End
_9
32.doan ma sau sai o dong nao
1.Var
2. A,b,c:Char;
3. Begin
4. a:=True;
5. b:='B'
6. c:=ReadKey;
7. Writeln(a,b,c);
8.End
_dßng 4
33.doan ma sau in kq nao
a:=34;
b:=78;
If a < b Then
Max:=b;
Else
Max:=a;
Writeln(Max)
_78
34.doan ma sau in kq nao
Var
a,b,c,d:Real;
Begin
D:= b*b - 4 *a*c;
x1:=(-b+Sqrt(D))/(2*a);
x2:=(-b-Sqrt (D))/(2*a);
Writeln ('x1 = ', x1);
Writeln ('x2 = ', x2);
End
_Chuong tring bao loi vi chua khai bao x1,x2
35.doan ma sau in kq nao
Var
a,b,s:Real;
Begin
a:=7;
b:=11;
s:= SQRT(b-a);
Writeln ('s = ', s);
End
_2
36.doan ma sau sai vi sao
Var
a,b,c:Real;
D:= b*b - 4 *a*c;
Writeln ('D = ', D);
End
_thieu Begin va chua khai bao bien d
37. doan ma sau sai o dong nao
1.Type
2. Lop = (Tin1,Tin2,Tin3);
3. Var
4. A,B:Lop;
5. Begin
6. A:=Tin3;
7. For B :=Tin1 To Tin3 Do
8. If A:=B Then writeln('Líp nµy cã 50 Sinh viªn');
9. End
_dong 8
38.S = bnh sau khi chay doan lenh sau ?
S=0;
For I:=1 To 100 Do
S=S+i
_S la tong 1 cho den 100
39. P se nhan gtri nao khi gap doan ma sau:
p:=2;
if P <> 2 then
Writeln('P=',2);
else
Writeln('P=',120)
_120
40.doan ma sau cho kq nao
Var
i: Integer;
s,a,b: Real;
Begin
b:=0.5;
a:=1; I :=1; s:=0;
Repeat
s:=s+a;
i:=i+1;
a:=1/i;
Until a<=b ;
Writeln ( ' Tong = ', S );
End
_S=1
41.doan ma sau in kq nao
Var
i: integer;
S,a,b: Real;
Begin
b:=0;
a:=1; I :=1; S:=0;
While a>b Do
Begin
S:=S+a;
i:=i+1;
a:=1/(i*i);
End ;
Writeln ( ' Tong = ', S );
End
_vog lap vo han
42.doan ma sau in kq nao
Var
Tong, I: Integer;
Begin
Tong:=0;
I:=3;
Repeat
Tong:= Tong+I;
I:=i+1;
Until i>5;
Writeln('Tong=',tong);
End
_12
43.gia tri bien Tong la bnh
Label 3;
Var
Tong, I: Integer;
Begin
Tong:=0;
I:=1;
3: Tong:= Tong+i;
i:=i+1;
if i<=2 Then Goto 3;
Writeln('Tong =', Tong);
End
_Tong=3
44.doan ma sau in kq nao
Var
Procedure Vao;
A,b,s: Real;
Begin
a:=5;
b:=4;
End;
Begin
Vao;
s:=a+b;
Writeln('s=',s);
End
_ko xđ
45.doan ma sau in kq nao
Var
A,b,s: Real;
Procedure Vao;
Begin
a:=2;
b:=6;
End;
Begin
Vao;
s:=a+b;
Writeln('s=',s);
End
_8
46.doan ma sau in kq nao
Var
i: integer;
S,a,b: Real;
Begin
b:=10;
a:=2; I :=0; S:=0;
While a>b Do
Begin
S:=S+a;
i:=i+1;
a:=1/(i*i);
End ;
Writeln ( ' Tong = ', S );
End
_S=0
47.doan ma sau in kq nao
Var
Tong, I: Integer;
Begin
Tong:=0;
I:=1;
Repeat
Tong:= Tong+I;
I:=i+1;
Until i>1;
Writeln('Tong=',tong);
End
_1
48.gtri bien Tong la bnh
Label 3;
Var
Tong, I: Integer;
Begin
Tong:=0;
I:=2;
3: Tong:= Tong+i;
i:=i+1;
if i<=2 Then Goto 3;
Writeln('Tong =', Tong);
End
_Tong= 2
49.xem may in ra kq=?? neu ng dung nhap chu Chinh
Var
S: String;
i:Integer;
begin
Writeln(' Vao S=');
Readln (S);
i=Length(S);
Writeln('length = ',i );
end
_5
50. vs cac gtri sau cua bien M, cho biet
M[0, 0] = 0
M[0, 0] = 1
M[0, 1] = 2
M[0, 1] = 3
M[1, 0] = 4
M[1, 0] = 5
M[1, 1] = 6
M[1, 1] = 7
_M la bien mang 2 chieu kieu nguyen
51.lenh Writeln(int(sqrt(16))) in ra man hinh gtri nao
_4
52.vs doan ma sau vong lap se dung khi nao
repeat
Write('vao gi¸ trÞ i=')
ReadLn(I);
until (I >= 0) and (I <= 5)
_Khi i la gtri bat ky trong khoang [0,5]
53.I se nhan gtri nao khi gap doan ma sau
I:=7;
Min:=2;
Max:=6;
if (I < Min) or (I > Max) then I := 9
_9
54.P se nhan gtri nao khi gap doan ma sau
p:=2;
if P = 2 then
Writeln('P=',20);
else
Writeln('P=',120)
_20
55.doan ma sau in kq bnh
s:=0;
For i=1 To 2 Do
For j =1 to 2 Do
s:=s+i*j;
Writeln('S=',S)
_chg trinh bao loi
56.doan ma sau in kq nao
For i:=1 To 3 Do
Begin
S:=1;
For j:=1 to 2 Do
S:=S+i*j;
End
Writeln('S=',S)
_19
57.doan ma sau in kq nao
S:=0
For i:=1 To 2 Do
For j:=1 to 3 Do
Begin
S:=S*i*j;
Writeln('S=',S);
End
_0
58.doan ma sau in kq nao
s=0;
For i:=1 To 3 Do
For j=1 to 2 Do
Begin
S:=S*i*j;
Writeln('S=',S);
End
_bao loi
59.ctrinh sau in kq bnh
Program ViDu;
Var
S,i:Integer;
Begin
I:=2;
S:=2;
S:=S+I;
S:=S*S;
Writeln(S);
End
_16
60.doan ma sau sai o dong nao
1.Var
2. A,b,d:Char;
3. Begin
4. b:=True;
5. a:='A'
6. d:=ReadKey;
7. Writeln(a,b,d);
8.End
_dong 4
61.
doan ma sau in kq nao
a:=34;
b:=18;
If a < b Then
Max:=b;
Else
Max:=a;
Writeln(Max)
_18
62.doan ma sau in kq nao
Var
x1,x2,c,d:Real;
Begin
D:= b*b - 4 *a*c;
x1:=(-b+Sqrt(D))/(2*a);
x2:=(-b-Sqrt (D))/(2*a);
Writeln ('x1 = ', x1);
Writeln ('x2 = ', x2);
End
_ctrinh bao loi vi chua khai bao a,b
63.doan ma sau in kq nao
Var
a,b,s:Real;
Begin
a:=9;
b:=34;
s:= SQRT(b-a);
Writeln ('s = ', s);
End
_5
64.doan ma sau sai vi sao
Var
a,b,c:Real;
Begin;
D:= b*b - 4 *a*c;
Writeln ('D = ', D);
End
_d chua khai bao
65.nxet ve doan ma sau:
Type C=Char
Var
Chr : C;
Begin
Clrscr;
For Chr:='A' To 'G' Do Write(Chr:2);
End
ctrinh in ra man hinh cac ky tu tu A>>G
66.doan ma sau sai dong nao
1.Type
2. Lop = (Tin1,Tin2,Tin3);
3. Var
4. A,B:Lop;
5. Begin
6. A:=Tin3;
7. For B :=Tin1 To Tin3 Do
8. If A=B Then writeln('lop nay co 50 sv'');
9. End
_ko sai dong nao
67.
S =bnh sau khi chay doan lenh sau ?
S=0;
For I:=1 To 1000 Do
S=S+i
_S la tong tu 1 cho den 1000
68.doan ma sau cho kq nao
Var
i: Integer;
s,a,b: Real;
Begin
b:=0.5;
a:=1; I :=1; s:=1;
Repeat
s:=s+a;
i:=i+1;
a:=1/i;
Until a<=b ;
Writeln ( ' Tong = ', S );
End
_S=2
69.doan ma sau in kq nao
Var
i: integer;
S,a,b: Real;
Begin
b:=0;
a:=1; I :=100; S:=2;
While a>b Do
Begin
S:=S+a;
i:=i+1;
a:=1/(i*i);
End ;
Writeln ( ' Tong = ', S );
End
_vong lap vo han
70.doan ma sau in kq nao
Var
Tong, I: Integer;
Begin
Tong:=0;
I:=5;
Repeat
Tong:= Tong+I;
I:=i+1;
Until i>5;
Writeln('Tong=',tong);
End
_5
71.gtri bien Tong la bnh
Label 3;
Var
Tong, I: Integer;
Begin
Tong:=0;
I:=1;
3: Tong:= Tong+i;
i:=i+5;
if i<=2 Then Goto 3;
Writeln('Tong =', Tong);
End
_Tong=1
72.doan ma sau in kq nao
Var
Procedure Vao;
A,b,s: Real;
Begin
a:=5.0;
b:=4.0;
End;
Begin
Vao;
s:=a+b;
Writeln('s=',s);
End
_S=9
73.doan ma sau in kq nao
Var
A,b:Interger;
s: Real;
Procedure Vao;
Begin
a:=2;
b:=6;
End;
Begin
Vao;
s:=a+b;
Writeln('s=',s);
End
_Ko xđ
74.doan ma sau in kq nao
Var
i: integer;
S,a,b: Real;
Begin
b:=10;
a:=20; I :=0; S:=0;
While a<b Do
Begin
S:=S+a;
i:=i+1;
a:=1/(i*i);
End ;
Writeln ( ' Tong = ', S );
End
_S=0
75.doan ma sau in kq nao
Var
Tong, I: Integer;
Begin
Tong:=0;
I:=2;
Repeat
Tong:= Tong+I;
I:=i+1;
Until i>1;
Writeln('Tong=',tong);
End
_2
76.gtri bien Tong la bnh
Label 3;
Var
Tong, I: Integer;
Begin
Tong:=0;
I:=9;
3: Tong:= Tong+i;
i:=i+1;
if i<=9 Then Goto 3;
Writeln('Tong =', Tong);
End
_Tong= 9
77.doan ma sau dong nao sai
1. A:Object
2. x,y,s: Real;
3. Procedure vao;
4. Procedure tong;
5. End
_Dong 1
78.doan ma sau dong nao sai
1. A=Object
2. x,y,s: Real;
3. Procedure vao;
4. Procedure tong;
5. End
_Dong 5
79.Trong pascal de ket thuc ctrinh ta dung
_end.
Bạn đang đọc truyện trên: Truyen247.Pro