You are on page 1of 46
‘Aecandria University ssp toa ie fiesig ot Eeposiog ees 9 of Eg oe Specllaed Sees Programs a Sane 201! 25-6 - 20) ‘i Probab a Sata POT a5 Time allowed: 2 hours. hee Answer ALL questions in ORDER. Start each question on a NEW pag Question (1 1) A three-digit number is formed at random from the following set of numbers: {2,3,5,8,9} without repetition (i.e. the number contains three different digits) a) What is the probability that the number is even? b) What is the probability that the number is divisible by 5? 2) Three machines A, B and C produce respectively 50%, 30% and 20% of the total number of items ina factory. The percentages of defective output of these machines are 3%, 2% and 6% respectively. a) Ifan item js selected at random, find the probability that it is defective. b) Ifthe item is defective, what is the probability that it was produced by machine A? 3) An instructor gave his class a set of 10 problems and told them that the final exam will consist of a random selection of 5 of them. If a student knows the correct answers of only 7 of these problems, what is the probability that, on the actual exam, he will answer: a) Exactly 3 problems correctly? b) At least 4 of the 5 problems correctly? Question (2) 1) The probability density function for some random variable Xis given by: poya [272% 98451 a) = 0 otherwise a) Obtain the related cumulative distribution function (cdf) b) Use the obtained cdf to compute P(X < 0.5), PLY < 0.5 | ¥> 0.25). 2) The range of the discrete random variable is (1,2,3,4). The probability mass function of X is givenby: —f(x)= kx Determine the value of & and the mean of X. 3) A player of a videogame is confronted with a series of opponents and has an 80% probability of defeating each one. Success with any opponent is independent of previous encounters. The player continues to contest opponents until defeated by one of them, a) What is the probability mass function of the number of opponents contested in a game until the player is defeated? b) What is the probability that a player defeats at least two opponents in a game? c) Suppose that 5 players play the same game (each player is independent of the others). What is the probability that exactly three players defeat at least two opponents in a game? Page 1 of 4 Question (3): The time between calls to a corporate office is exponentially distributed with a mean of 10 minutes. a). Write down the pdf of the random variable X denoting the time between calls in this problem. »b) What is the probability that it takes longer than half an hour for a call to arrive? ¢) Determine x such that the probability that it takes more ‘than x minutes for a call to arrive is 0.15 2) The thickness of an aircraft component is uniformly distributed between 9 and 10.5 millimeters. a) Determine the cumulative distribution function of the thickness of the component. 'b) Determine the proportion of components that exceed 10.2 millimeters. ¢) Determine the mean and variance of the component's thickness, 3) The diameter of a thin copper wire is normally distributed with a mean of 0.5mm and a standard deviation of 0.02 mm. a) What is the probability that diameter of the wire exceeds 0.45 mm? b) What is the probability that the diameter is between 0.45 and 0.55 mm? ¢) If three wires are purchased of this type and they are assumed to be chosen independently. \what is the probability that all three have diameters exceeding 0.45 mm? ‘Question (4): ) The joint probability mass function of the two random variables Vand Vis given in the table below: Nox! 0 1 2 y oS lo a 1/8 0 in Lvs {1/4 oO | iz 0 0 va} Determine the following: a) Marginal probability distributions of each of the two random variables ¥ and ¥. by P(X <0.5, ¥< 1.5) <) PUY 1) d) PLY >0,¥<2) e) Calculate the covariance between X and Y. 2) The joint probability density function of the two random variables and Y'is given by: [4x0 jo O1 600302 000313 O.AN032S 90337 [33 oon3s0 c.000362 9.000376 0.000390 o.60404 0.000819 000434 0.000850 aan0s67 —nopDHKS £22 cionnso1 n.900St9.0oNs38 0.000887 6.000877 0.00088 O.G00619L.OOUGE! OODLES _HNPEHKT TRI coor! 0.000736 000762 9.0007%9 000816 0.0008ES A000 0.00050 0000935 v.000H6% Tho donne! ONS “LOmI07 0.901107 G.0I144 OODIIRS 0.601223 0.001204 BENIN nOnLYSO 29° 0061385 hOOLSét LOUI4RD LOUIS38 G.NOISKD 0.001681 0901098 0.601750 . GnuIKOT BuGINHG 28 001526 nUINBR 1602082 OOURTIK —a.mNDI86 0.002286 0002527 B.o02s01 BOmETT_aonasss 27 1002635 0.002718 142803 0.002890 012980 0.003072 0.003167 0.00324 0.005364 0.003467 {in3873 Mon368] 14003793 0.003907 .E0S02S OOOKTAS 0.004269 LOOKING 004827 e.aDHEG: ODE799 .onss4 —CAHSOKS OISZ34 —0.0USHKS O.00$583 0.0703 uCOsRHS 0.006037 0.006210 DUWMINT NBEO LATS LOUKBET OUTED OTRAS OO7SAY LOOTTHD T7976 wO08198 DOOD OUNNAS® 0.008894 0018137 0.009387 vGnR64? 0.009903 GOIUI70 HUIOKAE 0.010724 Dolio: GOlT3O$ GOI16 —aOTTBIE 0.012224 OUIRSES OOIZKTA v.013209 OISSSS_ a013403 001262 0018429 0.015003 0015386 0.015778 OUIGITT O.O16SKE 0170030017829 LITRE 20 a0189 HOIRTER 0019226 0.019699 0.020182 OURHE7S _aORII7K oOII692 Gozz2I6 H42278 TS Gors29s 1023882 024419 on2490R On25SRR 0.026190 ORS 1.027429 0023067 0.028717 18 00n9979 0030084 0.030742 0031443 0.022157 003284 0.033625 0.034379 0.038148 4455920 =17 0036727 0.037538 0034364 "0.039208 0.040059 0.040029 O.o4IRIS 0.012716 C.083633 OOHsES 16 WOsSS14 0046479 0.017860 0.088457 0.04947! 0080503 0.051881 BaS2616 0.053699 _OSEI99 S15 0055917 "057059." s.0se208' 0059380 "0.060871 .a6i70. G.06300R . caakass 0.065522 cn66807 =14 aoikli2 oo%0437 n.070781 ou7RI4s 0.073529 OOTHEIA 0076359 O.UTTADE aaT9270. o.oKUTS? H 13 082264 0083795: 0.085543. CO569IS OOSRSOR 0.0912 _C.0917S9 o.oNB4I8' o09509S HONCHO) 12 0098825. 0100273 U.02042 0.103835 0.108680 UAOTABS GIOIA VANI233 GtISIAd_ ISITO FLA 0117023 0119000" 9.121001 0.123024 0.126072 0.127143 0.129238 0.131387 | 0133500. DI38666 210. 0137887 0140071 0144572 0.146889 4149170 OISISUS U1SSK64 CISORHE 1886! 09. 0.161087 0.103843 (198528 0.171056 078609 O.1781KS 0 7NT¥S -OUAIETO.188U60 Tak 1186733 0.189830 OIN2IS0 U.195N4 019762 0.200454 0.203269 0 20610 DUAYT H.2tIKSS M07 a214t64 0317695 9226680 6223627 0226627 U.z2H—S 0.232698 0235762 O23HKS2 UDINE “06 02ss07 ogee2s2 0251429 U284627 1257946 U26IOND 0264147 .26T6_—NIIOT 0.271251 Stis) 0277595 o2W09s7 © 0.284539 U2STIAY 029160 1264599 0.299056 OSOTSH2 n308N26 0.30K5N Ho 0312067 031S614 O3I917K 03227SK 0.326355 0526569 0333508 0.337243 0340803 0344578 $03 U34HB6Y 0351973 9.355601 0.339424 0363169 0.366928 0370700 0.374484 0378281 0.342089 02 0385908 O3N979Y O3995HO 0397H32 OATIISE AANSIGS a409046 0412836 416834 _042CTAD OT 0824655 0424576 2432505 O4N6EAT OA4ODKD 0444330 0.4HDNY 0457242 | 0.456205 0.450172 ‘Uu Gaosi4d OAHhI19 0472097 _047607E 040061 0484087 0.488053 0492022 _O4NK011 U.se0000 Page 3 of 4 Table MM Cumnalnive z 0 o1 02 03 oa 03 06 a7 0.00 ‘.s00008) o.s3ve2s ose ostT¥tt 0.685422, 1.691462 0.684930 6.903199, wins 9.964070 ogTi28s 0.977280 982136 0.986097 0939275 sors 9.993740 0.995339 0.996833 0.997445 0998 0.998680 0.999032 6.999313 0.399817 0.998663 0.999767 0.993841 0.999892 0.999528 0.999952 nm 1.303989, 343798 0.383166 us2i719 9.639007 1994974 0.729089 O76 138 0.791030 360800 osnon60 0.904902 0.920730 o9usa7s 4946301 9 956367 0.90452 9.971933 ognrTss 9.982571 986847 0.989556 9.992024 (0.993063 0.995473 1.996636" 0497523, 9.998133, gases 0.999065 0.999336 o.99v533 0.999675, 9.999776 0.999847 0.999895 0.999931 0.999984 bar Ne 0.02 507978 o47758 387064 04628516 0.662757 0.998468 0732371 0.764238, 0.793802 oszi2is 0.546136 u.soseas 0.888767 1.906582 ogsT2gs 0.965621 0972571 0978308 0.982997 0.986791 0.989830 ogs2240 0.994132 19998608 0.996736 0.997599 ogge2s0 0.998736 9.999096 0.999359 0.999880, 0.999687 0.999784 0.999855, 0.999900, 9.999033, 0.999956 03 OS11967 038i717 o701vs4 0.738683 0767308 0.796731 ON2a813, osssays GisT0782 1.890651 0.908231 0.923641 9.936992 vos 958185 0.966375, 0.993197 0978822 0.983414 0.987126 0.990097 0.992451 0.994297 0.998731 1.990833, 0.997673 0.998308 0.998777 0.999126 ‘0999381 0.999866 0.999698 0.999792 0.999858 0.999904 0.999936 0.999958 5 Distrhaiom (eoaied) 0.04 005 (0.515953 0.519939 0388760 0.559618 10594835 0.598706 (0.633072 0.636831 0.670031 0.673645, 0.708801 0.708840 o7gevi4 0.742154 0.770350 0.773373, (0.799546 0.802338, (0.826391 US28948 8508300853141 oars? ONTH928 0.892512 0894350 909477 0.911992 9.925066 0.926471 0.938220 0939429 (0.949497 0.950529 0959071 0.959041 967116 0.967843 og73e10 0.978832 0.979325 0979818 o.9s3823 0.988222 (0.987455. 0987776 (0.990358 0.990613, 0.992656 0.992857 0.994457 0.994614 o.99s%s3 0.995975, 0.996928 0.997020 og97744 0.997814, 0998359 vy98st 998817 0.998856 0.999155 v999184 0.999402 0.999423 o.gwsss! 0.999596 0.999709 0.999720, 0.999400 0.999807 0.999864 0.999869 0.999908 0.999912 (0.999938 0.999941 0.499959 0.999961 Page 4 of 4 06: (0832022 0563559 0.602868, 0.640876 0677242 0.712260, 0.745373, 0.7763 0.808106 ags1472 85542 0876076 896165 1308s 0.927855 0.940629 uysiss3 1.960796 41 968587 0.975002 0.980301 oostos 0.988089 0.990863, 0.993083 0.994766 0.990083 9.997110 0.997882 0.998462 0.998893, 0.999211 o.9yoas3 0.999610 9.999730, 0.999815 0.999874 osg99is o.999043, 0.999963, ‘a7 0.527003 0.567495 0.606820, 0.644309 0.680822 0.715661, 0748871 0.770350 ‘o.so7ssv 0.833917 0.357690 6.978999) o.xo7958, 0.914657 0929219, 941792 ‘952540 961636 0.96258 0.978881 o9so774 0.984997 0.988395 0.991106 0.993244 ogsaois 0.996207 os97197 0.997948 uggs} 0.998930, 0.999238 0.999462 99624 o.g997s0 0.999821 0.999879 0.999918 999946 99964 APPENDICA ws 31881 os7iaaa 0.610261, 0.548027 0.684386 0.719083 751748 0782305 os10870 os36i57 0.359929 o.xsu00 0.399727 0.916207 0.930563 0942947 93382) 0.962462 0.969946 976k 0.981237 (0.985371 0.588696 0.991344 0.993431 0.995060, 0.996319 0.997282 998012 0.998559 0.998965 0.999264 9.99981 0.999638 0.999749 0.999828 0.990883 oyso22 0.990948 0.999965 0.535856 0378345, 014092 0.681732 0.687933 0722408 0.754003 0.788238 0.813267 os3e913 0862143 0.962977 0.901475 0.917736 og3isss osisz083 0.954886 0.963273 970021 0.976705 ogsteot 0.985738 0.988989 991376 9.993613, 9.995201 0.996427 (0.997365 9.998078 ‘0998605 0.998999 0.990289 11999499 0.999680 0.999788 0.999835 0.999888 0.999925 9.999980 0999967 Alexandria University Faculty of Engineering Specialized Scientific Programs ~ 25-6-2N Electric Circuits II - CC202 Time allowed: Two Hours June , 2011 ‘Answer the following questions 1.a) A series RLC circuit has R= 2Q, resonance frequency = 50000 rad/see and bandwidth = 2000 rad/see. uulate the values of C and L ind the half power frequencies. b) Find the transfer function H()=V,/V; for the circuits shown. Sketch the magnitude of H(@) and determine the cutoff frequency . Show the type of the filter 2R c sw 7 vi 32R aRZ Yo 2. Evaluate V,/Vi in the op amp circuit shown. 60K aM Ska Page 1 of 2 3. For the shown circuit , find the Thevenin’s equivalent circuit between a,b and evaluate the current through the resistor 20 Q 5a. JQ 102 2 202 10193 © 58.0 4. Find the current (0) for i, ()=4 u(t) +28 (0) A. 1.0, iw) wa 1H s 5. Given Vs(t)= 10+ 6. Find the admittance and impedance parameters for shown two port network . 6a 22. Page 2 of 2 Examiner: Prof. Dr. Nour Elin Hassan Ismail Hyyaisuyh deal Alexandria University Faculty of Engineering agi 4S Specialized Scientific Programs demas Sybed eal gd January 2011 20.0 is Digital Logic circuits I 14a) Aili shy) Glebe? + a3) ‘Time allowed: Two hours. YOU HAVE TO USE THE ANSWER SHEET ON PAGE 5 pol ada le aan Goth gb Daley) Sl feo}. lr 0 gy Unda ptt! lle JF Ff t answer for each of the Use the table shown on vour answer sheet, then chooses one correct ii, iii, None Tollowing sentences, and mark a sign on the corresponding column: i, [50 points} Read the following then answer the questions from 1 to 13 F(A.B.C,D)=4BD+ABCD+AC 1 oF for ABCD =.. . . i,0110 ii, 1100 iii, 1011 2, F=1 for ABCD =... i, 1000 ii,0111 Either i or ii 3. F=0 for ABCD= eee i, 1010 ii, 1001 iii, Bither i or ii FL FH seceeeeeeeeeee anaes i ¥(.3.6.7,8.10.12) a Ye 6, 7,8, 11,12) iii, (4.12) 3. OF... i > 7,10,12)+ D,d(2,6,8) ii, [](,4.5.9.11.13.14.15) iii, Either j or ii ABD+ABCD+AC is i, Minimum SOP form 7. A minimum SOP form for F is i. FeiBD+ABCD+AC i, F=ABD+ACD+AC iii, Either i or ii A POS form for F i eee . iii, POS form iii, Bither i or ii 9 en i (A+BD+CD\(A+C) i, + D)A+B+T )A+O) iii, Either i or ii 10, SOP form for F could be realized using . Gates i, AND-OR ii, NOR-NOR iii, Bither i or ii 11. POS form for F could be realized using seseee Gates i, AND-OR ii, NAND-NAND iii, Bither i or ii 12. POS form for F could be realized using Gates. i, OR-AND ii, NOR-NOR iii, Either i or ii 13, SOP form for F could be realized using ...........:.1..- Gates. Pagelof 5 NAND-NAND Answer the 14, (AB+ABC i, BA+O) 15, (AB+ABC i. (AB+AB)(AB+C) ii ABHC 16. B+ CO) i Bac 17. (BIA+ C)) =... i, B+(A+C) 18. 4(B + €) +AC i, (4+B + @)(&+c) (A+B + C)(a+c) 19. AC+AB+BC Fo. - BC+ABC+ABC+ABC ABC+ABC+ABC+ABC+ABC+ABC 20. AC+AB+BC fect 7 i RBC+ABC+ABC+ABC+ ABC+ABC ii, AC+AB 21. AC+AB+BC . a i ABC+ABC+ABC+ABC ii, AC+BC+ABC 22. Minimum SOP for AC+AB+BC =... i, ABC+ABC+ABC+ABC ii, ABC+ABC+ABC+ABC+ABC+ABC ii, AC+AB 23, Minimum SOP for AC+AB+BC =..... ii, AC+BC+ABC 24. ABCD+ABCD -..... ABCD+ABCD+ABD ABD 25. (A+B+C)(A+E+D) = i (a+t+B)(A+C+D) ii, (A+€+BD) 26. (A+B+CD)=... cocssesseeesseseenes i. (A+B+cv)(a+a, ii, (a+B+c )(a+B+D) 27. AB(A+B)= i 28. AB(A+B) = i. Either i or ii iii, Either a orb iii, Bither a or b Sither a or b iii, iii, Either a or b iii, AB iii. Either i or ii iii, Either i or ii Either i or ii iii, Either i or fi iii, Either i ori iii, AB(A+B) Page2of 5 emnmeenwrweewwes eS SF PS PS eS ee ee se i 0 ii. iii, (A+B) Consider the following FOUR Karaugh-maps then answer the questions ffom 29 038 A A NAB cD 00_01 BC\_o_-1_ #4 Bi oft [i 00 of oolt [x [x |! ol #1 ol Li oftoetoti 0 |o x{x]o[x 1 [oe x11 [olx a fi ii, BC+BC+AB iii, A+AC ili, Either i or ii i. Either i or ii i, AC+AC+AB . BC +BC+AB i 32. A minimum SOP form for W= oo... : is i, AC+AC+AB ii, BC +BC iii, Either i or ii 33. A SOP form for ¥ =... . i C+AB ii, C+AB+AB iii, Either i or ii A minimum SOP form for Y = ve i, C+AB ii, C+AB+AB iii, Either i or ii 3. A SOP form for Z = . . wane ¢p+AC+ABC+ABD+ABD+ABCD C+ABC+ABD+ABCD+ABCD iii, Either i ori SOP form for Z fesse €+ABC+ABD+ABD+ABCD ii, Either i or ii ABC+ABD+ABCD+ABCD i i B+ac iii, Either jo 38. A minimum SOP form for Z i B+AC iii, Either j or ii Consider the following combinational logic circuits. the decoder and the multiplexer, then answer the questions from 39 to 50 (The truth table for the decoder is given on the table below) 39. GI and G2 ate vessssesceesessseeeee 1 Ao | wo i. Inverters 0 0 1 0 ii, AND-gates iii, Either i or if oot 0 1 0 0 40. G1 and G2 are... Be 1 0 o 0 1 6 i, XNOR-gates ol oo o 1 ii, OR-gates iii. Either i or ii Truth Table forthe decoder 41. G1 and G2 are Secrest i. NOR-gates ii, NAND-gates iii, Either i or ii 42, GT and G2 are ...seceeessceeeeeesssses Respectively i. Inverter and AND-gate ii, OR-gate and AND-gate iii, AND-gate and OR-gate 4B. GB IS covceeseesceee . i, Inverter ii, AND-gate iii, Either i or ii FAL GB AS eee eeseeeee eee i, XNOR-gate ii, OR-gate iii, Either i or ii 45. G38 cescccseeres Page30f 5 ee ee ee ee ee ee ee ee ii, NAND-gate Either ior ii i,_NOR-gate AL AQ G2 2 Decoder (G1 may have one input or it may have any number of the same input) G1 Gl = G1 H w2 wo wi RB 1 ao MUX Fo—3 R42 y nt jo Cc Multiplexer (C=1,D=1,£=0,and F=0 are 4-input data to MUX) fot 46. The decoder has .. i. Active-high = 0. and 47AE. te) i 0 i, 0 =0. then G= 48.12 A= Land B= 1, then G = e ii. 49.1f A= 0. and B= 1. then G = 7 ii. 30. If A= 1, and B = 0, then G = ii, Othman seeeeee Output ii, Active-low eae iii, Either i or ii iii, x (don't care) iii, x (don't care) iii, x (don't care) iii, x (don't care) YOU HAVE TO USE THE ANSWER, SHEET ON PAGE 5 Pagedof 5 pa ssn = Ajai) Reale Husigh AS Hewat yaad! gal al Alexandria University Faculty of Engineering Specialized Scientific Programs June 2011 al Logie eireuits I p ne allowed: Two hours, ‘Answer sheet VB yh cols le Leal gill pb Jury St py of ale By yl ni gle Ute! at a + y Cad la) aul : (Prog. No.) GU yal aby L non Sentence) i | No. 36 i L 27 23 | | a, 29 | 30 | [ems epe2 33 34 | 8 om Ze == ea 10 { 35 I ul 12 13 36 L 37 asm ae 40 41 a2 s B zl = 44 45 21 46 ee jeseeza 47 23 48 24 a” D 25 350 Le PageSof 5 | \ Alexandria University Faculty of Engineering Specialized Scientific Programs June 2011 Hyysiseayl Analy Raabe Kyte gay Ted) Ase ‘Course title: Data Structuers ‘Time allowed: 2 hour Student ID: Student Name: 2ZF-b-2ol| a1 | @2 | 03 | o4 Os | Total 20 15 15 10 25 80 % ATTEMPT ALL THE FOLLOWING QUESTIONS ion 1 (20 point: Consider the non-binary tree on the right for ALL parts ofthis question. (A)[5 marks] Draw a binary tree representation (B) [5 marks] What is the order of visiting the nodes in a breadth-first traversal? (©[S marks] What is the order of visiting the nodes in a pre-order depth-first traversal?” (D)[5 marks] What is the order of visiting the nodes in a post-order depth-first traversal? Question 2 (15 points) For the max-heap on the right: (A)[S marks] Show this max-heap in an array representation (B) [5 marks] Insert 21 to the array representation of the max-heap. Show your steps. (C)[S marks] Pop the maximum value from the tree representation of the max-heap. Show your steps. Question 3 (15 points): For the graph on the right: (A)[5 marks] Write the degree of each node beside it (B) [10 marks] Find a minimum spanning tree. What is its cost? Question 4 (10 points): For the graph on the right: (A) [10 marks] Find a topological sort. esti i For the binary search tree on the right: (A) [5 marks] What is the height of the tree? (B) [5 marks] What is the order of visiting the nodes in an in-order traversal? (©) [5 marks] Show the final binary search tree that would result if you insert the following numbers into an empty BST: 64, 60, 92, 62, 25, 16, 43, 13, 69, 72,99, 44, 39, 46, 37. (D) {5 marks] Write a function that prints the numbers in the tree in a descending order. (B) [5 marks] Write a function that counts the even numbers in a binary tree. eweweeeeeeeeeweeeBtege@ #2 =| = Alexandria University Spring 2011 Faculty of Engineering Programming-2 Specialized Scientific Programs Final Exam Computer &L Communication Engineering Saturday 18" June, 2011 Time Aliowed: 2hrs. Answer All Questions. Total is 45/40. Question 1 (12 pts) Create a Fraction class that performs standard mathematical operations of a fraction. The class should have the following capabilities: + Constructor that prevents a 0 denominator in a fraction, reduces (simplifies) a fraction, and avoids negative denominators + Overloads the addition and division operators (Handles division by zero and print an error message) + Overloads the relational (<) and equality (==) operators + Overloads the stream insertion operator (<<) (This must handle fractions with numerator equal 0 and the denominator equal 1) class Fraction { public: Fraction( int num = 0, int den = 1); void Set( int num, int den ); Fraction operator+( const Fraction & ); You write I bool operator==( const Fraction & ) const; You write < friend ostream Soperator<<( ostream & const Fraction & ); private: int numerator, denominator; void Reduce(void); % Formulas: Addition: ni/dt + n2/d2 = ((n1 *d2) + (a4 * m2) / (a4 * d2) Division: ni/dt / n2id2 = (n1 * d2)/ (1 * n2) 1/3 Question 2 (10 pts) Write a class Pet that contains the following information about a pet (as private data members): + name ~ string, age — integer or floating point, type of pet (dog, cat, etc.) ~ char or an enumeration of your creating, and + color — string or enumeration The class should have the following public functions: + Constructor — should take the above data as parameters + Destructor — clean-up any resources that were allocated (if any) + Get() functions - return the above information (separate function for each data member). Note - these should be const functions * Print () — prints out the contents of a pet object in organized, human readable form Write a main function that prompts the user for the number of pets they will input and allocates a dynamic array for the pets, then collects the information about each pet and store it. Question 3 (8 pts) Extend the Pet class that you created in Q2 by using inheritance. Create a Dog class which inherit from the Pet class using public inheritance, You will need to change the private class members to protected in Q2 — Why would you wantineed to do this? ‘A Dog needs the following attributes: * Inherit from the Pet class: name, age, type of pet, and color + Type of dog ~ collie, German Shepard, etc. + Dog tag # + Any other interesting attribute/characteristic Provide the following member functions: * Abasic constructor that sets each data member to some default values. * Redefine the Print( function. Call the Pet's Print() from within the Dog's Print0) 2/3 eeeeeeeeeeee@ee@te este ee SS SS = uestion 4 (15 pts} Consider the following code segments class Animal{ class Horse: public Animal{ protected: int age; string name; public: pubii Horse(String n):Animal(n){ Animalistring n) { age = 0; name = n; } } Void sieep() { virtual void eat() { eat(); cout << name <<" is eating .."<run(); Animal* a= new Horse(“petzi’);a->run(); Horse h; heat(); OORONa a) Whatis the output of the foll Horse* h = new Horse(“pony h>sleep(); b) What is the output of the code snippet in (b) when virtual keyword of the class Horse gets removed? c) What is the output of the code snippet in (b) when virtual keyword of both classes; Animal and Horse gets removed? 4) The behavior of a virtual destructor is similar to that of any virtual function. Why would anyone need to implement a virtual destructor? (i.e. Does it serve any purpose to have a virtual destructor, as opposed to having a regular, non-virtual destructor?) ing code snippet? Best Wishes r. Sahar Mohamed Ghanem 3/3 “a a eee ee 1 i t i I q Alexandria University SSP Faculty of Engineering Specialized Scientific Programs yy June 2011 Course title/Number: Systems Programming Time allowed: 2 hours time allowed: 2 ours nswer All Questions | Al Question 1 (20 Marks) Consider the following sequence of symbol defining statements that starts at location 33 (hex). 0033 LENGTH RESW 1 BUFFER —RESB 4096 BUFEND EQU < MAXLEN EQU BUFEND-BUFFER a. Give the value and type (absolute or relative) of each symbol b. For each of the following expressions, decide whether it is valid or invalid, For valid expressions, give its value and type (absolute or relative). 1, BUFFER+4095 BUFFER+LENGTH-MAXLEN BUFFER-MAXLEN 2*MAXLEN-1 up Question 2 (10 Marks) ‘a. Consider the SIC/XE assembler, could the assembler decide for itself which instructions need to be assembled using extended format? Explain your answer. b. What is the difference between loading, linking, and relocation? ¢. Explain how a relocation technique could be implemented for the standard SIC machine Hint: the standard SIC machine does not use relative addressing. Exam Committee: Dr. Nagia M, Ghanem aa) Alexandria University SSP A yseuy) Haale Faculty of Engineering 3 | Aaasigh 46 Specialized Scientific Programs x Keadial Sted eal June 2011 Course title Number: systems Programming Time allowed: 2 hours ‘Question 3 (20 Marks) ‘Assume PROGA, PROGB are two separately assembled programs, each of which consists of a single control section. Each program contains a list of items (LISTA and LISTB); the ends of these lists are marked by the labels ENDA and ENDB. The labels on the beginnings and ends of the lists are external symbols, 0000 +PROGA START 0 EXT LISTA, ENDA EXTREF LISTB, ENDB 0030 LDA LISTA+4 0033 +LDT —- LISTB+ENDA-LISTA 0040 LISTA £QU * }00SA ENDA EQU * 005A WORD -_ ENDA-LISTA+LISTB 00sD WORD —- ENDB-LISTB+LISTA END 9000 PROGB START 0 EXTDEF LISTB, ENDB LISTA, ENDA | 0040 +LDA © LISTA+4 00: +LDT —- LISTB+ENDA-LIST: | 0060 LISTB EQU * 0079 NDB EQU * 0079 WORD - ENDA~LISTA+LISTB 007¢ REF2 WORD © ENDB-LISTB+LISTA END fa, Show the object code and the modification records (if any) generated by the assembler for the instructions i, LDA and LDT in PROGA ii, LDA and LDT in PROGB b. Show the object code and the modification records (if any) generated by the assembler for i, REF1 and REF2 in PROGA ii, REF] and REF2 in PROGB Exam Committee: Dr. Nagia M, Ghanem = Alexandria University Ay jaisuy) dada, Faculty of Engineering EWanIE CS Specialized Scientific Programs Mey Frewadial dyad! gal yl) June 2011 Sen BE - Jor SVN see Digital Logic circuits IT TAS) Ail 3 gal) ole le Gait ime allowed: Two hours Answer sheet iyi oda le UB Laced! Ghull gb GREY Sl Ba J ode Bylo UY! sella pal : (Prog. No.) gabiza! aby Chooses one correct answer for each sentence, and mark a sign on the corresponding column: i, none, Sentence No. | i | ii | iii _| none Ex. x | [Sentence] i | ii | none Sentence | i | it 19 Alexandria University Ay jas) dead Faculty of Engineering Aig) IS Specialized Scientific Programs Rena Aye gal June 2011 20a Digital Logie circuits I Ti id at Sth semester ‘Time allowed: Two hours. ela ll Saal hela 1 oi! YOU HAVE TO USE THE ANSWER SHEET ON PAGE 1 sida) ola gle Ub Laas gold ob Gd Ube! Sl fia MEW Dy Ania plan! IE YS Qe CE Use the table shown on your answer sheet, then chooses one correct answer for each of the following sentences, and mark a sign on the corresponding column: i, ii, iti, None [20 points} For a 3-bit binary counter that counts in the sequence AB = 00, 01, 11 and repeat 00, ..., Answer the items from 1 to 3. 1. The Karnaugh map for the next state, A’, is... ii. iii, 2. The Karnaugh map for i, B A 0 1 3. The state transition table is Fi PS NS 00 01 o1 1 100 - Ti, 10 PS 00 o1 10 W NS o1 WW 00 00 iii PS 00 01 10 it NS 01 u 00 10 Page2of 9 For a sequential network, the karnaugh maps for the next states are given below. Answer the items from 4 to 21 A A A o 1 o 4 ool BC BC BC . oof i To oof ttt 00 [0 To o1 - ofa - ati yt - w{_- [4 uf- | 0 | uf_- [| o- i 1of 1 | 0 wld [4 iol i | o | AT By ¢ 4, IfT Flip-flops are used, then the Karnaugh map for T, is i. ii, A A A o 1 oo1 ool BO\ Gir BC BC oo[1 To oof 1 | 0 ool 1 To | ofa - afi] - ofa | - 1 (SaaS uj = | o nf 10[ 1 [o 1ofo [i wfli to} Ta Ta Ta 5. If T Flip-flops are used, then the Karnaugh map for Tp is ... i. i, A A o 1 0 BC BC ool a [1 00 [1 ] orf 1 = olf 1 | uf ai u[-- ilo fo lol 1 Tp Ts Ts 6. If T Flip-flops are used, then the Karnaugh map for Te is i. ii, A A oot 0 1 BC BC i" oo[-0 [0 00 [0 i ofa [- o1 [_o- : ul. [To nl 1of1 [To io[1 Te 7. IfD Flip-flops are used, then Da = i D, =A'+C ii, DD, =A'+BC iii, Bither i or i 8. IfD Flip-flops are used, then Dy = i Dy =C'+BIC Page3of 9 ii Dy =AC+BC 9, IED Flip-flops are used, then De = i Dea’ iii, Either i or ii ii, Dg=A'sB'C’ iii, Bither i or it 10. If S-R Flip-flops are used, then the Karnaugh maps for Sq and Ra are ... i. ii, iii, A A A oot Oat Oneal BC BC BC zi (el oof i [0 00, aap ofa | ofa [- O].| sates [Ee uj [o ni. [= uf. 0 woffa [- lol - | 0 ptr es a Sa Sa A A 0 1 0 1 BC BC oo[o [0 oofo 74 oilo | - oo | - u[-- [a uL- [o ilo [0 wlo {i Ra Ra 11. If S-R Flip-flops are used, then the Karnaugh maps for Sand Rp are ..... i. ii, iti A A A o 1 oot o 1 BC BC BC cc oof i] - 00 [i afta - afi - ott uf - | 0 uj{_- | 0 ites told [a tol 1 | - wl 0 | 0 Sp Sp Sa A A A Oe o ol o 1} BC BC BC oo [0 [0 oo[-o0 [0 ool oT 0 ato | - oifo | - oif-o [- nf-tt uf. a ul. [o | woo [0 wf o [0 wf i {4 Rs Ra Re 12. IfJ-K Flip-flops are used, then J, = i 0 it 1 iii, A" 13, If J-K Flip-flops are used, then Ka ct iii, AC’ 14, If -K Flip-flops are used, then Jp, i At BIC'+BIC 15, If.-K Flip-flops are used, then Ky = ectosestenessss ic ii, C iii, BC Pagedof 9 i, BY oe) i. i. 16, If J-K Flip-flops are used, then Jc = 17. If -K Flip-flops are used, then Ke = ii, A'B eA 18. If S-R Flip-flops are used, then the Karnaugh maps for Sc and Re are . i ii, if, iii, A'B+A'C ii, B ili, A A A 0 1 0 1 0 1 BC BC BC 00 00 00 [ ol ol ol i i 10 10 A A 0 1 0 1 BC BC BC 00 0 Cea oL- T= | o1 : ol = o1| 0 i 0 Wy - Wi] - ft 10 0 10|_0 1 wi 3 Re Re ii, 19. The sequential network has the following state transition table Ps_| NS ps_| NS | NS_| ooo | i 000 _| 110 00 | 110 | oo1_| 010 oor | it oor | 11 oro | 1 oro | ut o1o | it ou | --- ou | --- ou] --- 100 | 11 100_| 000 100_| 010 101_| 10 lol | --- lor | --- 110_| --- 110_| 010 110 _| 010 11 | 100 11} 100 11 | 100 20. The sequential network is i, A counter that counts the sequence 111, 100, 010, and repeat 111. ii, Moore type 21. The sequential network is ... i, Mealy Type iii, either i or ii iii. either i or ii PageSof 9 Itis required to design a sequence detector that has one input X, and one output Z. Z=1 if X= O11 or X = 1011. Consider the state table shown in table 1, and the following state graphs for network1, network2, and network3, then answer items from 22 to 34 Table 1: state table Network 1 22. The state table shown in table 1 corresponds to network ..........- il ii.2 iii. 3 23. For an input sequence = 10011011, and initial state A, the output sequence for network 1 is 0001001 i, 000010001 24, For an input sequence = 10011011, and B ii, C iii, 000010010 ial state A, the first next state for network 1 is ii, D 25, Starting at initial state A, and after receiving the input sequence = 10011011, the present state for network | is finally i B ii, C iii, D Pagesof 9 26. For network 1, given the shown input sequence, X, and initial state A, consider the signal Y. the signal Y is. x CLK the output of the network 1, and there is one false output the output of the network 1, and there is no false outputs . iii, not the output for network 1. 27. The type of the network i i. Mealy . Moore iii, Either i or ii 28. Without any state reduction, network | is implemented using flip-flops. il ii.2 iii, 3 29. The state table shown in table 1 is reduced to a minimum number of states. The reduced state table (without using the implication chart) is ii iii PS NS Zi PS NS Zz » Either i or ii x-0 | X=1 | X=0 | X=1 x=0[xX=1 | xX-0| X=1 y Wis Se Bo ee adel BL) B-|.B | Di} 0 | 0 Bofep |. [205] ec0t Ge) eB (eer. 0.:| <0) CB ec (C5140. 0) Das|cBe eC} |ueOe: |. 1 DEER |Get 26. 1 30. If network1is reduced to a less number of states, then it yields to network ....... ie ii 3 iii. either i or ii 31. If network]is reduced toa minimum number of states, then it yields to network ...... i 2 ii3 iii, either ior ii 32. The sequence detector is netWork .......ssssssssssssssesee iy ved ii,3 iii cither i or ii 33. By applying guidelines 1 and 2 for state assignement, ................. is set of adjacent states, i (BE) ii, (B,D) iii, either ior ii 34, By applying guidelines 1 and 2 for state assignement, . 8,0) ii, (C,D) iii, either i or ii is set of adjacent states. PageTof 9 Consider the following implication chart, and then answer the items from 35 to 40 35... are equivalent states = AE ii. D,G pi x | x | x i. and ii, ..+, are equivalent states EE y i BFL AVE 7 2 FL xX [A ic and ii 5 Gl x A iii, 5 38, The minimum number of states is ii, 3 iii, 2 39. The minimum number of flip-flops is ve i 6 ii, 5 iii, 4 40. The minimum number of flip-flops is ........ i 5 ii, 2 iii, 1 Consider the following state table, and then Present, Next State) answer the items from 41 to 43 Sue met i 41. if the state table is reduced to a minimum BO[LA > number of states. The minimum number of [—@ - B States = oo - ats i 1 ii, 2 42. The reduced state table is PS NS Z [ x-0 | x=1 | x-0 | x1 ay-/Bf]-ft BtA;|B|{i]o iii, Either ior ii 43. The minimum number of flip-flops is i 3 iii, 1 A sequence detector has input sequence X and one output Z. Z = 1 iff the input sequence is odd. Consider the following state graphs for networks A, B , and C. Then answer the items from 44 to 50. Page8of 9 Network B Network A 4, The corresponding state graph (Moore type) is that for network i iA ii, B 45. The corresponding state graph (Moore type) is that for network ...... aes) ic 46. The corresponding state graph (Mealy type) is that for network iA ii, B 47. The corresponding state graph (Mealy type) is that for network . 1 7B ii.C . Bither i or ii 48. If the network examines every successives three inputs. The network resets every three inputs. The corresponding state graph is that for network ..... i. 4A ii,B iii, either i or ii 49. If the network examines every successives three inputs. The network resets every three inputs. The corresponding state graph is that for network ........ iB ic iii, either ior ii 50. To implement network C using a minimum number of flip-flops, use the following assignment for SO and $ i, $0=00, $1 either i or it ii. SO=01, $1 =00 Examiner D,. Yoha Othman Page9of 9 19- b—20 Alexandria University Faculty of Engineering ‘Computer and Communication program June 2011 Computer Architecture Time: 2 hours Final exam ‘Name: group: 1D: ‘Attempt all questions ‘Question One (57 points): Choose the correct answer (correct the false statement(s) for TRUE/FALSE questions) 1 When a word is loaded from main memory, adjacent words are loaded into the cache line. (Spatial locality — temporal locality) says that these adjacent bytes are likely to be used. A common example is the processing of elements in an array. 2+ WAR (Write After Read) hazards do not occur with the classic five-stage pipeline, (true-false) 3+ All data hazards between instructions can be resolved with forwarding (no stalls are needed). (true-false) 4+ Setting the MemWrite control signal to | permanently may result in incorrect execution (i.e, the result produced will be incorrect) of MIPS programs. (true-false) 3+ Pipelining reduces the time taken to execute a single instruction. (true-False) n operation for sw instruction, (true-false) 6- ‘The ALU performs add 7- The immediate field of addi $s0, $50, 0xD000 instruction after going through the sign-extend unit becomes 0xFFFFD000. (true-false) 8- When a cache write hit occurs, the written data are also updated in the memory. This is the write-through policy. (true-false) 9- A snooping coherence protocol is more scalable than @ directory coherence protocol. (true-false) 10-In.a cache block with 4 words, numbered 0 to 3, assume two processors PO and PI use the block. If PO and P1 both access word 0 and PO writes that word, P1’s next access will be a miss. This is known as a false sharing miss. (true-false) 11- Which one of the following types of hazards can be reduced by register renaming? RAW hazards WAR hazards Control hazards Structural hazards All of the above 12+In a directory based system, a write request must go the home nede unless the cache has it in state. a. Shared or Modified or Invalid b. Shard or Modified ©. Modified d. Modified or Invalid 13- If. program executes I instructions in 5 seconds on a 2 GHz processor, which one of the following describes the CPI for this program? Show your steps to get the marks, a. 10 * Leycles per instruction b. 2.5 * Leycles per instruction ¢. 10* 10% cycles per instruction d. 2.5 * 10%I cycles per instruction 14- Which MIPS instruction(s) should set MemRead control signal to 1? a. lw b. wand lui c. Iwand sw d,_ hw, beg, and bne e. hwandj 15- Suppose you want to achieve a speedup of 70 with 100 processors. What fraction of the original computation can be sequential? Show your steps to get the marks. 0.2% 0.3% 0.4% 0.5% 0.6% seoge For questions 16-19, assume a write-through, direet-mapped eache with 16 cache blocks and each block is 16 bytes. The address is 32 bits. (Show your steps to get the marks). 16-How many bits are used for tag and index? Tag = 26 bits, Index = 4 bits. a b, 8 bits c 4 bits, Index = 4 bits 4 6 bits, Index = 8 bits None of the above 17-For the memory address 260 (in decimal), what are the values (in decimal) for tag and index? a. Tag =, Index=0 Tag = 0, Index Tag = 16, Index = 0 Tag = 10, Index = 0 None of the above 18- What is the total number of bits required to implement the cache? 153 bits 2448 bits 2464 bits 2496 bits ‘None of the above eaege 19- What is the total number of cache misses for the following address reference stream (all are reads)? 4, 16, 0, 12, 4 a. b cs a e. None of the above 20- Assume two processors A and B. B's frequency is twice that of A, and B's operating voltage is half of A. Everything else about these two processors are the same. What is the power output of B? a. half of A's power output b. twice that of A's power output c. the same as A's power output d. 4 times as much of A's power output 21- What is the maximum number of R-format instructions that can be supported in the MIPS instruction format? a 8 b. 16 32 a. 64 e. None of the above (3 points) Why do we need a dirty bit for write-back caches? b. (3 points) Define the terms "structural hazard" in the context of pipelines. cc. (5 points) Suppose that you have analyzed a benchmark that runs on your company’s processor. This processor runs at SUOMItz and has the following characteristics: Instruction Type Frequency (%) Cycles Arithmetic and logical 40 1 Load and Store 30 2 Branches 20 1 Floating Point 10 12 What is the CPI of this processor running this benchmark? jon thr oints ‘9 points) Consider executing the following code on the pipelined datapath: add $1, $2, $3 add $4, $5, $6 add $7, $8, $9 add $10, $11, $12 add $13, $14, $13 1. During the fifth eyele of execution, which general-purpose registers are being read and which general-purpose register will be written? 2. During the fifth cycle of execution, what else is happening? b. (7 points) Forwarding unit is a 6-input, 2-ouput circuit. 1. Is the circuit sequential or combinational? 2, Fill in the blanks in the table showing the missing input to the circuit and the number of bits for each input and each output. Input ‘Number [Output [Number of bits of bits IDIEX RegisterRs 5 ForwardA |? 2 2 ForwardB |? EX/MEMRegisterRd |? | 2 2 2 2 ‘Question four (16 points) ‘a. G points) Why is a directory coherence protocol considered more scalable than a snooping coherence protocol? b. (4 points) In a cache coherent bus-based shared-memory multiprocessor, explain what steps happen when a processor is snooping the bus and has a tag match on a read miss for a dirty cache. ¢. (9 points) Consider the snoop-based protocol discussed in class. For processors PO. PI. and P2. fill in the state for a cache block in each of the processors below for each of the given memory operations, where (1), (S) and (E) means Invalid , Shared and _ Exclusive respectivel [Operations PO | Pi [P2. initial st ar PO: writes B P2: reads B PO: writes B PO: writeback B | PlireadsB | Pl: writesB | Good Luck Alexandria University F] Ajai} Faculty of Engineering F | a Specialized Scientific Programs a Radial Aube) al June 2011 Ss y ae igital Signal Processing Ay 5 GY) Ages 6th semester ask a jal) Sua ‘Time allowed: Two hours. Clelu2 Gast 20 ~ 6 - Dol ANSWER THE FOLLOWING QUESTIONS: 1. A discrete time system is described by the digital transfer function: Paz H(z) a. Discuss the stability of this system. ». Find the difference equation describing the system. . What is the impulse response of this system. 4. Discuss the stability regarding the impulse response and find that it coincides with the result obtained in (a). 2. Obtain the direct form II and cascade structures for the following IIR filter. via) =2y(n—1)~£y(n-2) + (0) + 4a(u1) 3. Obtain the direct form and lattice structures for the following FIR filter: 13 3 1 s 2 x(nty + 3x(n-2) + 1 x(a), y(n) = x(n) + cv x(n-1) + : ‘x(n-2) 7 x(n-3). 4. Using the bilinear transformation method, design a second order IR Low-Pass digital filter having a cut off frequency of 8Khz and a sampling frequency of 20Khz. 5. Design an IIR digital filter using the Impulse Invariance method starting by a prototype: H(s)==—4 S+58+6 The sampling frequency = 10 Hz. 6. Design an IIR digital filter using the Step Invariance method starting by a prototype: 0.5(s +4) s? +3542 ‘The sampling frequency = 10 Hz. H(s)= GOOD LUCK University of Alexandria 23-6 - oll Faculty of Engineering Department of Computer and Communication Analysis and Design of Algorithms C731 Final exam Time: 2 hours June-2011 Answer only Five questions (each answer equally weighted; 10 marks) Qi) (i) Rank the following functions by ascending order of growth rate; that is, find an arrangement g1; 92,93... of the functions satisfying: 91 = 0(92), g2 = 0(g3), ... State if any of the functions is a © of another one. 5 3" sn, 3, SP 15,2" mlog(n),log.vn),10", V7 log n) Pr +5 19 recurrent relations: T(n) = 4T(n/2) +n? T(n) = T(n/2) +01 T(n) = 37(n/2) + @(n) T(n) = 2T(n-1)+O(1) Q2) (W) You are given an array of n integers, each integer is in the range [-5,100]. Give a O(n) algorithm for sorting this array. Does that contradict with the statement " no comparison based sorting algorithm can do better than O(n*log(n))"? Why? (ii) Describe and analyze a divide and conquer algorithm that uses “"Memoization" to compute Fibonacci (n). (iil) What are the 0-1 knapsack and fractional knapsack problem? Explain whether or not Dynamic Programming and greedy techniques would be applicable for computing the optimal solutions for these two problems. Give examples to clarify your argument. (NO ALGORITHMS are required). Q3) Write a pseudo code description for Huffman encoding. Use the alphabet frequency distribution shown below to trace the behavior of the algorithm: Ef H eS If the following text string "AEECEEFDEE" is encoded using fixed number of bits, how many bits are required? What is the length of the same string in bits using the Huffman Encoding? Compute the compression ratio for that string. Q4) The Levenshtein distance between two strings is defined as the minimum number of edits needed to transform one string into the other, with the allowable edit operations being insertion, deletion, or substitution of a single character. Analyze (state the time complexity) and design an algorithm that computes this distance (edit problem): 1. Divide and conquer technique 2. Dynamic programming technique Use the following two strings "Saturday" and "Sunday" to trace the behavior of the algorithm. 5: 9 Given different types of coins, we need to be able to represent a given amount in different ways. For example, using a coin system D={1, 4, 6} one can represent a change of 8 cents as 8 = 6+1+1, which takes 3 coins (Greedy Algorithm) or 8=4+4 (Optimal solution with 2 coins). 1, Design a greedy algorithm to yield the number of coins required for representing any given amount , what Is the time complexity of that algorithm? Give an example where the greedy succeeds in finding the optimal solution. 2. Design a dynamic programming algorithm to count the number of distinct ways a given change of cents can be represented. This can be done as follows: recursively define the value of the optimal solution as w.if <0, 1, cup = ieee in{C(- 1,)), 1+ C(4j-DW))}.f f21 where C(i,j) is the smallest number of coins used to make change for amount j using only coins D,,D2, ..D,. Complete the following table (the last raw) and formulate an algorithm that finds the number of minimal coins and state Its time complexity. 6) (i) What is the difference between deterministic and non deterministic finite state machines? (ii) What is meant by "A Problem xX is polynomially reducible to Problem Y"? Give an example. (iii) What is meant by NP complete? Give an example. (iv) Is the following FSA deterministic or not? alphabet S = {0, 1} states Q = {4o, q:} initial state dy accepting states F = {qy} Describe and analyze (state the time complexity) an algorithm to Implement it. Which of the following strings are accepted and which are not: 0110, 0, 1, 0110111, and 01. Can you expect what regular language it accepts? (v)_ What is meant by un-decidable problems? Cod La | | University of Alexandria CC373:Operating Systems Faculty of Engineering Final Exam- 2011 Computers and Communications, Exam Duration: 2 hours Special Programs. ef Answer All questions. Exam is 6 pages + answer sheet. Record your answers in answer sheet, ATTACH answer sheet to answer copybook. For each question select the best answer. For questions where multiple selections can be true, it will be indicated in the question, 1-The kernel keeps track of the state of each task by using a data structure called _ a- Process control block b- User control block ¢- Memory control block d- None of the above 2. Saving the state of the old process and loading the saved state of the new process is called a-Context Switch b-State Switch Multi programming d-None of the above 3-Which technique was introduced because a single job could not keep both the CPU and the /O devices busy? a-SPOOLing Virtualization ¢-Multiprogramming 4-The operating system of a computer serves as a software interface between the user and the . a-Hardware -Peripheral c-Memory d-Screen S-In the blocked state: a- the processes waiting for I/O are found b-the process which is running is found ‘c-the processes waiting for the processor are found d-none of the above CPU scheduling: 6-FIFO scheduling is a-Preemptive Scheduling b-Non Preemptive Scheduling Deadline Scheduling 4-Pair share scheduling 17 7-Round robin scheduling is essentially the preemptive version of a-FIFO b-Shortest job first ¢-Shortest remaining time first d-Longest time first e-None of the above Answer questions 8 to 12 when considering the following table of arriving processes: Process | Arrival Time | CPU burst (msec) PI 0 3 PZ 1 5 D3. 2 05 P43 a, 8-Using Shortest Process First scheduling, which of the following order of execution is tue: a-PI,P2,P3,P4 b-P2,P3,P1,P4 c-PLP3,P4,P2 4-P3,P1,P2,P4 e-P4,P3,P2,P1 £None of the above 9-Using Shortest Remaining Time first, which of the following is true: a-P1 finishes before P2 and P3 b-P2 finishes before P1 and P3 €-P3 finishes before P 1 and P2 10-For the above processes, average waiting time from Shortest Process First scheduling is that of Shortest Remaining Time First scheduling a-Higher than b-Lower than ¢-Equal to 11-For the above processes, average waiting time for Highest Response Ratio next scheduling is .. that of Shortest Process First: a-Higher than b-Lower than c-Equal to 12-For the above processes, average turn around time for Shortest Remaining Time first scheduling is. . that of Shortest Remaining Time first: a-Higher than b-Lower than c-Equal to 13-Shortest Remaining time first scheduling is a: a-Preemptive scheduling b-Non-Preemptive scheduling 14-Highest Response Ratio Next is a: a-Preemptive scheduling _b-Non-Preemptive scheduling 15-The algorithm that is the best to prevent starvation of processes: a- Shortest Process First. ‘b- Shortest Remaining Time First c- Highest Response Ratio Next 2n . 16-The algorithm that is the most biased to interactive processes is: a- Shortest Process First. b- Shortest Remaining Time First c- Highest Response Ratio Next Concurrent Programming: 17-Two threads are competing to write on a shared variable. The shared variable is called: a> Mutual exclusion b- Critical section Answer questions 18 to 22 on the following codes that were designed to handle competence between two threads on a shared variable: Code 1: favored=0 initial setting) | Thread 10 ‘Thread 2() | Cwhile(tdone) { while(!done) {favore, {favored=2 while(favored==2); while(favored==1); Jlaccess shared variable Naccess shared variable | favored0 favored=0 yb _ = ae Code 2: Tiwantstoenter=false (initial setting)- ‘F2wantstoenter=false (initial setting) Thread 10 Thread 20 { while(!done) { while(!done) | {Twantstoenter=true {T2wantstoenter=true while(T2wantstoenter); while(Tlwantstoenter); access shared variable Hlaccess shared variable Tiwantstoenter=false ‘T2wantstoenter=false bb —_| (initial setting) Tiwantstoenter=false (initial setting) ‘T2wantstoenter=false (initial setting) Thread 10 ‘Thread 20 { while(!done) { while(Idone) | (Tiwantstoenter=tue; {T2wantstoenter=true | while(T2wantstoenter && while(Tlwantstoenter && | favored—=2); favored=1); Vaccess shared variable access shared variable Tiwantstoenterfalse; ‘T2wantstoenter=false favored=2; favored=1; » Bb 37 Code 4: favored=1 1 setting) Tiwantstoenter=false setting) ‘T2wantstoenter=false setting) Thread 1() ‘Thread 20 { af while(!done) while(!done) {Tlwantstoenter=true; {T2wantstoenter=true favored=2; favored=1; while(T2wantstoenter && while(Twantstoenter &8& favored==2); favored==1); /access shared variable /access shared variable Tlwantstoenter=false; ‘T2wantstoenter=false } 3 i } 18-Codes that guarantee mutual exclusion: (select all correct answers) aCode1 b-Code2 c-Code3 d-Code4 —_e- None of the codes 19-Codes that guarantee mutual exclusion efficiently (i.e. do not have problems) (select all correct answers): a- Code 1 b- Code2 e Code 3 d Code 4 e- None of the codes 20-A code that guarantees mutual exclusion but has a deadlock problem is: (elect all correct answers): a Code 1 b- Code 2 & Code3 d- Code 4 e- None of the codes 21-A code that guarantees mutual exclusion but has a lockstep synchronization problem is: (select all correct answers): a- Code 1 b- Code 2 c Code 3 d- Code 4 e- None of the codes 22-In code 1, if the Jast statement in each thread’s code (ie. “favored=0") is removed, Itresults in: a- No mutual exclusion is guaranteed. b- Mutual Exclusion guaranteed with no problems c- Mutual Exclusion guaranteed with a deadlock problem 4- Mutual Exclusion guaranteed with a lockstep synchronization problem €- Mutual Exclusion guaranteed with a starvation problem 47 Meme It: 23-Compaction makes......... memory usage compared to Coalescing alessefficient _b-more efficient c-Similar 24-Coalescing is of a.........time overhead compared to compaction a-Lower b-Higher Similar 25-Increasing the size of a block in fixed size partitioning: a-ncreases the level of multiprogramming b-Decreases the level of multiprogramming ¢-Does not affect the level of multiprogramming 26-, allocates the largest hole available in the memory, a- Best Fit b-Worst Fit c-First Fit d-None of the above Given memory partition of 100K,500K,200K,300K. and 600K (in order), and we want to place processes of 212k,417k,112k,and 426k(in order) in memory, answer questions 27 and 28: 27-All processes requests will be satisfied when using: a-BestFit b-Worst Fit c-First Fit da! and'b’ are true evbland'c' aretrue fa! and'c'aretrue —_g'a', "b! and’'c' are true 28-The process that cannot find a slot to be placed in memory in some or all of the placement strategies is: a-212k b-417k e-112k d-426k e- None of the requests meet this criterion (all requests are satisfied in all strategies) 29- Virtual memory is 5 a- An extremely large main memory b-An extremely large secondary memory c-An illusion of extremely large main memory 4-A type of memory used only in super computers. 30-Pages are .........size blocks a- Fixed b- Variable 31-Segments are.......size blocks a- Fixed b- Variable 32-Coneatenation of a block number and displacement is done in. calculations. a- Segmentation b- Paging ¢- Both segmentation and paging S/T 33-The virtual page number in paging is mapped to: aA page address in real memory b-A page number is real memory ¢-Both page number and page address in real memory d-none of the above 34-The virtual segment number in segmentation is mapped to: a-A segment number in real memory b-A segment number in real memory ¢-Both segment number and segment address in real memory d-none of the above Disk scheduling: 35-Shortest Seek Time First disk scheduling is .. compared to First Come First served disk scheduling a- More fair b- Less fair c Of similar faimess .. 10 incoming requests Given that track numbers range between 0 and 199, and the head is at track 60, and incoming requests are to access track numbers 20, 50, 10, 100, 5 (in order), answer the following: 36-Using the SCAN disk scheduling (assume moving towards larger track numbers first) the following is true: (select all right answers) a request at track 20 is served before request at track 50 b- request at track 50 is served before request at track 20 c- request at track 5 is served before request at track 20 d- request at track 20 is served before request at track 5 €& request at track 100 is served before request at track 20 £ request at track 20 is served before request at track 100 37-Using the Shortest Seek Time First disk scheduling (assume moving towards larger track numbers first) the following is true: (select all right answers) a- request at track 20 is served before request at track 50 b- request at track 50 is served before request at track 20 © request at track 5 is served before request at track 20 d- request at track 20 is served before request at track 5 € request at track 100 is served before request at track 20 £ request at track 20 is served before request at track 100 67 ATTACH to answer copybook Answer Sheet: please shade all area of selections for each question, as shown in the example below: question | a] b| c| d|e| f ‘Shade only one selection or shade more than one only 100) when multiple selections can be true, and will be 300 indicated in question Now shade your answers for each question in the following table: question | al b[ cl dle] fg 1 Alexandria University Agia) Anal Faculty of Engineering Auasigll Als. Specialized Scientific Programs Ananda yc ged yl - DD $) Rdn\ Control Systems CC 361 ee ‘Time allowed: 2 Hours — Answer the following questions : 1. The feedback schematic diagram of a feedback control system using a D. C . motor is Shown in fig (1), if Ks=1,K=9,Rm=0.1,Rs =0.15,Km=Kb=1,fm=0,5 a- Find the transfer function Oe (s)/Or(s). b- Find the steady state error if Or (t) is a unit step function . 2. Draw a signal flow graph for the system of fig (2), then find the transfer function C(S)/R(S),and E(S)/R(S)- Fig Fig? 3. A proportional plus integral plus derivative controller is used in the control system Shown in fig(3).For a=8 and b=10 A Using the Routh Hurwitz method determine the range of K for stability . B— Determine the critical value of K and the corresponding frequency of oscillations. C— Find thesteady Stateyalue of error when the input is a unit ramp function and K = 5. Fig3 7 i Cs) K(a+2+s) |» GaGa > PID Controller 4. The block diagram of a servo control system is shown in fig (4) (a) For K= 10, determine the values of a and b to give an overshoot of 16 per cent for the unit step input , then find peak time , settling time, poles of closed loop system. (b) If the value of K is decreased slightly ,how does it affected the damping ratio of system (¢) If Kis varied from zero to infinity sketch the root locus of the system . Fig4 ) Rs) Amplifier | ___.} Motos aan gain K ast 5. Sketch the root locus for the unity feed back control system if G(S) = K(s*#28+10)/ 8° ‘Then find critical gain for stability , frequency of oscillations and Discuss stability.

You might also like