Part1
a.
ackermann : 0x010140
result : gp - 2028 = 0x0127B8 - 2028 = 0x011fcc
b.
因為使用c.lw來讀入資料,寫入的資料大小為1個word,使用bfos來做sign extend,使資料變回2個word(64bits).
c.
BillyNI-OUO changed 4 years agoView mode Like Bookmark
Problem 1
ER Model
Relational Model
create table Professor (
pid integer primary key,
pname varchar(30) not null,
rank integer
);
create table Project (
BillyNI-OUO changed 4 years agoView mode Like Bookmark
[TOC]
Description
Write a Python program that takes a name from the input and prints a sentense "XXX is my best friend." to the output, where "XXX" is the name from the input.
Assume the program is written in a file named "friend.py" and run from the command line. The following block shows how the terminal shall look like: (the text in pink is typed by the user; others are printed by the program)
$ python3 friend.py
Mary
Mary is my best friend.
BillyNI-OUO changed 4 years agoView mode Like Bookmark
[TOC]
Description
Define a Matrix class to represent numbers as a two-dimensional array.
The constructor for the matrix is a list of lists of numbers. A 3x3 matrix
would be constructed as
M = Matrix([[1, 2, 3], [4, 5, 6], [7, 8, 9]])
The Matrix class would support several methods, and the usage is as follows:
BillyNI-OUO changed 4 years agoView mode Like 1 Bookmark
Definitions and Short Answers - week 1 (9/9 lectures)
What is batch processing ? What are its advantages? Disadvantages?
批次處理程式。 Advantage: 多使用者共用一台機器、可以指定執行時間。 Disadvantage: CPU 經常閒置(因I/O較慢)、一次一件工作、程式之間沒有交流。
What is multiprogramming ? What disadvantage of batch processing does it address?
一次處理多件工作。程式A 處理 I/O 時,用 CPU 去跑別的程式B,解決了batch processing 的 CPU 閒置問題。
BillyNI-OUO changed 4 years agoView mode Like Bookmark
1. Definitions and Short Answers - functions
Given the command shown on the lecture slide
$ uniq mary.txt
What is
the prompt : $
the program name : uniq
1. Definitions and Short Answers - functions
What is a command-line interface?
A command line interface (CLI) is a text-based user interface (UI) used to view and manage computer files.
What is a prompt?
系統的提示符
1. Definitions and Short Answers - functions
When you call the function ord('A') it returns 65. What does it mean?
return the ASCII value of 'A'
What is the value of chr(70)? (based on the knowledge of the previous question)
return 'F'
Answer the following questions to check your understanding of your material. Expect the same kind of questions to show up on your tests.
This self check is for Python Standard Library part 1.
1. Definitions and Short Answers - functions
If a function is built-in, do you have to import it first, or can you just call it without importing?
You can call it without importing
If a function is in the standard library, do you have to import it first, or can you just call it without importing?
1. Definitions and Short Answers - functions
Given the following if-statement
x = int(input('enter one number: '))
y = int(input('another number: '))
if y == 0:
print('sorry, cannot divide by 0!')
else:
print(f'{x} / {y} = {x/y}')
BillyNI-OUO changed 4 years agoView mode Like Bookmark
Definitions and Short Answers - functions
Given a for loop:
for i in L:
print(i)
Can L be the following? If so, what does the loop print? If not, why not?
[X] ['a', 'b', 'c']
Definitions and Short Answers - functions
In Python, ArithmeticError is a base class of FloatingPointError, OverflowError, and ZeroDivisionError. So,
a. Does ArithmeticError inherit from FloatingPointError ? Or does FloatingPointError inherit from ArithmeticError?
FloatingPointError inherit from ArithmeticError
b. Does FloatingPointError inherit from OverflowError ? Or ZeroDivisionError? Or is there any inheritance relationship between them?
Answer the following questions to check your understanding of your material. Expect the same kind of questions to show up on your tests.
1. Definitions and Short Answers - functions
In Python, suppose you have the code
return [13, 25, 'hello', 'z']
Which of the following are objects?
BillyNI-OUO changed 4 years agoView mode Like 3 Bookmark