Font BackColor cmdcoloradd BackColor Caption Font 14 3.3 http://www.jitec.jp/ FE http://www.jpec2002.org/index_j.html FE FE Review manual, M.R.Lindeburg, Professional Publications,Inc.(2002) Sample problems
1. What is the binary (base-2) representation of (135) 10? (A) 101111010 (B) 010111101 (C) 010000111 (D) 101111001 Solution: (135) 10 = 1 2 7 2)135 + 0 2 6 2) 67 1 + 0 2 5 2) 33 1 + 0 2 4 2)16 1 + 0 2 3 2) 8 0 + 1 2 2 2) 4 0 + 1 2 1 2) 2 0 + 1 2 0 1 0 (135)10= 10000111 [ same as 010000111 ] Answer is C. 2. What is the base-10 equivalent of the binary number 0101110? (A) 18 (B) 30 (C) 46 (D) 47 Solution: 0 2 6 + 1 2 5 + 0 2 4 + 1 2 3 + 1 2 2 + 1 2 1 + 0 2 0 = 46 Answer is C. 92
3. What is the octal (base-8) equivalent of the binary number (1101101)2? (A) (109) 8 (B) (155) 8 (C) (550) 8 (D) (660) 8 Solution: Since 8 = 2 3, separate the bits into groups of three bits, starting with the least significant bits. Add leading zeros if necessary for consistency. 001 101 101 Convert each group of three bits into its octal equivalent. 001 101 101 (1) 8 (5) 8 (5) 8 The octal equivalent is 155. Answer is B. 4. What operation is typically represented by the following program flowchart symbol? (A) input-output (B) processing (C) storage (D) branching Solution: Branching, comparison, and decision operations are typically represented by the diamond symbol. Answer is D. (1) 16 [ ] 2 2 1 10 93
4 2 2 100 8 2 3 1000 16 2 4 10000 (2) 1 1 1 1 2 4 8 16 [ ] 1 2-1 2 1 2-2 4 1 2-3 8 1 2-4 16 0.1 0.01 0.001 0.0001 10 1 0.05 (2) 0.125 (3) 0.25 [ ] 10 2-1,2-2,2-3.2-4 10 (1) 0.05 0.0000110001100011 1 (2) 0.125= 0.001 8 (3) 0.25 = 4 1 0.01 3.4 94
Web Btu http://www.elepop.net/henkan/shigoto.htm http://www.ardre.com/application/si_unit_convert.php?mod=7 Web http://ja.wikipedia.org/wiki/ 1990 inch(in) inch(in) cm inch(in) 2.540 inch(in) cm lb ( 0.4536kg) gal ( 0.003785 m 3 ) B.t.u 252.0 cal=1.055 10 3 J 95
180 9 f = c + 32 = c + 32 100 5 Netscape Navigator P Internet Tools Netscape Communicator Netscape Navigator Yahoo http://www.yahoo.co.jp/ 96
inch feet gal B.t.u. (1) 1.50 10 3 in - 1.50 10 3 2.540 3.81 10 3 cm (2) 10.0 ft - 10.0 0.3048 3.05 m 5 (3) 9.6 10 F - (96 32) = 3.6 10 9 (4) 25.00-25.00 273.15 298.15 K (5) 4.80 10 3 cal - 4.80 10 3 4.186 2.01 10 4 J (6) 4.50 B.t.u. - 4.50 2.520 10 2 1.13 10 3 cal 1990 97
98
(1) 20 in cm (2) 100 mile/hr km/hr (3) 0 F - (4) 100 - K (5) 1.50 10 3 kwhr - J (6) 1 B.t.u - cal 1) 2) Excel 3) Excel.xls VBex1_0_1.xls VBex1_0_1.xls 4) Excel Visual Basic 99
VBex1_0_1.xls VBex1_0_1.xls Excel Sheet1 Visual Basic Excel Sheet1 Visual Basic 100
Sub convert_ex1_0_1() Dim n As Integer Dim x(10) As Double Dim factor(10) As Double n = 5 ' factor(i) "E5 E9" 5,5) (9,5) For i = 1 To n factor(i) = Cells(4 + i, 5) Next i ' "B5 5,2) x(1) = Cells(5, 2).Value ' factor(i) For i = 2 To n x(i) = factor(i) * x(1) Next i ' x(i) =factor(i)*x(i) "B6 B9" 6,2) (9,2) For i = 2 To n 101
Cells(4 + i, 2).Value = x(i) Next i End Sub 6) Visual Basic Web Net Net VB Excel.xls VBex1_0_1.xls VBex1_0_1.xls Sheet1 VB VBex1_0_2.xls VBex1_0_1.xls Excel Sub convert_ex1_0_1() Sub convert_ex1_0_2() Excel Sheet1 VBex1_0_2.xls Excel Sheet1 Excl sheet 102
sheet VB convert_ex1_0_2 OK 103
sheet sheet convert_ex1_0_2 Excel.xls VBex1_0_1.xls VBex1_0_2.xls Sheet1 VB VBex1_0_3.xls VBex1_0_2.xls Excel Sub convert_ex1_0_2() Sub convert_ex1_0_3() Excel Sheet1 VBex1_0_3.xls Excel Sheet1 VB Excel Sheet1 VB Excl sheet 104
Macro1 ResetCalc1 OK 105
Delete Excel ResetCalc1 VB Sub ResetCalc1() '' ResetCalc1 Macro ' : 2005/3/21 : Mishima 106
Application.Run " VBex1_0_3.xls!convert_ex1_0_2" Range("B6:B9").Select Selection.ClearContents Range("F6").Select End Sub Excel Sheet1 Excl sheet sheet 107
VB ResetCalc1 OK sheet sheet ResetCalc1 VBScript Web 108
m in <html> <head> <meta http-equiv="content-type" content="text/html; charset=x-sjis"> <meta name="generator" content="microsoft FrontPage 2.0"> <title>uc1 </title> </head> <body> <p><script language="vbscript"> Dim factor(5),inp,inputvalue factor(1) = 1 ' m to m. factor(2) = 39.37007874 ' m to in. factor(3) = 3.280839895 ' m to ft. 109
factor(4) = 1.093613298 factor(5) = 0.00062137119 ' m to yards. ' m to mi. Sub Convertform x1=val0.value val1.value=x1*factor(1) val2.value=x1*factor(2) val3.value=x1*factor(3) val4.value=x1*factor(4) val5.value=x1*factor(5) End Sub </script> </p> <h3> m [L]</h3> <h3> m </h3> <p> </p> <p> <input size="16" name=val0> m </p> <p> </p> <p> <br> </p> <table border="0"> <tr> <td><input size="16" name=val1></td> <td>m</td> </tr> <tr> <td><input size="16" name=val2></td> <td>in</td> </tr> <tr> <td><input size="16" name=val3></td> <td>ft</td> </tr> <tr> <td><input size="16" name=val4></td> 110
<td>yd</td> </tr> <tr> <td><input size="16" name=val5></td> <td>mile</td> </tr> </table> <table border="0"> <tr> <td align="center"><input type="button" value=" " onclick="convertform"></td> </tr> </table> <p> </p> <hr> </body> </html> 111
Excel VBA Excel sheet VBA ) Excel sheet Visual Basic Editor Visual Basic Editor 112
UserForm1 2) UserForm1 MyForm Form Caption Form UserForm1 MyForm Caption Form 3) A 113
Label2 4) Label1 Label1 lbldate Label1 lbltime CommandButon1 cmdkakunin CommandButon2 cmdend CommandButon3 cmdunload 5) MyForm 114
Private Sub cmdkakunin_click() lbldate.caption = Date lbltime.caption = Time End Sub MyForm Private Sub cmdend_click() End End Sub Private Sub cmdclose_click() Unload MyForm End Sub lbldate.caption = Date lbltime.caption = Time lbldate lbltime End Unload MyForm Form Unload me 115
6) VB Sub ShowUserForm() MyForm.Show End Sub ShowUserForm Excel sheet Excel sheet 7) ShowUserForm Excel sheet Excl sheet 116
sheet ShowUserForm OK 117
sheet sheet ShowUserForm 8) sheet 9) sheet Excel sheet Sub WorkBook_Open VB ThisWorkbook 118
General Workbook Sub Workbook_Open() Sub End Sub MyForm.show Excel sheet Excel Excel vbmodeless Private Sub Workbook_Open() MyForm.Show vbmodeless End Sub 119
Excel VBA Excel VBA Excel VBA.Show Unload Me 120
Excel Show_DateTime_01.xls Excel Show_DateTime_01.xls Show_Select_01.xls Visual Basic Editor Visual Basic Editor MyForm VB MyForm MyForm 121
cmdselect, = 18 CommandButon1 cmdselect VB MyForm UserForm1 UserForm1 1 Labl1 122
UserForm1, Label1, CommandButton1, CommandButton2, CommandButton3 UserForm1 Question1Form Question1Form Label1 lblquestion CommandButton1 cmdyes CommandButton2 cmdno CommandButton3 cmdreturn MyForm Question1Form VB Question2Form Question2Form Question1Form Question1Form Question1Form Question1Form 123
Ctrl+A Question1Form Ctrl+C Question2Form Question2Form Question2Form Ctrl+V Question2Form Ctrl+A UserForm1 UserForm1 Question2Form Question2Form LblQuestion1 lblquestion2 CmdYes cmdyes CmdNo cmdno CmdReturn cmdreturn Question1Form 3) MyForm Private Sub cmdend_click() End End Sub 124
Private Sub cmdclose_click() Unload MyForm End Sub lbldate.caption = Date lbltime.caption = Time lbldate lbltime End Unload MyForm Form Unload me 4) VB Sub ShowUserForm() MyForm.Show End Sub ShowUserForm Excel sheet Excel sheet 5) ShowUserForm Excel sheet Excl sheet 125
sheet ShowUserForm OK 126
sheet sheet ShowUserForm 6) sheet 7) sheet Excel sheet Sub WorkBook_Open VB ThisWorkbook 127
General Workbook Sub Workbook_Open() Sub End Sub MyForm.show Excel sheet Excel Excel vbmodeless Private Sub Workbook_Open() MyForm.Show vbmodeless End Sub 128
Excel VBA Excel sheet VBA 6.1 Excel sheet1 Antoine Excel sheet Visual Basic Editor Visual Basic Editor 129
UserForm1 UserForm1 MyForm Form Caption Form 130
A 3) Label1 Label1 lblshowcondition Label2 lbldegree Label3 lblshowvp CommandButton1 cmdcalc CommandButton2 cmdend TextBox1 txttemperature1 Private Sub cmdcalc_click() Dim T(20) As Single, p10(20) As Single, xlnp As Single Dim A1 As Single, B1 As Single, C1 As Single ' Antoine A1 = Cells(3, 2) B1 = Cells(3, 3) C1 = Cells(3, 4) 131
' T T(1) = txttemperature1.text ' xlnp = A1 - B1 / ((T(1) + 273.15) + C1) p10(1) = Exp(xlnp) / 760 * 0.101325 ' mmhg ' MPa lblshowvp.caption = " " & T(1) & " " _ & Val(Format(p10(1), "###.######")) & "[MPa] " End Sub Private Sub cmdend_click() End End Sub MyForm sheet1 Antoine A1 B1,C1 Cells(i, j) txttemperature1 txttemperature1.text T(1) xlnp Antoine p10(1) txttemperature1 VB Sub ShowUserForm() MyForm.Show End Sub ShowUserForm Excel sheet 132
Excel sheet ShowUserForm Excel sheet Excl sheet sheet ShowUserForm OK 133
sheet sheet ShowUserForm sheet 100 134
6.2 sheet Excel sheet2 Antone Antoine A B,C sheet1 sheet1 sheet1 135
sheet1 B18 sheet (I) 136
Delete Antoine sheet2 B B13 sheet1 A3 OK A3 Antoine sheet2 B B13 Antoine B B13 A3 Antoine sheet2 Antoine A1,B1,C1 137
--------------------------------------------------------- ' ComboBox ' sheet2 "Antoine '--------------------------------------------------------- CompNum = Cells(17, 2) ' For k = 1 To CompNum NoComp(k) = Cells(k + 2, 1) CompName(k) = Worksheets("Antoine ").Cells(2 + NoComp(k), 2) Worksheets(" ").Cells(2 + k, 2) = CompName(k) ' Antoine A1(k) = Worksheets("Antoine ").Cells(2 + NoComp(k), 3).Value B1(k) = Worksheets("Antoine ").Cells(2 + NoComp(k), 4).Value C1(k) = Worksheets("Antoine ").Cells(2 + NoComp(k), 5).Value ' sheet1 " Worksheets(" ").Cells(2 + k, 3) = A1(k) Worksheets(" ").Cells(2 + k, 4) = B1(k) Worksheets(" ").Cells(2 + k, 5) = C1(k) Next k CompNum = Cells(17, 2) B17 A3 A4 A5 NoComp(k) NoComp(k) = Cells(k + 2, 1) "Antoine ". CompName(k) B3 CompName(k) = Worksheets("Antoine ").Cells(2 + NoComp(k), 2) Worksheets(" ").Cells(2 + k, 2) = CompName(k) Antoine A1(k) B1(k) C1(k) "Antoine " " " A1(k) = Worksheets("Antoine ").Cells(2 + NoComp(k), 3).Value B1(k) = Worksheets("Antoine ").Cells(2 + NoComp(k), 4).Value C1(k) = Worksheets("Antoine ").Cells(2 + NoComp(k), 5).Value 138
' sheet1 " Worksheets(" ").Cells(2 + k, 3) = A1(k) Worksheets(" ").Cells(2 + k, 4) = B1(k) Worksheets(" ").Cells(2 + k, 5) = C1(k) " " Antone Antoine 11 MyForm sheet1 MyForm L10:M11 139
MyForm Private Sub cmdcalc_click() Dim CompName(10) As String ' Dim NoComp(10) As Integer ' Dim CompNum As Integer ' ' Dim T(20) As Single, p10(20) As Single, xlnp(20) As Single Dim rt(20) As Single, dt As Single Dim A1(10) As Single, B1(10) As Single, C1(10) As Single '------------------------------------------------------ ' Application.StatusBar = " " ' Application.ScreenUpdating = False ' '------------------------- - ' Worksheets(" ").Range("F2:K38,B3:E15").Select Selection.ClearContents Worksheets(" ").Range("A1").Activate '--------------------------------------------------------- ' ComboBox ' sheet2 "Antoine '--------------------------------------------------------- CompNum = Cells(17, 2) ' For k = 1 To CompNum NoComp(k) = Cells(k + 2, 1) CompName(k) = Worksheets("Antoine ").Cells(2 + NoComp(k), 2) Worksheets(" ").Cells(2 + k, 2) = CompName(k) ' Antoine A1(k) = Worksheets("Antoine ").Cells(2 + NoComp(k), 3).Value B1(k) = Worksheets("Antoine ").Cells(2 + NoComp(k), 4).Value C1(k) = Worksheets("Antoine ").Cells(2 + NoComp(k), 5).Value ' sheet1 " Worksheets(" ").Cells(2 + k, 3) = A1(k) Worksheets(" ").Cells(2 + k, 4) = B1(k) Worksheets(" ").Cells(2 + k, 5) = C1(k) Next k ' T 140
T(1) = txttemperature2.text ' T(11) = txttemperature1.text ' ' 10 dt = (T(11)- T(1)) / 10 For i = 1 To 10 T(i + 1) = T(1) + dt * i Next i ' ' '----------------------------------------------------- For k = 1 To CompNum For i = 1 To 11 xlnp(i) = A1(k) - B1(k) / ((T(i) + 273.15) + C1(k)) ' mmhg p10(i) = Exp(xlnp(i)) / 760 * 0.101325 ' MPa Next i ' For i = 1 To 11 rt(i) = 1 / (T(i) + 273.15) Next i ' ' Cells(2 + 13 *(k- 1), 6) = CompName(k) For i = 1 To 11 Cells(1 + i + 13 *(k- 1), 7) = i Cells(1 + i + 13 *(k- 1), 8) = T(i) Cells(1 + i + 13 *(k- 1), 9) = p10(i) Cells(1 + i + 13 *(k- 1), 10) = rt(i) Cells(1 + i + 13 *(k- 1), 11) = xlnp(i) Next i Next k '--------------------------------------------------- lblshowvp1.caption = " " & T(1) & " " _ & Val(Format(p10(1), "###.######")) & "[MPa] " lblshowvp2.caption = " " & T(11) & " " _ & Val(Format(p10(11), "###.######")) & "[MPa] " End Sub Private Sub cmdend_click() 141
End Sub End Excel Show_VP_Graph02,xls 100 0 142
143