You are on page 1of 9
asses Mansoura University ‘Second Semester (April 2016) DB2 Faculty of Engineering (Thrid Grade) Midterm Exam Dept. of Computer Eng and Systems Time: 75 Mins (Q 1 A) List the most important criteria for selecting DBMS in your D.B application Q1—B) What are the differences between a system crash, soft crash, and Hard crash? (O 1- O) Transaction is a logical unit of work on a database may be (choose the correct answer){ (A) An entire ‘program - (B) A portion of a program —(C) A single command ~ (D) alll of the above ~ (E) Another definition (state it) } {Q.1- D) A commit statement means (choose the correst answer) "A. Signals successful completion of a transaction io the DBMS B. Frees any locks, to avoid another user from accessing the same data C. Makes all changes permanent and visible to other users D. Allofthe above (QI-B) For given database application assume that HW failure happen unfortunately (the last backup was one ‘month ago also the log file was stored at the same secondary storage of the DB) propose a solution for this situation? Explain your answer. {1-8 Specify how is the concurrency within your DB application can be achieved? (Q.1-G) Assume that you have a Schedule § with N Transaction T1,72.....« , and M operations, Drive an ‘mathematical equation that describe Find the relation of between M, N Q1-H) Draw a state diagram and discuss the typical states that a transaction goes through during execution. Q2-A) Consider the following sequence of log records for giving logging: sStart SI> _ <$2, A, 60,61> <72, A, 61,62 > 150,51: State the action of the DBMS for the previous logging, (Q 2-B) Consider the following five ransactions: 7 TR 73 co rsaes| 75 aaie a] Read Read 7B) Read) Read BAX)_| Real Read (8) eat (4) Bead (6) nd | Read (N) an vitens~2|7B-diwnd=a-|xedee frawer |i cotenN=W et “ i wre 0) | WRITE CEN | Wee ov) | rite (8) Write J ‘A) Write some of the different possiable schedules for the Transactions TITS BB) Suppose that the VO operations are performed in $ Unit time, and processing operation performed in | Unit ime, (I) calculate the percentage value of the enhancement in the execution time duc to the concurrent execution rather than serial execution. (II) Suppose the power failure was after 8 Unit time, Discuss the situation ef each ‘ansaction if you know that the period of the check time is 5 Unit time (IIT) Implement the locking mechanism to avoid the concurrent problem, then draw the precedence graph (IV) Analyze the graph resulted in (III) based on (Prevention, Avoidance and detection); [hint : assume that the time stamp for the five transactions is 3,5,8,9,16] Best wishes Prof Hesham Arafat SS ‘Mansoura Department: Computers Engineering | Faculty of University And Systems Engineering Total Marks: 90 Marks Course Title: Database 2 Course Code: CSE 3321 3° year Date: May , 26, 2016 (Second term) Allowed time: 3 rs No. of Pages: (2) Question No. (1)__(40 Marks) {Q1-A) [3 points] List the most important criteria for selecting DBMS in your D.B application’ {QL-B) [4 points] Let us design a database for Hospital, including information about patient and their record. Give an example of the transaction process. How it will be done (write a pseudo code), its Importance, and who is responsible ofthis process? {O1-C) [4 points] Draw a diagram that State transition diagram for transaction execution (Q1- D)I3 points} Specify the different types of DB failure, for cach type state (exactly or approximately) (8) Frequency of occurrence (ii) Recovery time, (ii) Recovery Responsibility (QI-E) [6 points] Next Figure shows a backup of a small database, and the Sal conaiita system log starting from the time of the eee ria coeaget backup and continuing until failure, The WiteTix? Sent write entries in the log consist of the Stan 72 Waite THC7 10 transaetion id, the data item being Wate 2B Wate A415; updated, the before image and the after Wie Tic Sun Ts image. If the failure in the previous Wate T2520 | Wate 25D 520 figure is a system failure what action is Commit T2 ee ae cia eae undo/redo recovery? What are the final Wierapot values of the four data items? Wate T3846 {(QI-F) [20 points} Consider the following three transaction histories: TI: Select avg(A).C, M form tableX; Update tableX. set C= C*1.1 T2: Update tableX. set B= “Prof” ; set A=A+2;, || 73 : Select B,C, N form tableX; Update tableX set Z= Z+2 ‘Suppose these transactions execute according to the following schedule: Ri(A) ; W2(B); Rs(C) ; Ra(C); Wa(A); Ro(B); Wa(C) 1), What is the operation(s) are missing in the previous schedule to be correct. ID) Rewrite the transactions (T1-T3) which describe the given schedule and complete Ill) Is this schedule serializable? If so, give its equivalent serial schedule. If not, describe the probletn TV) Assume that the transactions all follow the standard lock protocol: (+ Each transaction gets a shared lock on a block before reading it. - + Each transaction gets an exclusive lock on a block before writing it. + Each transaction releases all its locks after committing. Describe what happens when the above schedule gets executed. V) Assume that T1 is the oldest transaction, followed by T2 and Ts. The wait-die deadlock avoidance protocol rolls back any transaction that has to wait for an older one. If this protocol is applied to the above schedule, which transaction(s) get rolled back, and when? yucstion No. (2) (20 Marks} Q2-A) (2 P)Compare between security policy and socurity mechanism Q2- B) (2 P) tate the Two main security mechanisms at the DBMS level; give a suitable practical area for each, which of them can use encryption techniques for enhancing the security? Q2- © (2 P) Based on Authorizations concept in the database concept Q2- D)_(4 P) Complete the following statement ; The integrity subsystem is provided with a set of rules that ‘the following. ‘and, Q2-E) (8 P) Consider a relational database has the following schema { STUDENT [StwLID, Stud_name, Course_name, Course ID, Degree] , ATTANDENC [Stud 1D, Stud name, No_of attendance) } Multiple -granularity locking is used, with 8, X, 18, IX and SIX locks, For each of the following operations, indicate the sequence of lock requests that must be generated by a transiction that wants to eatty out (just) these operations 1) Thos ou, neproSTDUDENT) , 11) G course =scampuuinge STUDENT) \) G course Mathematics? (STUDENT) II) _ UPDATE STUDENT SET Degree = Degree * 10 Where A'TTANDENCE, No_of attendance > 8; IV) DELETE FROM STUDENT WHERE Degree< 50; juestion No. (3 Mari (Q3-A) [15 points] For the following sequence of actions of transactions Ty T2 and Ts (nB nAnC wic wBwiA ) Transactions Ti, Te and Ts initially arive at time {7* | No of variables 100, 200 and’ 300 respectively we make the following assumptions about timing: ~ A transaction requests the necessary lock shared lock for read and exclusive lock for write on a data item tight before its action on that item is issued. - Ia transaction ever gets all the locks it needs then instantaneously completes work commits and releases its locks. - If a transaction dies or is wounded it instantaneously gives up its locks, and restarts only afterall current transactions commit or abort. - When a lock is released, it is instantaneously given to any transaction waiting for it (in a first ~ come: first-serve manner). (I) If @ ‘waut-die strategy is used to handle Jock requests, in ‘what order do the transactions finally commit. (I) | If a wound-wait strategy is used to handle lock | requests, in what order do the transactions _Q3-B) (15 P) Consider the following schedule: alsfa/s|slalcfalalo| Bl] Spape|s faye |s|s| =|N TRANS Ti [ TRANS. 12 [TRANS 13 [TRANS “TRANS 76 [TANS Te [TRANS TT] ead &) x Red t Red = z tad Red Wie Decrensexbe2 “ wae = Upaiex Write) 1 Wie RadN age i te ‘te 8) esd Wate mi | L Wate ®) | @ Draw a dependency graph for the above transactions. Is the above schedule (conllict) serializable- why or why not? Gi) Can you move the Write(X) operation in T3 und place it in such a way that the above schedule can be converted to a serializable one? Show this movement (may show it on exam) and point out ‘what the equivalent serial schedule is (ii)This schedule is recoverable? YN (iliyThis schegule is cascadeless recoverable Y_-N (iv) If T1 commits first and T2 commits after that (ie., we change [c2; al] in above schedule to [c1; 2] would that schedule be recoverable? Why? = Best wishes Prof, Dr Hesham Arafat Mansours Univers iy Third year Feculty of Engincerin ey ae March 2016 Computers & Systems Dept * Time allosed + Howe Attempt he following problems: 1) Draw the following shapes. pe 2) Develop an applet that draw the following pear on the Applet's area. 3) Animate the following helicopter oy , i 1 i GOOD LUCK PROF Dit Aly EL Desokey COMPUTER GRAPHICS Maximum score 90 Third year Faculty of Engineering June 2015 Time allowed 3 Hours Mansoura University SF Computers & Systems Dept Attempt the following problems: 1) Using (Only) drawLine( ) method, write a java program to draw any nested shape based on the number of sides and rotating angle on the applet area. (10 mark) 2) Write a program to slide the following slides. | Slide one Slide two Slide three (15 mark) 3) Draw two moving circles as shown in the following figure. The two cireles animated in two different directions. (10 mark) 4) Develop an Applet that draws the following stars with different colors and rotate. (10 mark) 5) Draw the following face with animating eyes using 2D functions. (100,100) (15 mark) 6) Using Java2 to animate a moyable clown. (15 mark) 7) Using Java? to make an applet of a fighting helicopter controlled by the keyboard arrows. (15 marks) Good fuck Prof dr ALy El Des BIN y Ciluulaldusio aud - 5 ouaiall deal — Ausigh duis Te dy pall — doben Ca 5 — quilally pSag Salad Aiud) Jlac| — AY) 4 all [1-a] What is an embecided systems a microcontroller. some examples of them. And list criteria for choosing {1-b] Draw a complete cireuit diagram and writs a program to move forward on the first line of a serial LCD the following text " ... Survey The Treasure Inside You [{-c] Design a microcontroller circuit to control the traffic lights ( note Red light on for 50 Sec. , Yellow light on for 15 see, and Green light on for 40 Sec. ). [2-a] What does the following statements mean? ‘TRISB=0X05; TOCON=0XA5 [2-b] List steps of programming Timer0 in 16 bit mode. [2-c] Write a program to generate a time delay of 50 ms using timer® in 16-bit mode, with 1:4 presealer value. Assuming the microcontroller is operating with 10 MHz crystal, ealeulate the values to be loaded into the various registers. [FMROON| Tospir | Tocs | TOSE PsA__| Tors2 | Topsi | Torso Mansoura University Faculty of Engineering Computers & Automatic Control Dept. Course Title: Comp. Based Cont. Sys. (1) Course Code: CSE 3324 Year/Level : 3" year ‘Time : 2 Hours Date: 30/5 /2016 Total marks: 90 [1-a] What is an embedded systems 2, List their uni U1-b] Write short notes on : [12 marks ] Criteria for choosing microcontroller. Steps of programming a microcontroller. Input / Output Ports of the PICI8F458 - Sources of interrupts of the PIC18F458. jue character [8 marks } [1-c] A two-lines text-based LCD is connected fo PICLGRS4A microcontroiter in 4-bit data mode. Draw a complete circuit diagram and write a program to count from 20 to 0 on the first line , with one sec. delay , and then flashing four times the text " Computers and Control systems Eng. Dept. " on the second line , with 10 sec. delay [12 marks] [2-a] What does the following statements mean? [12 marks] TOCON=0XC4; INTCON=0XA0; ADCON0=0X85; [2-b] If we want to program timer0 in 16-bit mode, with 1:16 prescaler value to generate a time delay of 20 psec. Calculate only the values to be loaded into various registers, assume that the microcontroller is operating with 10 MHz crystal oscillator. [8 marks | [2-c] Design a complete circuit diagram to control the direction of rotation of a de motor using a s connected to pin 2 of port A , if it is pressed the motor rotates clockwise for S0 sec. , else it will votate connterclackwite for 34 see. - [13 marks | [3-a] Enumerate the Steps of programming : [10 marks ] ADC of PIC 18 series. Timer in 16 bit mode of PIC 18 series. [3-b] An MPXS11SA type pressure IC sensor is used to measure the ambient atmospheric pressure , one pin of the sensor is connected to the supply (+5V) , another piu to the ground , and the third pin is the analog output is connected to ANI of the PICI8F458 , the ambient atmospheric pressure will be read every ten see., the output voltage of the sensor is given by: V=0,0045P - 0.475 ‘Where P is the atmospheric pressure in Draw 2 complete cireuit diagram and write a program to display the ambient atmospheric pressure on two digits 7 segments display. 115 marks] je bars [TOCON | Timero Register — ; S. Tosait | ToCs “TOSE PSA ToPs2__| TOPS Interrupt Register a - cIE/GIEL | TMROIE inToie | RBIE Tro [INTO | ADCONO | ADCO Register a: __ - [_Abcso_[cHs2_ | cHSI cHSO__|_GO/DONE Tai) ADCON# | ADCi Register = Se} ‘ADFM__|_ADCS2 : = rcres pera] _Pcrei__| PcrGO | GOOD LUCK ‘Ass. Prof. Dr. M. S. M. ELKSASY i A NEE 2 I SSS Slagle) pb LUBY Jol bib auth quay 1 «Aas ay Millay Gaatband Laan Ualan) Cyl Slagle AB apap lad allay galls Sil -2. Rata) Aya cygiaall Gslladl Slagle Gaibead doy (ete i) ai-3 Sasiaal le J yaaily Apileally J pastls u5Sill Che Gye bial ge Gall Gye Eaagy psbA may! a3 Aaja A he bk a) 5 gg Spal Sagtee xB epi) LAY UGS peal aay -T Slag ay eat Sept) cag tet | —2 pA pana (4) pl ine ()) 1clblbans elgg ily sil -3 yg a8 Ulu aby Gis nade pa) 4 ig teaduill ABs ol Gas yp Meta bag abs GS. 2OUS Gist! Gulp yall path ate “5 cpliga padi, Leal oe Gly le clgle le apes Lab GAN alates nee O98 oF MED Sout wclkagheall plat ylas Katee! Iteditl Jalyall bid si} 1 PHD ua gate (od) Slagle! AUB dubas Gu (|) + bib 1-2 eeniplad) JS gb ARE pa Gang Lag Calta! Qanlt Lal Ladage cilagleall sb Glily gap Alanya Cpt] -3 Byes Ly cob Uae) Glaglae ABD pLARy GY) uum GLa Shs bbe peu 4 « Shaginal ll Asya cyte AS Raabe Jobe On GUS SIAN bs sail pally sup! elle GRAN age pil Lee Aine goth oI HRilpe Ligy gf dike! Gbytes Shika ghey Bh Jay shea pa) -2 Ligad ph culls Gathaads jolie | GLELEN Gatliad Lage UES tol asa) Lays Coll “3 Slagle gs ys pled Gb) Jalal bas aay) 4 Tall p1ah psd Upinalye Gay pill palin pale -5) cuaaltl Spall sgyA) RSSY Sabla Glagleall abi 6 (pass JS ay] “1 § VAY pos abs Galland pate -2 Sy Willy peal gsi Cum Ge Sb! Rasy Sache! plait etal ow Gd 3 yall RSS seat pL US) ules Yale 4 = Gash Ales ee

You might also like