阿摩線上測驗
登入
首頁
>
研究所、轉學考(插大)、學士後-計算機概論
> 100年 - 100 國立高雄大學_轉學招生考試試題(轉二年級)_資訊工程學系:計算機概論#148903
100年 - 100 國立高雄大學_轉學招生考試試題(轉二年級)_資訊工程學系:計算機概論#148903
科目:
研究所、轉學考(插大)、學士後-計算機概論 |
年份:
100年 |
選擇題數:
0 |
申論題數:
7
試卷資訊
所屬科目:
研究所、轉學考(插大)、學士後-計算機概論
選擇題 (0)
申論題 (7)
1. Consider a simple imperative language called Bare Bones. It uses only the following four
statements.
Statement Meaning
clear name;
Set the value of name to zero
incr name;
Increase the value of name by 1
decr name;
Decrease the value of name by 1
while name not 0 do; … end;
While the value of name is not zero do …
where name stands for a variable name. As an example, the following routine copies the value
of X to Y with the side effect of destroying the value of X.
clear Y;
while X not 0 do;
incr Y;
decr X;
Please write a Bare Bones routine that copies the value of X to Y without destroying X’s value.
You are allowed to use an auxiliary variable Z (20%)
2. Show that the if-then-else structure can be simulated using Bare Bones. That is, write a program
sequence in Bare Bones that simulates the action of the statement
if X not 0 then S1 else S2;
where S1 and S2 represent arbitrary statement sequences. You are allowed to use an auxiliary
variable Y. (20%)
3. Show the correct order of the following activities that may arise in instruction execution cycle. (a)
Fetch operands (b) Fetch (c) Execute (d) Store Result (e) Decode. (10%)
4. (a) How many negative integers can be represented by n bits using 2’s complement representation?
(b) Convert decimal number 522 to a 3-digit hexadecimal number. (10%)
5. Assume that C function power_of_two(n) returns 1 if n is a power of two and 0 otherwise.
What is the return value when calling w(6,3), where function w is defined as follows. (20%)
int w(int n, int k)
{
int i = 0, j = 1;
if (k == 1) {
if (power_of_two(n))
return 1;
else
return 0;
};
while (n – j > 0) {
i += w(n – j, k - 1);
j *= 2;
};
return i;
};
6. AND, OR, NOT, and XOR are four logical operations that can be used to modify a bit pattern.
Let X be a byte. (a) Show how to set (force to 1) the four rightmost bits of X by performing one
of these operations on X and a specific bit pattern. (10%) (b) Show how to flip the three
rightmost and the two leftmost bits of X by performing one of these operations on X and a
specific bit pattern. (10%)
相關試卷
115年 - [無官方正解]115 國立高雄大學_轉學招生考試試題(轉二年級)_資訊工程學系:計算機概論#148890
115年 · #148890
115年 - [非官方正解]115 國立臺北大學_日間學士班轉學生招生考試試題_資訊工程學系日間學士班2年級:計算機概論#147389
115年 · #147389
115年 - [非官方正解]115 國立臺北大學_碩士班一般入學考試試題_資訊管理研究所:計算機概論#147163
115年 · #147163
115年 - 115 國立嘉義大學_碩士班招生考試試題_資訊管理學系:計算機概論#143936
115年 · #143936
115年 - 115 國立嘉義大學_轉學生招生考試試題_資訊管理學系:計算機概論#143910
115年 · #143910
115年 - [無官方正解]115 國立嘉義大學_轉學生招生考試試題_資訊工程學系:計算機概論#143857
115年 · #143857
115年 - 115 中央警察大學_碩士班入學考試試題_資訊管理研究所:計算機概論#139860
115年 · #139860
114年 - [無官方正解]114 國立臺北大學_碩士班一般入學考試試題_資訊管理研究所:計算機概論#147201
114年 · #147201
114年 - 114 中央警察大學_碩士班入學考試試題_資訊管理研究所:計算機概論#146889
114年 · #146889
114年 - 114 國立嘉義大學_碩士班招生考試試題_資訊管理學系:計算機概論#144127
114年 · #144127