| |
|
 |
相关文章 |
 |
|
|
|
|
 |
1986年程序员水平考试试题(1) |
|
|
| 1986年程序员水平考试试题(1) |
|
作者:佚名 文章来源:不详更新时间:2006-5-30 8:24:04  |
|
1986年程序员水平考试试题
试题 1 (15%)
阅读下列形成 4*5 矩阵 A 的流程图 (a)和形成 5*4 矩阵 B 的流程图 (b),
把应该填入其中的1-12处的字的句, 写在答卷的对应栏内.
矩阵 A
1 2 3 4 5
6 7 8 9 10
11 12 13 14 15
16 17 18 19 20
矩阵 B
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16
17 18 19 20
试题 2 (15%)
阅读下列 pascal 程序, 把应该填入________处的字句写在答卷的对应栏里.
[程序说明]
本程序在输入给定数 n 后,打印出所有不超过 n 的, 其平方为回文的数.
回文指的的是字符串两端的字符左右对称. 例如 1, 22, 121, 121, 4224 等均
是回文.
[程序]
program palindrome(input,output);
const max=1000;
var n,m,i,j,s,:integer;
d:array [1..max] of integer;
begin
read(n);
for m:=1 to n do
begin
______________ ;
j:=0;
while ________ do
begin j:=j+1;
d[j]:=s mod 10;
______________;
end;
i:=1;
while (d[i]=d[j]) and _________ do
begin i:=i+1; j:=j-1;
end;
if __________ then writeln(m)
end
end.
试题 3 (20%)
[程序说明]
本程序将仓库文件的前 100 个记录按仓库编号上升顺序分类. 其余记录的的
顺序不变.
一个记录物品代码(deptcode), 仓库编号(stockno)和单价(price)三部分组
成.
假定分类好的 100 个记录仍放回原文件的前头, 代替原来的 100 个记录.
[程序]
program sort (stockfile,f,input,output);
const max=100;
type stockrecord=record deptcode:char;*
stockno:integer;
price:real
共3页: 1 [2] [3] 下一页
r>
end
stock=array [1..max] of stockrecord;
var stocklist : stock;
f,stockfile : file of stock;
i,posnsmallest,next,next : integer;
begin reset (stockfile); rewrite(f);
while not eof(stockfile) do
begin f^:=stockfile^;; put(f); get(stockfile)
end;
reset(stockfile);
stocklist:==________________;
for i:=1 to max-1 do
begin posnsmall:=i;
for next:=________ to max do
if _____________________________<stocklist[posnsmall].stokno
then posnsmall:=_______;
temp:=stocklist[i];
stocklist[i]:=____________________________________;
________________________________:temp;;
end;
rewrite(stockfile); stockfile^:=_____________;
put(_________);
_____________; get(f);
while not eof(f) do
begin stockfile^:=f^;
put(stockfile); get(f)
end;
rewrite(f);
end.
试题 4 (25%)
[程序说明]
本程序输入字符串长度(不为0)的字符串的所有排列. 例如,
输入长度为 3 的字符ABC时, 打印出 ABC ACB BAC BCA CAB CBA
当输入的字符串的长大于 10 时, 取前 10 个字符.
[程序]
program anagram(input,output);
var i,length:integer;
letter,newword:array[1..10] of char;
used:array[1..10] of boolean;
procedure permute(countdown:integer);
var j:integer;
begin
if countdown=___
then begin
for i:=______ downto __ do write(newword[i]);
writeln
end
else begin
for j:=1 to _________ do
begin if not used[j]
then begin
used[j]:=ture 共3页: 上一页 [1] 2 [3] 下一页
;
newword[countdown]:=letter[j];
_____________________________;
__________:=false
end
end
end
end;(*permute*)
begin
writeln(’please type in----->);
read(length);
if __________ then length:= 10;
for i:=1 to length do
begin
used[i]:=false; read(letter[i])
end
permute(length)
end. 共3页: 上一页 [1] [2] 3
|
|
| 文章录入:admin 责任编辑:admin |
| |
|
上一篇文章: 2001年度程序员级下午试题及答案(1) 下一篇文章: 1997年度高级程序员上午试卷(1) |
|
|
| 【字体:小 大】【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口】 |
|
|
|
|
|