Hä tªn: ………………………………
§Ò KIÓM TRA 45’ TIN HäC 11
Líp: ………………..
§Ò sè 02
I. Phần Trắc nghiệm (6 đ) (Khoanh tròn vào câu trả lời đúng nhất)
Câu 1: Cho x, y là hai biến nguyên và khai báo thủ
tục :
Procedure Doicho( Var a : Integer; b : Integer);
Var z : Integer;
Begin
z:=a; a:=b; b:=z;
End;
-Sau khi thực hiện các lệnh:
x:=5; y:=3;
Doicho(x, y);
thì giá trị của x, y là:
a. x=5, y=5 b. x = 3, y = 3
c. x=3, y=5 d. x=5, y=3
Câu 02: Cho khai báo đầu của một hàm:
Function F( k : Integer) : String ;
Begin
If k mod 2=0 then F:=’Chan’ else F:=’Le’;
End;
Muốn in Write( F(y) ); thì biến y phải khai
báo kiểu gì :
a) Var y : Real; b) Var y : String;
c) Var y : Integer; d) Var y : Char;
Câu 03: Khi chạy chương trình :
Var x : Integer;
Procedure TINH ;
Var y: Integer ;
Begin
y:=1; y:= y+10;
End;
BEGIN
x:=10; TINH; Write(x);
END.
-Kết quả in ra là:
a. 10 b. 12
c. 22 d. 11
Câu 04: Khi chạy chương trình :
Var x : Integer;
Procedure TTA ;
Var x : Integer;
Begin
x:= 7+5; Write(x, ‘,’);
End;
BEGIN
x:=4; TTA; Write(x:2);
END.
-Kết quả in ra là:
Câu 05. Các thao tác dùng để đọc giá trị đầu tiên trên hàng đầu từ tệp SONGUYEN.INP ra biến m
(Giả sử f là biến tệp đã khai báo)
A. Assign(f,‘SONGUYEN.INP’)->Readln(f,m)->Reset(f)->Close(f)
B. Assign(f,‘SONGUYEN.INP’)->Rewrite(f)->Writeln(f,m)->Close(f)
C. Assign(f,‘SONGUYEN.INP’)->Writeln(f,m)->Rewrite(f)->Close(f)
D. Assign(f,‘SONGUYEN.INP’)->Reset(f)->Readln(f,m)->Close(f)
Câu 06. Hàm Eof (<tên biến tệp>) trả về giá trị:
A. Sai nếu con trỏ tệp đang chỉ tới cuối dòng B. Sai nếu con trỏ tệp đang chỉ tới cuối tệp
C. Đúng nếu con trỏ tệp đang chỉ tới cuối tệp D. Đúng nếu con trỏ tệp đang chỉ tới cuối dòng
II. Phần tự luận: (4đ)
Viết chương trình nhập vào 2 số nguyên dương, xuất ra ước số chung lơn nhất và bội số chung nhỏ nhất của 2
số đó. (Có sư dụng chương trình con để tính ÚCLN)
Ví dụ: Nhập 2 số : 8 12
Kết quả -> UCLN = 4
BSCNN = 24
Bài làm
................................................................................................................................................................................
a. 35, 4 b. 12, 4
c. 4, 75 d. 4,7,5
................................................................................................................................................................................
................................................................................................................................................................................
................................................................................................................................................................................
................................................................................................................................................................................
................................................................................................................................................................................
................................................................................................................................................................................
................................................................................................................................................................................
................................................................................................................................................................................
................................................................................................................................................................................
................................................................................................................................................................................
................................................................................................................................................................................
................................................................................................................................................................................
................................................................................................................................................................................
................................................................................................................................................................................
................................................................................................................................................................................
................................................................................................................................................................................
................................................................................................................................................................................
................................................................................................................................................................................
................................................................................................................................................................................
................................................................................................................................................................................
................................................................................................................................................................................
................................................................................................................................................................................
................................................................................................................................................................................
................................................................................................................................................................................
................................................................................................................................................................................
................................................................................................................................................................................
................................................................................................................................................................................
................................................................................................................................................................................
................................................................................................................................................................................
................................................................................................................................................................................
................................................................................................................................................................................
................................................................................................................................................................................
................................................................................................................................................................................
................................................................................................................................................................................
................................................................................................................................................................................
................................................................................................................................................................................
................................................................................................................................................................................
................................................................................................................................................................................
................................................................................................................................................................................
................................................................................................................................................................................
................................................................................................................................................................................
................................................................................................................................................................................
................................................................................................................................................................................
................................................................................................................................................................................
................................................................................................................................................................................
................................................................................................................................................................................
................................................................................................................................................................................
................................................................................................................................................................................
................................................................................................................................................................................
................................................................................................................................................................................
................................................................................................................................................................................