Week 01 self-preparation assignments I. Why is this course ( Information Science ) taught in English? Write three most important, in your opinion, reasons: 1. Most computer science jobs in any country, including Japan, require knowledge of English. 2. Employees who speak English usually get higher salaries, have better careers, and are promoted sooner. 3. Ritsumeikan University requires this course to be taught in English. II. In the space below, list five major parts, which every modern personal computer has: 1. CPU 2. RAM 3. Network card 4. HDD (or SSD) 5. Graphics card III. a) A student missed (did not come to) 6 classes of Information Science 1. What mark will this student receive for the course? b) A student of Information Science 1 was late to the class for 45min. Can this student take a quiz/test in the end of the class? How will this student s attendance be registered? a) F b) Yes, the student can take the quiz/test in the end of the class. The student will, however, be registered as Not attending the class.
Week 02 self-preparation assignments I. How many bits (exactly) in 0.125kB of memory? How many Bytes? 0.125kB = 1024 bits = 128 Bytes II. Draw the structure (main parts) of a CPU. Using the structure, draw the steps of the automatic sequence control (i.e. the phases of the fetch-execute cycle). 4. Execute 2. Decode the instruction 1. Fetch an instruction 6. Fetch next instruction 5. Store the result 3. Fetch operands III. Draw a table of digital information units from bit to Petabyte. Indicate the corresponding notation symbols (i.e. B, kb, etc) and the unit sizes (in bytes). Unit name Symbol Exact size (Bytes) Approximate size (Bytes) bit b 1/8 1/8 Byte B 1 1 kilobyte kb 2 10 1,000 megabyte MB 2 20 1,000,000 gigabyte GB 2 30 1,000,000,000 terabyte TB 2 40 1,000,000,000,000 petabyte PB 2 50 1,000,000,000,000,000
Week 03 self-preparation assignments I. Perform the specified conversions for these decimal, binary, base-8, and base-16 unsigned numbers: 1010010011.110 (2 = 659.75 (10 = 1223.6 (8 = 293.C (16 1023.25 = 3FF.4 (16 = 1111111111.01 (2 = 1777.2 (8 512.44 (8 = 330.5625 (10 = 101001010.1001 (2 = 14A.9 (16 E10Ah = _160412_ (8 = 1110000100001010 (2 = 57610 (10 II. Circle only correct statements: a) This is a valid radix-5 number: 451 (5 b) This is a valid hexadecimal number: 1516h c) A nibble is also called hextet d) 1 Megabyte 1,000,000 bytes III. Match left and right sides: PC 3 1) is volatile computer word 4 2) is also called Automatic Sequence Control Fetch-Execute Cycle 2 3) stores the address of the next instruction USB 5 4) determines the size of a memory cell RAM 1 5) is a computer bus ROM 6 6) is not volatile IV. Perform the following conversions: 2113.11 (4 =_151.3125 (10 102001.2 (3 _298.666667_ (10
Week 04 self-preparation assignments I. Assume unsigned 24-bit numbers and perform the following calculations: a) CCAB02 (16 F2600C (16 = 11332412 (8 b) 0EA60014 (16 + 41205016 (8 = F2B0A22 (16 c) 010010 (16 000001101010001010010001 (2 = 324276624420 (8 II. Assume unsigned 12-bit numbers and perform the following calculations: a) 384 (16 / 36 (8 = 000000011110 (2 b) 7068 / 2 (8 = DCE (16 c) 000100101100 (2 / 7 (8 _101010.11011011_ (2 III. Write the BCD code for the following (unsigned) numbers: a) 121009 = _000100100001000000001001_ (BCD b) BA3 (16 = _2979 (10 _=_0010100101111001 (BCD c) 2222 (8 = _1170 (10 _=_0001000101110000 (BCD IV. Match the definitions: BCD _5_ 1) can be denoted with hex Gray code _4_ 2) 8 Carry or borrow in octal _2_ 3) 7 Base-16 _1_ 4) reflected binary code Base-2 _6_ 5) binary coded decimal Largest single octal digit _3_ 6) the longest number representation
Week 05 self-preparation assignments I. Assume 12-bit 2 s complement and perform the following calculation. Does an overflow occur? a) EEAh F07h = FE3h Overflow? _No_ (Yes or No) b) 7002 (8 C0Dh = _0765 (8 Overflow? _No_ (Yes or No) c) 625h + 534h = _5531 (8 Overflow? _Yes (Yes or No) d) 76Bh + 7166 (8 = _5E1h Overflow? _No_ (Yes or No) II. Assuming 2 s complement, convert these 12-bit numbers to decimal: a) 111110000111 (2 = _-121 (10 b) 000100010101 (2 = _277 (10 c) 9A0h = _-1632_ (10 d) 6205 (8 = -891 (10 III. Convert the following decimal numbers to their 12-bit binary equivalents: a) 1500 = _101000100100 (2 s complement = _110111011100 (signed magnitude b) 1026 = _101111111110 (2 s complement = _110000000010 (signed magnitude c) 568 = _001000111000 (2 s complement = 001000111000 (signed magnitude IV. Match the definitions: range in signed magnitude _1_ 1) from 2 n-1 + 1 to 2 n-1 1 range in 2 s complement _3_ 2) binary arithmetic overflow NaN _5_ 3) from 2 n-1 to 2 n-1 1 result out of range _2_ 4) all the bits are inverted 2 s complement _6_ 5) a special value in IEEE 754 1 s complement _4_ 6) used to store negative integers
Week 06 self-preparation assignments I. Draw a flowchart of an algorithm for the following problem: Input three numbers, a, b, and c. Print first the number that has the greatest square and then the number that has the second greatest square. II. Write a pseudocode of an algorithm for the following problem: Get 100 negative numbers, and for every input number less than 10 but greater than 1000, print its value. 1. Set counter i 1 2. Input a number, x i 3. If x i 0 then Print Only negative numbers, please! and Go to Step 2 4. If 1000 < x i < -10 then Print x i 5. i i+1 6. If i 100 then Go to Step 2 7. Terminate III. Match words with definitions: Waterfall _e_ a) Simplified English Pseudocode _a_ b) Unified modeling language Hierarchy chart_c_ c) Shows the overall system s structure Flowchart _d_ d) A logic diagram of an algorithm UML _b_ e) A model of program life-cycle
Week 08 self-preparation assignments I. Draw a flowchart of an algorithm for the following problem: Input 10 negative integers, 10 positive integers, and calculate and print their sum. Start N=10; nn, np =0; S =0; Get x x > 0 && np <N FALSE TRUE x < 0 && nn <N TRUE Repeat input FALSE x == 0 ( nn <N np <N) FALSE TRUE S = S + x ; np++ S = S + x ; nn ++ Print S Stop II. Find (circle) all the errors in the following pseudocode: final int COUNT=250; float 1_d,2_b,coefficient_2; int coefficient_1; input d,b; coefficient_1=coefficient_1+count-d/b; print coefficient_2, coefficient; stop; III. Evaluate the following arithmetic expressions. For each expression, assume int z=2.2, char y= d and float x= 11.2 1.) x=z/3*5 y x=_ 100.0 2.) x=z*x x=_ 22.4_ 3.) z=(x + 0.2) / 2 z=_ 5 4.) y=4.5*z/4 + y y=_ f
Week 09 self-preparation assignments I. Evaluate arithmetic expressions in the pseudocode below. Describe the evaluation process, using comment statements in appropriate places of the pseudocode: // Pseudocode begins here: int x,y; float a; x = 2.3; //x is assigned 2 a = 6.6/x; //a is assigned 3.3 y = ++x + a; //x gets 3, then y is assigned 6 y = y-- /5+1; //y is assigned 2, then y gets 1 x = a +.7+ y; //x is assigned 5 a = x - ++y +.5; //y gets 2, then a is assigned 3.5 x = 21/2%7; //x is assigned 3 y = (int)a * 1.5; //y is assigned 4 a = a - x%y; //a is assigned 0.5 // Pseudocode ends here. II. Select the correct operator precedence: = _5_ 1) 1 (highest precedence) preincrement _1_ 2) 2 + _4_ 3) 3 () _2_ 4) 4 / _3_ 5) 5 (lowest precedence) III. Write the data types listed in order from narrowest (least precise) to widest (most precise): 2. double (widest) 4. float 1. int 3. char 5. boolean (narrowest) 1. int 2. double 3. char 4. float 5. boolean
Week 10 self-preparation assignments I. Evaluate the following expressions for the Boolean values x=true, y=false, and z=true by circling TRUE or FALSE. Use Boolean arithmetic for * and +. a. (x!z)&&(y!y)&&!(z!x) TRUE FALSE b. (y (!x&&!y&&z))&&x TRUE FALSE c.!!((!(x z)&&!x!x)) TRUE FALSE d. x OR z AND NOT(y) TRUE FALSE e. (!(x+y+z)&&!(x*y*z)) TRUE FALSE f. NOT(x+y*z) TRUE FALSE II. Draw the Truth Table for F(x,y,z), including all possible combinations of Boolean x, y, and z. x y z F(x,y,z) F(x,y,z) = x&&!y&&!z x&&!y&&z!x&&y 1 0 0 1 0 1 0 1 0 0 1 0 1 1 0 0 0 1 1 1 0 0 0 0 1 0 1 1 1 1 1 0 III. For a truth table below, write G(x,y,z) in the form of a Boolean expression. x y z G(x,y,z) 1 0 0 1 0 1 0 0 0 0 1 0 1 1 0 1 0 1 1 1 0 0 0 1 1 0 1 1 1 1 1 0 G(x,y,z) = x&&!y&&!z x&&y&&!z!x&&y&&z!x&&!y&&!z x&&!y&&z
Week 11 self-preparation assignments I. Match each concept on the left with the appropriate description on the right: Indentation _d a) executes 0 or more times While loop _a b) executes 1 or more times Infinite loop _e c) a special constant used in event-controlled loops Do While loop _b d) ignored by computers Sentinel _c e) executes forever II. What is the printed output of the following pseudocode? int i=1; char j= A ; for (; i >= -3; i=i-2) if (i==0) print j+i; else j=j+1; print j; Output: 68 or D III. Select the correct operator precedence:!= _5_ 1) 1 (highest precedence) NOT _1_ 2) 2 OR _7_ 3) 3 AND _6_ 4) 4 = _8_ 5) 5 (post)++ _9_ 6) 6 < _4_ 7) 7 + _3_ 8) 8 / _2_ 9) 9 (lowest precedence)
Week 12 self-preparation assignments I. Write (e.g. in pseudocode) an example of a while loop which prints 7, 9, 11, 13, and then re-write it as a do while loop. int i=7; int i=7; while(i<14){ do { Print i; Print i; i=i+2;} i=i+2;} while(i<14) II. What is the printed output of the following pseudocode? int i=3; char j= B ; // B is ASCII 66 for (; i >= -2; i=i-1) if (i==0) j++; else print i; print j; Output(s): 321-1-2C III. Convert the following circuit diagram into a Boolean expression: X= A C A D B C B D_
Week 13 self-preparation assignments I. Find and circle all errors in the following algorithm: Start Input N N=N-5 35<N FALSE FALSE Print N Stop II. Select TRUE or FALSE for the following statements: a. Parameter passing by reference may cause side effects TRUE b. mybool = FALSE is an assignment statement TRUE c. char is an integer-compatible data type TRUE d. while(1 > 2) is an infinite loop FALSE e. An n-dimensional array has n+1 indices FALSE f. \0 is a non-printable character TRUE III. What is the results of the following assignments? (For each assignment, set float z=-2. and int x=4.3) a. x=int(2*z) % x++ x=_1 b. x=z+7-x x=_1 c. x=x * 2.5 / (z + 2) x=_ ERROR because infinity (the result of the division) is not defined for the integer data type d. x=7 % 2 - ++x + z x=_-6
Week 14 self-preparation assignments I. For the operators on the left, write down the correct operator precedence: % _3 a) 1 (highest precedence) OR _8 b) 2 == _6 c) 3 NOT _2 d) 4 + _4 e) 5 AND _7 f) 6 < _5 g) 7 ( ) _1 h) 8 (lowest precedence) II. Use De Morgnan s Law and simplify the following expression:!(y>= 10 && y<=5)! (y< 10 y>5) III. Match left and right: UML _ c a) Linearly, from the beginning to EOF Pseudocode _ b b) A text-based design tool Logical file _ e c) A graphical design tool Physical file _ d d) Collection of bits on a SS I/O device Random access _ f e) Interface to access data on a SS I/O device Sequential access _ a f) Uses an index file or hash function