You are on page 1of 45
a MPF eee eee eee eee le Faculty of Engineering Alexandria University ssP Computer and Communications Spring 2013 Analysis and Design of Algorithms Final Exam time: 2 hours Write the asymptotic recurrence equations that give the time T(n) taken by a call of DO(n), and solve these recurrence equations. procedure DO(n) ifn <1 then return for i= 1 to 8 do DO(n/2) for i= 1 ton do dummy <0 Given a sorted array A of n distinct integers. Design and prove correct an algorithm similar to binary search that finds an index i such that Ali] = i, or returns 0 if no such index exists Given the following numbers: 7, 14, 3, 11, 2, 1, 5, 13, 8, 16, 10, 4, 9, 15, 6, 12 in an array. Show in steps how the numbers are sorted by Quicksort, using the first clement of the partition as the pivot, aud explain the partitioning algorithm that, you apply. If you are given 10000 numbers. Mention the most efficient way that you would use to find the smallest ft numbers among them when: i)k=1 ii) k= 20 iit) k= 5000. What is the optimal-substructure property? When is dyna gramming used? Ilustrate your answer with an example. pro- Explain how to multiply two matrices using the divide-and-conquer paradigm. Illustrate your algorithm with an example, Write recursive formulas for the ruming time of your algorithm. Write pseudo-code for a recursive function to implement the depth- first-search algorithm in a connected graph. Prove that the edge with the largest weight on a cycle in a weighted graph cannot be on the minimum spanning tree of the graph. oe Oe oe ee ee ee ee ee ee ee ee ee ee oe ee ee ee et oe Alexandria University Ay uy daly Faculty of Engineering Hassigh As Specialized Scientific Programs Henan! Kata gall January 2013 2013 su Computer Architecture oases cc322 na Time: two hours Answer all questions: 1) (8 marks) For a direct-mapped cache 32 bit memory-byte address 256 blocks (lines) Block size 8 words Word is 2 bytes Find the total size of the cache in bits 2)8) ‘a-What is the op code for the R-type instruction, for Load, and Store, for Branch ? b-How many different functions are available within the R-type instruction ? c-Which of the three registers rs, rt, rd is always read ? 4-Which instruction types refer to memory locations? 3) (8) Referring to CPU overview : What is the use of the left adder? What is the use of the right adder? What is the use of ALU? Which instructions use the DATA memory? What is the instruction length? 48) For the following instruction: Beq A,C,63_ which means if Reg[A] = Reg{C] then [PC] € [PC] + 4+ Offset. Instruction [31:0] 000100 10011 00110 0000000000100000 ‘a- What is the opeode b- What is numbers of registers A, C c- If the instruction is located at the memory address 4000 (decimal), what is the 1/2 location of the next instruction if the branch is taken? d- repeat c- if the branch is not taken. 5) (10) a- How many registers this processor have? b- What is maximum size of the instruction memory? c- Who manages the transfers between registers and memory, memory and cache, memory and disk? 4- Define the block, miss rate, and miss penalty ¢- What is the advantage of having separate memories for the instructions and data. What is the disadvantage? 6) (8) a- Given two processors with the following features # ——cycletime ps CPI A 250 24 B 500 15 Which is faster, by how much? N.B. both have the same instruction set b- Given two programs 1, 2, with instructions in 3 classes A,B,C. as follows Class AB Cc IC for prog 1 2 1 2 IC for prog 2 fo CPI 1 2 3 Which program is faster? c- We are trying to reduce the time by 25% but this leads to an increase of 15% in the CPI. What clock rate should we have ‘' clock rate no. Instructions. Time 3GHz 20.00x 10°9 8 2/2 Good Luck re FST SE eee eee eee eee eee Alexandria University Assay deat Faculty of Engineering wd Hunsight ls Computer and Communication eMail 9 Ohya May 2013 Volt ile Course title: Microprocessor ARB Claleall Bis a pad Systems CCE421 Time allowed: 2 hour cola : Gast Question 1 a) How many address lines does the 8086 have? b) 2 d °) How many Data lines does the 8086 have? ‘What are the two units of the 8086 microprocessor? Why are buffers and latches needed for data, address and control bus? Draw the WRITE bus cycle of the 8086 microprocessor. Question 2 The following 8086 program is run : MOV AX,0A0S _ ;Immediate data 0A05 is moved into AX MOV BX,0200 _;Immediate data 0200 is moved into BX PUSH BX sBX register is pushed onto stack POP CX ;Contents from top of stack are moved into CX IN ALEE Input /O byte from port at location EE XCHG AH,AL Exchange the contents of AH and AL i- What are the contents of the AX,BX, and CX registers after the POP CX instruction is executed ? ii- The input port at I/O location EE provides input data equal to 44H. What are the contents of the AX register after the XCHG AH,AL instruction. Question 3 ) Complete the following statements: i) 8086/8088 microprocessor can implement .. ii) Each interrupt vector is stored in ......... bytes. iii) The interrupt vector of INT 60 is stored at address... Hex. iv) To return to the main program, each interrupt program is ended by ...... but the subroutine is ended by. by Consider Ax =BO79H, DX = OFFFH, instructions are performed in sequence PUSH DX PUSH AX POP AX POP DX i- Show the content of the stack after the ii- What are the final values of AX, DX and SP regi interrupt vectors. = 1000H, SP = 0100H, and the following (4Marks) Question 4 Identify the addressing modes in the instructions that follow, identifying the source and destination: i MOV AX,CX iis MOV AXEBH iii- MOV [SI,AX iv- MOV D1JS1] v- MOV [BX]+XYZ, CX vi- MOV [BX] [DI] +XYZ, AL Question 5 Consider AX = B079H, DX = OFFEH, SS = 1000H, SP = 0100H, and the following instructions are performed in sequence, PUSH DX PUSH AX POP DX POP AX Show the contents of the stack. What are the final values of AX, DX and SP registers? Question 6 a) How many bytes are there in the memory system shown in figure. b) What is the starting address of the 3" chip in Bank] of the memory system shown in figure. c) What is the last address of the 5" chip in Bank2 of the memory system. Agee Bankl University of Alexandria baw Faculty of Engineering S Department of Computer and Communication Data Base Time: 2 hours Final Exam 2013 All Questions are to be answered. Q1) [5 marks] Given the following relations : vehicle (vid, make, colour) Person (pid, name, address) Owner (pid, vid) : Write expressions in relational algebra to answer the following queries: i) List the names of persons who do not own any car. ii) List the names of persons who own only red Cars. Q2) [8marks] Find the 3NF decomposition of the relation scheme, R = {Faculty, Dean, Dept, Chairperson, Professor, Rank, Student} with the set of functional dependencies: F = {Faculty + Dean Department >Chairperson Professor +Rank,Chairperson Department — Faculty ‘Student -> Department, Faculty,Dean Dean Faculty Professor, Rank Department, Faculty} Q3) [6 marks] Consider the following relations with key underlined lives (person name, street, city) works (person_name, company_name, salary) located (company name, city) manages (person name, manager_name) Answer the following using SQL: i) Find the names and city of persons who work for manager named “Muhammad”. ii) Find the names of persons who live in the same city as the company they work for. iii) Ziad’s manager has changed. The new manager is Salma. iv) Maryam doesn’t work anymore. v) Create a view Alex (person_name, company_name, manager_name) of all people who work in Alexandria in ascending order of person name. Q4) [6 marks] Insert in a B-Tree of order 5 the sequence: <1, 7, 6, 2, 11, 4, 13, 10, 5, 19, 9, 18, 100, 3, 12, 14, 20, 21, 16>, then Delete 5 then 6. Illustrate neatly the structure of the tree. Q5) [4 marks] Consider an empty B+-tree with order n=4, insert the following record keys in the specified order: <80, 25, 69, 14, 58, 3, 47, 91, 36, 81>. Q6) [12 marks] i) What is meant by heuristic optimization? Discuss the main heuristics that are applied during query optimization. il) For the relations Emp(name, fname, address, dno) Dept(dno, dname, address) Are the following queries equivalent? fname, fname, address (6 dname= ‘Research’ (EMP XI Dept)) name, fname, address (Emp | (¢ dname="Research’)Dept)) Draw the query tree of each, in your opinion which of them is more optimal? il) Compare between serializable, View serializable Schedules, Conflict serializable and serial schedules iv) Explain the Two-Phase Locking Protocol. v) What is data replication in distributed systems, give examples when such replication is required? vi) Write brief notes about LDAP, Active Directory, Distinguished names; give examples. Good Luck LAA. Chchaty —_——— Page 2 —— - oe me oe oe ee ee ee ee ee ee oe ee ee ee ee ee ee ee ee om Alexandria Univer: Aya daly Faculty of Engineering Aaaigh Aas Comp. & Comm. Engineering C452: Multimedia Systems Saal dla al 3aLe Spring 2013 Tet aw Final Exam pull aT JUG Time: 2 hours Ciel :Sa5t) UAT g Guadall Awa Gali y True/False Questions: © Use the answer sheet to put your answer. {ill in the appropriate circle completely. + Ifmultiple circles are filled, the answer is wrong. + Ifno circle is filled, the answer is wrong even if it written elsewhere. + When implementing Huffman’s algorithm, the ascending priority queue should be stable; ‘e., elements with equal priority are deleted in the same order that they were inserted to the queue. Also, when descending the Huffman’s tree, use 0 when you move left and 1 when you move right. [Ipt] The equation, 0.670d, + 0.210d, + 0.140ds = 0.9807, is used while computing the three correction factors for the EBU specification such that if the gains of the three electron guns are multiplied by these values we get exactly the white point XYZ value at {Ipt] In halftone dithering, the use of a 2x2 dither matrix results in 5 inter }. [pt] There are 3 modes for JPEG lossy compression: Sequential, Progressive, and Hierarchical. |. [2pt] In JPEG compression, the result of the run length encoding on the matrix 99-10 1 1 0°00 10 30 1000 aA TSA oe 38 8 8 FM 8 Blisd.99,0,0.0,-D,6,00, D.C, -D. (3) D.C, 00 0 00 000 08 18 0 8 00 0000000 9. 1), ©, 0), (1, -2), (1, 0), (1, 19, (1, ), (1,2, (Ds B, 0) 1, -D, C1, , (1, 1s 6, 0), (Ls, CL, 1D, (7,0), (1, 1), 4,0), (1,1), (17, 0). [ipt] The outer boundary of the CIE chromaticity diagram is the spectral locus. [pt] In the JPEG bitstream, a restart symbol is inserted between each scan in order to recover from errors in communication. [pt] URI stands for Uniform Resource Identifier. [ipt] HTML is a language for publishing Hypermedia on the World Wide Web. [ipt] In XML context, DTD stands for Document Type Definition. D®OO®e 10. [pt] Binary images are called a 1-bit monochrome image since they contain no color. 11, [pt] IFY is the result ofa linear transform T of the input vector X in such a way that the components of Y are much less correlated, then Y can be coded more efficiently than X. 12, [Ipt] When an image is printed, the basic strategy of dithering is used. Dithering trades intensity resolution for temporal resolution to provide ability to print multi-level images on 2-level (-bit) printers. 13. [Ipt] Lossy compression yields a much higher compression ratio than that of lossless compression. 14, [Ipt] Many systems can make use of 8 bits of color information in producing a screen image whose pixel colors are represented as RGB. 15, [Ipt] Using blocks in JPEG compression has the effect of isolating each block from its neighboring context. This is why JPEG images look choppy (“blocky”) when a low compression ratio is specified by the user. 16. [Ip] In the demodulation of the SECAM signal, @ is retrieved by multiplying the chroma signal C by 2cos(Feet) and then applying a low pass filter. 17. [pt] The idea of the median-cut algorithm starts by sorting the B byte values and finding their median; then values smaller than the median are labeled with a “O” bit and values larger than the median are labeled with a “1” bit, 18, [Ipt] Out-of-gamut colors are not visible to humans. 19. [Ipt] JPEG is an image compression standard that was developed by the “Joint Photographic Experts Group”. 20. [2pt] In JPEG compression, when applying the zig-zag scan to the matrix Ota: ore 30-1000 0 00 O 0F 1000 9 2 2 2 O 8) the result is 99, -1, 1,0, 0,0, 1, -3,-1, 1,-2,0,0,0, 1,0, -1,-2, 00) 0 0:00 ao 0) 0 0.6 0 0 0 0 oo 0, 1,0, 0, 0, 1,0,-1, 0, 0,0, 0, 1, -1, 0,0, 0, 0,0, 1, 0,0, 0, 0, 0, 0,0, 1, 0, 0, 0, 0,0, 0,0, 0,0, 0, 0, 0, 0, 0,0, 0, 0,0. 21. [Ipt] XML syntax looks like HTML syntax, although it is much more strict. 22. [Ipt] An information source with alphabet consisting of two symbols has maximum entropy equal to 1 23. [Ipt] VHS video tape coding in North America use YIQ. 24. [Ipt] Any compression system performs better if it operates on individual symbols or samples rather than vectors or groups of samples. 25. [Ipt] Progressive JPEG delivers low quality versions ofthe image quickly, followed by higher quality passes. With successive approximation, all DCT coefficients are encoded simultaneously but their least significant bits (MSBs) first. 26. [Ipt] (R, B,G) = (1,1,1) = (CMY) D®OOO®@e 2 27. [2pt] The output of Huffinan’s algorithm that is to be input to the decoder of Lossless Predicti Coding with a predictor as f, = [#=+*4=3| is: SU, -5, SD, 15, -13, -6, 7. The output of the decoder would be: 27, 10, 5,1, 11. 28. [pt] Prior to sampling and AD conversion, a low-pass filter is used to filter the audio signal to remove unwanted frequencies. At the DA converter end, a band-pass filter is used after the DA circuit, 29. [2pt] The decoder of a three-level Hierarchical JPEG decompress the encoded low-resolution image F, using the same JPEG method as in the encoder to obtain f,. fis restored atthe intermediate resolution using f; = dz + E(f,), where is dy is the decoded intermediate difference image and E(f,) is the result of expanding f, and then interpolating to be of the same resolution as fo. 30. {Ipt] The commonly seen HTTP response status codes are 200 and 404. 31. [Ipt] NTSC, PAL, and SECAM video may be sent using composite video. 32. [Ipt] The entropy 7 of an information source S specifies the upper bound for the average number of bits to code each symbol in S. 33. [2pt] The encoder of a three-level Hierarchical JPEG reduces the resolution of the input image f by a factor of 2 in each dimension to obtain f2. Also, it reduces the resolution of the input image f by a factor of 4 in each dimension to obtain /,. fis encoded using any other JPEG method to obtain Fy. F, is decoded to obtain f,. f, is expanded and interpolated to be of the same resolution as fp, call it E(f,). Encode the difference d, = f, — E(f,) using any other JPEG method (e.g., Sequential, Progressive) to generate Dp. 34. [Ipt] While decoding PAL, the separation of ¥ is done through a low pass filter. 35. [Ipt] The entropy 7 of an information source with alphabet S = {s,,52,53,~»5n) and source probabilities {p;} is = — Diks pi loge mi. 36. [Ipt] The chroma subsampling scheme “4:1:1” subsamples horizontally by a factor of 4, 37. [Ipt] Progressive JPEG delivers low quality versions of the image quickly, followed by higher {quality passes. Spectral selection takes advantage of the “spectral” characteristics of the DCT. coefficients (lower AC components provide detail information). 38. [Ipt] Using LZW compression with an initial dictionary (1:S, 2:A, 3:B), the input ABABABABABAB woul be derive the dictionary to include the substring BAB with a code 9. 39. [Ipt] To shrink B into 2-bit range each, we could simply divide the B byte value by 64 and then truncate. 40. [Ipt] For audio, typical sampling rates are from 8 MHz to 48 MHz. This range is determined by the Nyquist theorem. 41. [Ipt] For a quantization accuracy of 6 bits per sample, the maximum absolute value Vis gets mapped 10 63, the minimum absolute value Vw gets mapped to 1, and the most negative signal, -Vrnac is mapped to -64. 42. [Ipt] If not enough video card memory is available to store an image, the data has to be shifted around in RAM for display. G®@OO®e 3 43. [pt] Output values for a midrise quantizer the midpoints iA~AV2, X (and another half for negative X values). 4, [pt] Differential Pulse Code Modulation increases the dynamic range of a signal. 45. {Ipt] Sampling means measuring the quantity we are interested in, usually at evenly-spaced intervals. 46. {2pt] An information source has an alphabet S = (s,, 52,53, 54} is encoded using run-length coding, ‘The codewords are 00, 01, 10, and 1 respectively. The run-length to unsigned integers with size 3 bits each. Ifthe source emits the data as $257525251545353535954515;5251515154848q , the run-length code would be (100,01), (010,00), (100,10), (011,00), (001,01), (011, 00), (011,11). 47. [Ipt] Multimedia courseware, including the slides used in class, is not a form of multimedia application since they do not contain video or sound effects. 48, [pt] The JPEG bitstream encodes the DC components of all the scans before starting to encode any AC components since DC components contain the luminance of the image. 49. [pt] Using LZW compression with an initial dictionary (1:8, 2:A, 3:B), the input ABABABABABAB would be compressed to 2, 3, 4, 6,5, 8. 50. [Ipt] The following codewords may be generated by a Huffiman’s algorithm: 1, 010, 011, 0011, 0010 51. [Ipt] In JPEG image compression, the image is divided into 8 x 8 blocks. The 2D DCT is applied to each block image /(,). The 2D DCT may be applied in parallel to the different image blocks. 52. [Ipt] In the YIQ color model, a gamma-corrected luminance signal is used. 53. (2pt] In Huffinan’s coding, an information source with symbol probabil have codeword of lengths of 3, 3, 2, respectively. 54, [Ipf] In component video, some interference between the luminance and chrominance signals is inevitable since color and intensity are wrapped into the same signal 55. [Ipt] The quantization noise is the difference between the actual value of the analog signal, for the particular sampling time, and the nearest quantization interval value. At most, this error can be as ‘much as one interval. 56. [Ipt] Using LZW compression with an initial dictionary (1:8, 2:A, 3:B), the input ABABABABABAB would be compressed to 6 codes. 57. [Ipt] Given an original image (x, y), we can define a difference image dx, y) by using the discrete version of the 2-D Laplacian operator as d(x, y) = I(x, y) = IOs, y~ 1) = IOs, y +1) = Get 1,9) = Ie= » 58. [Ipt] The peak-signal-to-noise ratio is used as a distortion measure to quantify the error resulting from a lossy multimedia compression. It is computed a5 20 log(tmax) ~ 20 log(MSE), where Xmax is the maximum value of a pixel and MSE is the mean square error of the compression algorithm. 59. [Ipt] When the dictionary gets filled in LZW compression, it needs to be flushed to have the least frequently used entries removed. 60. [pt] Two types of uniform scalar quantizers exist: a) Midrise quantizers have even number of output levels, and b) Midtread quantizers have odd number of output levels, including zero as one of them. 61. [pt] In vector quantization, the output of the decoder is the closest vector in the codebook to the input vector. .M/2, covering positive data 0.05, 0.15, 0.3, 0.5 would DOOO®e 4 62. [Ipt] If most information is accurately described by the first few components of a transformed vector, then the remaining components can be coarsely quantized, or even set to zero, with little signal distortion, which makes the rationale behind transform coding, 63. [Ipt] The main steps in JPEG compression are: 1) Transform RGB to YIQ or YUV and subsample color, 2) DCT on image blocks, 3) Zig-zag ordering, DPCM and run-length encoding, 4) Entropy coding, 100000000) 0 14 13 12 085 2 1o0000000\ /o o 0 0 9 000 10000000] {0 0 0 0 0000 3000000 0/;.)0 0 0 0 0 000 64. [3pt] The DCT of the matrix]? 8 8 9 9.9 8 Slis) 9 8 8 9 9 0 ol w 0000000! |o 0 0 0 o 000 100000000) \o 0 0 0 0000 10000000 0 0 0 0 000m 65. [pt] In JPEG compression, the DC and AC coefficients finally undergo an entropy coding step to gain a possible further compression. Each DPCM coded coefficient is represented by (SIZE, AMPLITUDE), where SIZE indicates how many bits are needed for representing the coefficient, and AMPLITUDE contains the actual bits. SIZE is Huffman coded since smaller SIZEs occur much more often, AMPLITUDE is not Huffiman coded. 66. [Ipt] For a CD audio quality, with a sampling rate of 44.1 kHz and 16 bits per sample, the ‘uncompressed data rate is 176.4 kbps. 67. (pt) Chroma subsampling 4:2:0 is used in JPEG. 68. [pt] In the CIELAB color model, luminance angl 69. [pt] The p-law in audio is used to develop a non-uniform quantization rule for sound: uniform ‘quantization of s (stimulus) gives finer resolution in r (response) at the quiet end. 70. [2pt] In Adaptive Huffman’s algorithm, using the "NEW" rule given in the tutorial, if the stream at time tis ABAADD, the codeword of A will be 1, B will be 001, and D will be 01. 71. [Bpt] If the DCT coefficients of a gray level 8x8 image block with pixel values 00 202 189 188 189 175 175 175) 1599 65 -12 # 1 2 8 5 200 203 198 198 189 192 178 175) (-16 3 2 0 0 -11 -2 3 203 200 200 195 200 187 185 175] [-12 6 11 -1 3 0 4 =2 200 200 200 200 197 187 187 187 “8 3 =4 2 2 -3 -5 2) ing 200 205 200 200 195 188 187 175|"* oo 200 ato 00 200 180 187 175 202 200 199 doo st ley ter 28 0 200 200200 180 165 107 0 oi”. ° 3 queized DCT cet woud be| 9 ¢ é 0 72. [Spt] The DCT of the vector (100, 0, 100, 0, 100, 2 7 5 He 0 =I =4h 3-100 4 1 -1 0 25303 3 1-13 5-2 4-2 2 30 0 0 ° 0 0 ° ° 0 0 0 ° 0 0 0 0, }, 100, 0) is (141, 25, 0, 30, 0, 45, 0, 12) G2@®O0®e s N 73. [Ipt] In JPEG compression, the DC and AC coefficients finally undergo an entropy coding step to gain a possible further compression. The run-length coded values are represented by (RUNLENGTH, VALUE), where VALUE is further represented by SIZE and AMPLITUDE. To save bits, RUNLENGTH and AMPLITUDE are allocated 4 bits each and squeezed into a single byte, which is Huffman coded. SIZE is not Huffiman coded. 74, [Ipt] In entropy coding during JPEG compression, the run-length coded values are represented by (RUNLENGTH, VALUE), where VALUE is further represented by SIZE and AMPLITUDE. To save bits, SIZE and AMPLITUDE are allocated 4 bits each and squeezed into a single byte. If the zero-run length exceeds 15, 4 bits are not enough to represent RUNLENGTH. A special code (15, 0) is used for Symbol!. In the worst case four consecutive (15, 0) extensions are needed before a normal terminating Symbol, whose RUNLENGTH will then complete the actual run-length, 75. [2pt] An information source has an alphabet S = (5, 52,3,4) is encoded using run-length coding. The codewords are 00, 01, 10, and 11 respectively. The run-length is limited to unsigned integers with size 3 bits each. Ifthe run-length code results in (011,00), (101,01), (011,10), (011, 00), (011,11) + (010,00), (001,10), the 13 symbol emitted by the source is 5. a eee ess ses i Alexandria University Faculty of Engineering : Computer and Communication Engincering Specialized Scientific Programs Embedded Systems Tune, 2013 Final Exam Time: two hours Name: ID: ‘Answer all questions ‘Question one: Choose the correct answer (28 marks) ‘What is the function of watchdog timer? a. It isan internal timer that resets the system if the software fails to operate properly. b. It is an internal timer that sets the system if the software fails to operate properly. . It is an external timer that resets the system if the software fails to operate properly. 4. None of the above. 2. A situation that occurs when a higher priority thread attempts to acquire a shared resource that is currently owned by a lower priority thread. a. priority inversion ¢. deadlock through . « b. deadlock through cyclic waiting d. none of the above 3. If MOSI pin of a master is connected to MOSI pin of a slave and the MISO pin from a master is connected to the MISO pin of a slave, then SPI is full-duplex. (true — false) 4. In which memory device do the instructions reside? (RAM, ROM, EEPROM) 5. Assume bounce of a switch ean occur maximum Sms on pressing and Sms during release. Debouncing circuit timing is 10ms. (true — false) 6. Power density metric is useful for thermal studies. (true ~ false) 7. Which of the following describes the RTOS design philosophy best a. Minimizing the response time b. Response within certain time period c. Maximize the throughput of the system d. Maximize the processor utilization 8. Power dissipation in an embedded system is data independent. (true ~ false) ‘The more stalls in a pipelined datapath, the more power dissipation . (true ~ false) 10. A single reference input ADC operated on 5 V power supply input to its circuit and gives an output of 0000 1000 when input is $0 mV, and 0000 1001 when input is 56.25 mV. It can measure maximum 2 16V c. Maximum cannot be determined with this information alone b. sv 4.32V 11. A patient monitoring system in an ICU (Intensive Care Unit) is (hard ~ soft) real time system. 12. ASICs are used in embedded systems. A key disadvantage of ASIC-based designs over microprocessor-based designs is: a, The per-unit cost of ASICs is extremely high, making them impractical for low-cost designs. b. High power - due to their higher clock speed, ASICs can use many times more power than Microprocessors. ¢. Non of the above 13. What is the meaning of nonmaskable interrupt? a. An interrupt that can be tumed off by the programmer. b. An interrupt which can never be turned off. c._ Non of the above. 14, Glitch can be reduced by using balanced paths. (true — false) 15. Clock gating increases switching activities. (true ~ false) uestion two: (7 marl 1.2 marks) It is required to count how many times a button -connected to an input pin- is pressed. How to configure ‘TCCRO to do that? 2. ($ marks) Assume that your microcontroller is clocked with 4 MHz and that it offers an 8-bit timer operating with this frequency. You want to use this timer to measure the duration between two external events. What bounds does this impose on the duration (i.e. find minimum and maximum interval). Question three: (14 marks : 1. (2 marks) Which bit is cleared automatically when an ISR is called? Bit ......... of reg. 2. (5 marks) Consider a circuit with the following function F(a,b,¢,d) 1d @ at the output line F of the (4 marks) A 32-bit bus operates at 1.0V and 2GHz clock rate. Each bit wire has a total capacitance of 2pF. Each wire has a toggling probability (a) of 0.75 per clock cycle. What is the total dynamic power dissipation of the bus drivers? 4, (3 marks) A student has 4 switches and 4 buttons and wants to connect them to his microcontroller. He thinks of saving pins by arranging the switches and buttons in a matrix (one row of switches, one row of buttons). Considering what you have studied in the course, which arguments could you give against this solution? Question four: (9marks) (2. marks) In a real-time system with a periodic task set,, how are priorities assigned to each of the periodic tasks? 2, (2 marks) List three types of sensors. order to decrease the number of memory 3. (5 marks) Give an example showing how a code can be rewritten accesses. Justify your answer. edtbed'* a'd? » Alexandria University Aaisuy! dela Faculty of Engineering aaigh 41S Computers and Communications Program By eS Lag) gu June, 2013 Sarna Digital Communications Aad) Coan) 8 Term aati 5 sal) Time allowed: Two Hours ctele 13 Answer the following questions Question One 4) 10 minutes of voice are sampled at a sampling rate of 8 K,samples/sec, and then quantized using 256 quantization levels, and finally coded using PCM with Manchester (RZ) format. The resultant digital base band signal is transmitted with an average power per bit of 2 watts through a noisy and lossy channel. The channel noise is of AWGN type with intensity 8x10" w/Hz. The path loss of the channel is 20 4B. The receiver structure is of LPF receiver. 1. Find the resultant bit rate of the transmitted signal 2. Sketch the waveform of the transmitting signal corresponds the bit stream 10110, 3. Evaluate the system probability of error. 5) If the above system uses matched filter receiver instead of LF receiver; 1. Sketch the 6lock diagram for the two path filter receiver in this case. 2. Sketch the impulse responses hy »,(t) &L hy, ,»(¢) for the two filters of the receiver Question Two For the same bit rate of 10 K6ps, same average transmitted power per bit of 2 watts, same channel noise of AWGN with intensity of 2x10" W/Hz, and same path loss of 20 dB. For each of the following modulation techniques: 1. Binary PSK, 2. Binary ASK, 3. Binary FSK with minimum probability of error Find: a) Sketch the transmitting waveform corresponding to the Git stream 1011 6) Sketch the transmitted PSD and then deduce the null-to-null BW ©) Sketch the received PSD, and then deduce the received signal to noise ratio (SNR). d) Evaluate the bit error rate. Question Three a) Draw the signal constellation diagram for 16-ary PSK signal, and then sketch the waveform corresponds the bit stream 0100111010000011 wien an average power per symbol of 2 watts is transmitted with a symbol rate of 1 Mega Symbol per Second. Select a suitable carrier frequency 6) The average power per symbol at the output of a transmitting antenna of 8-ary FSK transmitter is 8 watts, while the symbol rate is 2 Mega Symbol/Sec. The communication channel has an AWGN noise with intensity of 4x10" watts/Hz, and path loss of 10 d®B. Select the center frequency to be Seamer =100 R, Sketch the waveform corresponds the bit stream 010111011. Sketch the transmitted PSD and then deduce the transmitted BW. . Sketch the received PSD and then deduce the received SNR, 1. Evaluate the bit error rate of the system ARNS Question Four Long Term Evolution (CTE) which is classified as the end of 3G or some times called 4G of cellular mobile communication system. LTE uses adaptive modulation techniques where one of three modulation technique is used during working according to the user channel condition. These modulation techniques are: QPSK, 16-QAM, and 64-QAM. The average transmitted power in down fink direction with the usage of 16-QAM modulation is 2.5 W. The transmitted bit rate is 40 Méps. The receiver sensitivity is -65 dBm. The channel noise is of AWGN type with zero mean and noise intensity of 0.25X1019 W/H, The receiver structure is of coherent type. Take f. = 200 R, 1. Sketch the transmitted waveform that correspond the bit stream 0001 101001111100, 2. Sketch the transmitted ®SD and deduce the null-to-null BW, as well as the minimum BW. 3. Find the bandwidth efficiency. 4. Evaluate the maximum permissible path loss, and then find the maximum coverage distance for suitable reception. 5. If 10 minutes of video signal is down loaded through the above system. This video signal has 25 frames per second, with 2 Mega Pixels for resolution and high color quality. Find the number of bits detected in error, and then find the percentage of error time with respect to the total transmitted time. 6. What is the value of the channel capacity "Cand what is the ratio fxm Values of Q(X) Versus X Tom [one [ons [one [ons [one [om [one [008 2 pam losz Jooz7 loon [om onan Jooisr loow2 [owe [oor 24 ore loo [oor foots loov2 0.166 Joos foots oor loos 220100 Joo1e6 Joorz? Joo Joov2s [0.122 Joorwe Joos Joona joo [23 foow? Jo.o1s {oo12 |p, , 100014 o.00886 Jo 00866 |o.024 2.4 fo.0082 |o 00768 [0.00776 14 [9.00905 0.00676 o.00357 {0.00690 2.5 fo.oo82t o 00004 {o.00se7_[o [onsz2 fo. 00800 Jo.00«07 |o.008 28 fo.204e [o.00083 [0.00% fo.coe? [ososts |o.coar2 |o.00s01 lo.00370 [o.003ee [0.00267 [27 foo o.00506 [0.00026 Joost? Jo.nar7 |o.nr0e fo.or200o-0028 0.00272 J.0024 2 fo.o2se o.oo [0.0026 fo.c070_o.coz20 |o.caz1e |o.onzr2 lo 0206 [o.o0100 foo. 2 Jooore7 Joos jooots fooiee Josores [oaoree Jo.ntss Jo n00 fo.ovia o.00100 s of Q( X )for large x amt x Tent x am [Bens |as —[sweos sz — [roves frases lass —leseeve ss — Is raede| oa fare [aateoe [8105 [ass | a0600 [a3 00] [257600] fr a06 aE 06 Jar [12000 fs. = a a [a.17e05 ars _[ra7e08 |s5 [250605 |as —|7sve07fs35 [1-08 [2070s aes _[o-1vea7fse —r.07E08 fisseos las —a70E07|s_5 [ame z 25 2 25 3 35 feos fess —fo.71e07 [5.00600 07 E05 fpareo7 ls7E00 lesae0o 505 —_[221€07 fp.22609 feste00{s1 —|70e07 000. Is. a1600] f 20607, .g2600) © For M-ary FSK Modulation Technique. © For M-ary GAM Modulation Technique , =(-0e z.] EB eS) { i I i i i i i [ [ i i i i E t c c c Alexandria University Faculty of Engineering Special Scientific Programs Spring 2013 Net Centric Computing ‘Time Allowed: 120 Minutes ‘This is an open book and open notes exam. Be short and specific in your answers. 1. (60 points) True/False, justify cach with only one sentence, For statement (you marked false, it is not adequate to simply negate the sentence. (a) Consider two clocks that drift 1 second in every 106 seconds with respect to each other. A resynchronization interval of 2 x 104 milliseconds is sufficient to limit thelr skew to 20 milliseconds. (b) In general, two computers can be time synchronized to within half of the round-trip delay between them. (©) A. CPU must provide hardware support for atomic instructions in order for applications to be able to correctly synchronize, (4) Lamport clocks capture the “happens-before relationship” between two events. If Lex) < L(e2), then we can say that e; happened before e2. Can you use Lamport clocks to say whether ey happened as a result of e:? (e) Lamports algorithm for mutual exclusion requires between 3(N - 1) and 2(N - 1) messages per CS execution. (f) The bully algorithm for leader election assumes that no process can fail during the lection procedure until the new coordinator has been selected. (@) Berkeley Algorithm (for clock synchronization) assumes the existence of at least of one accurate time source. (b) Centralized algorithm for mutual exclusion is more robust to nodes failures than dis- tributed algorithm. (i) Map-reduce framework is well-suited to iterative processing such as graph algorithms, G) out-of-the-box Hadoop supports arbitrary indexes (&) In Berkeley UNIX algorithm, one daemon asks all machines for their time and computes ‘an average time and broadcasts this average time. () The global state of a distributed system is calculated by collecting the local states of the processes. (i) Two-phase commit protocol (2PC) is a concurrency protocol. (n) The size of a read quorum is always bigger or equal to the size of a majority set. (0) Any two serializable histories for the same distributed transaction are conflict equiva- lent? (either give a sketch proof or present a counter example) 2, (10 points) With references to section 12.8 and 12.4, for each of the following situations, ‘would you rather be using NFS or AFS? Give one sentence reason why. Be specific. (a) A large number of users. (b) Watching only the frst five minutes of a three hour video located on the distributed file system. (©) Mounting /ust/bin where files are rarely, if ever, modified. (@) An important file (net centric grades) is sometimes edited at nearly the same time (mere seconds apart) by the net centric staff members. (©) Congested network environment. 3. (4 points) n computers together provide a replicated service. The manufacturers claim that each computer has a mean time between failure of two days; a failure typically takes four hours to fix. The availability of the replicated service should be 99.99%, what is the least number of computers, n, you should buy? 4, (4 points) In @ multi-user game, the players move figures around a common scene. The state of the game is replicated at the players workstations and at a server, which contains services controlling the game as a whole, such as collision detection. Updates are multicast to all replicas. Consider the following conditions: (a) The figures may throw projectiles at one another, and a hit debilitates the unfortunate recipient for a limited time, What type of update ordering is required here? Hint: consider the throw, collide and revive events. (b) ‘The game incorporates magic devices that may be picked up by a player to assist them. ‘What type of ordering should be applied to the pick-up-device operation? 5. (12 points) Compare between CAN and CHORD. 6. (22 points) Consider the above figure. (@) (2 points) Show all pairs of concurrent events. (b) (6 points) Specify all possible consistent cuts that contain the event (©) (© points) Is the run < a,b,¢,d,¢, fg, > a linearization of events? Explain why? (@) (10 points) Specify Lamport clocks and vector timestamps for each event. You may assume that all logical clocks start initially with all zeros 7. (16 points) Consider the following resource allocation graph involving processes P,P; and Py and resources Ry,Rz and Rs. The above diagram means that P; holds Ry and is re- questing Rj, P; holds Ry and Py holds Ro. (2) (8 points) Assuming all currently held resources are maintained, give two resource requests that together would result in an immediate deadlock. (b) (@ points) Assuming all currently held resources are maintained, give two resource requests that together would nof result in an immediate deadlock Ry Re Ra. 8 (8 points) Explain the Bully algorithm for electing a leader, Page 2 eet RS RS ss ot * ea bad, a R-type Load/ Store Branch 0 rs rt t shamt funct 31:26 25:21 20:16 en 10:6 5:0 35 or 43 rs rt | address , 31:26 25:21 20:16 \ 15:0 4 ts rt \ address CPU overview Pc 4 | we [gee Register # Address Instruction }+4 |, Registers ~| Register # Instruction | memory | Register # 0: Address Data memory ata Ae oe oe oe on on oe ee ae ee a ee oe oe ee oe ‘Alexandria University a Ayal day Faculty of Engineering alg ls Specialized Scfentifie Programs B Baad ab gal June 2013 2013 win Performance Evaluation a pals ‘Time allowed: 2 hours ele :oajl A all the following question: Question (1) (@ A processor is multiplexed at infinite speed among all processes present in a ready queue with no overhead. This is an idealized model of round-robin scheduling among ready processes using time slices that are very small compared to the mean service time. Assume that the mean service time of a process is 5 minutes and the inter-arrival times are exponentially distributed with a mean of 10 minutes. i) What is the mean response time (r) of a process having a running time of 3 minutes (s)? (ii) Compare your result to the case where an M/M/1 model is used. (b) The telephone exchange for a large office handles calls that arrive randomly at an average rate of 60 per hour. Calls last on average 4 minutes (service time) and a very large number of telephone lines has been provided. Assume that the duration of a call is exponentially distributed. (@ Estimate the average the number of lines in use. (ii) What is the probability that there are 4 lines in use? (ili) If you are to design new system with a finite number of lines, give number of lines required so that the probability that a call does not have to ws (Hint: (1.3) = 0.9) rough estimate for the s 0.9. Question (2) (@ Consider the following 4-node Jackson network. The jobs arrive at random with a mean rate of 6 jobs/sec, The service-times at each node are exponentially distributed with means 1/4, = 30 milliseconds,1/y12 = 60 milliseconds, 1/13 = 40 milliseconds and 1/}44=50 milliseconds. ‘The routing probabilities are as follows: py2=0.2, pi3=08, P21=Pai=1, P31 =0.7 and P3sink = 03. cpu Disk (aes LaPo Sink (@ Identify the bottleneck device; that is the device of highest utilization. (i) Compute the mean overall response time of a job; that is, the average total time spent by 2 job in the system. (iii) What is the probability that a job has to wait at most 60 milliseconds in the printer's queue? (b) A small database server on » LAN handles requests from a large number of users. Each request on average involves 9 disk I/O operations and requires 2 sec of CPU-time. The server has two physical disk drives, each with a mean service rate of 10 I/Os per second. The server software allows a maximum of 3 requests to be in progress simultaneously. Requests arrive fast enough that there are always 3 in progress. Assume a central server model. (i Use the MVA algorithm to determine the system throughput. (ii) Determine the average CPU utilization as well as the utilization of a disk. Page | of 2 Use operational laws on! For a timesharing system with 2 disks (A and B), the probabilities for jobs completing the service at the CPU were found to be 0.45 to disk A, 0.5 to disk B and 0.05 to the terminals. The user think time was measured to be 20 seconds, the disks service times were 300 and 200 milliseconds per visit, and on average a job requires 5 seconds. Using » machine repairman model with a central server queueing subsystem, shown in the following figure, answer the following for this system: (a) For each device, what is the total service demand? (b) If disk A utilization is 30%, what is the utilization of the CPU and disk B? (© If disk B utilization is 80%, what is the average response time when there are 20 users on the system? (@) What is the bottleneck device? (© What is the minimum average response time? (O What is the maximum possible throughput of this system? (g) If the memory size is reduced so that jobs make 5 times more visits to disk B due to increased page faults, which device would be the bottleneck device? Question (4) (a) The following table represents the variation in the number of waiting processes in the CPU queue as a function of the simulation time. The simulated time is 20 seconds. Simulation Time, T (seconds) No. of waiting jobs O C/m* | Find the electric field at (0,0,L). (0,0,2L) te disk (0,0,L) 4 infinite surface y dx 2 gage wt No Soee ag tae 2. Given pn =, Clim? for 0Sr| ke 9 a} 7. a) Evaluate the inductance /m for the coaxial cable. b) Derive Maxwell 's equations. Then write those equations for time varying fields. Page 2 of 2 Examiner : Prof. Dr. Nour Eldin H. Ismail ‘Alexandria University Faculty of Engineering Computer & Communications CC 485 - Computer Graphics ‘Spring 2013 - Final Exam Date: June 3", 2013 ‘Time: 120 Minutes ‘Student Name: ‘Student ID: Group: ‘Section: ‘* Write your name and ID on every page ‘* Count the number of pages and make sure you have the correct count and they are all different * For MCQ questions, circle the letter preceding the best answer (exactly one answer can be circled) If more than one choice seem correct, choose the best one Unless otherwise specified, each question Is worth 2 points. Maximum grade Is 110 points. *__ Think about every question even if it looks very similar to a question you have seen before 1. Which of the following is the result of an 2. Given the three points P, P2, and P3, the affine sum of the points [52 1], equation P(a,B) = aP, + BP, + [-3 4 ijand[ 6 -1] (1-a—8)P3,0 0 represents 117 Dr. Mohamed E. Hussein CC 485 - Computer Graphics ‘student Namé ‘Spring 2013 — Final Exam 120 Minutes Student ID: 9. The affine sum of a group of points results in A. Apoint B. Avector C. Aconvex polygon D._A polygon that may be non-convex 10. A 30 translation matrix has A. 2 degrees of freedom B. 3 degrees of freedom C. 4 degrees of freedom D. 6 degrees of freedom 11.1f M Isa symmetric transformation matrix and ‘Sis uniform scaling matrix, then, the two matrices MS and SM are A. Inverse of one another B. Transpose of one another C. Equal to one another D._None of the above 13. Perspective projection preserves A. Linearity of lines B. Parallelism of lines C. Convexity of polygons D. Aandc 15. The function call Perspective(90, 2, 5, 15) is equivalent to the function call A. Frustum(0, 20, 0, 10, 5, 15) B. Frustum(-10, 10, -5, 5, 5, 15) 12. The inverse of the scaling matrix S(Sx, Sy, 5,) is A. S(-Sx,-53,~S2) B. S(sesy.sz) c. s( “Em >. $54) 14. The correct expression for the overall viewing transformation matrix is A. Mytewing = McameraMuodetMprojection B. Myiewing = MprojectionMuodetMcamera C. Myiewing = MrrojectionMcameraModet D. Mvicwing = MorojectionMuodet 16.A camera is located at [5 6 9]” looking at the point (11 1]*, what is the gaze vector, g, of the camera frame? A. [-4 -5 -8]" C. Frustum(-10, 10, -10, 10, 5, 15) 8. [45 By D. Frustum(-4, 4, -2, 2, 5, 15) c S69" D. [+5 ~6 ~9]" 17.A camera is located at [1 1 1]" looking at the point [5 6 9]?, what is the n vector of the camera frame? A, [0.42 0.5 0.76)" B. [0.39 0.49 0.78]" C. [-0.39 - 0.49 -— 0.78)" D. [-4 -5 -8]" 19.1n Phong’s reflection model, the number of parameters needed to completely specify the type of surface material is ook: B. 10 C9 D.8 18.A camera is located at e, looking towards the Point p, a correct call to the LookAt function for this setup would be A. LookAt(e, p, up) B. Lookat(e, e+p, up) C. Lookat(e, e-p, up) D. LookAt(e, p-e, up) 20.Which of the following materials should be given the highest shininess value? ‘A. Newspaper paper B. Wood C. Wool D. metal Dr, Mohamed E. Hussein CC 485 - Computer Graphics ‘Student Name: 21.In texture mapping, minification happens when A. More than one fragment access the same texel B. Some texels are not accessed by any fragment C. More than one texel is accessed by the same fragment D. Some fragments do not access any texel 23. Which of the following makes Mipmapping ‘most needed with texture mapping? A. Minification B. Magnification C. Perspective Projection D. Orthographic Projection 25. The main drawback of Cohen-Sutherland’s algorithm for line segment clipping is ‘A. Recursion B. Complexity of outcode computation C. Applicable only to 20 clipping windows D._Not compatible with the pipeline 27. Upon applying The Painter's algorithm, the two polygons A and B were found to overlap in the ranges of z coordinates, but, they do Rot overlap in x coordinates, such that A lies completely to the left of B. How would the algorithm behave? A. It must render A before B B. It must render B before A C. The order of rendering them does not matter D. Any order will produce errors ‘Spring 2013 — Final Exam 120 Minutes ‘Student ID: 22. Mipmapping can be informally described as A. Using linear interpolation to determine the final fragment color from mul texels B. Using linear interpolation to determine the texture coordinates of a fragment C. Using multiple sizes of the texture image to reduce artifacts D. Using perspective-correct interpolation to determine the texture coordinates ofa fragment 24, Considering the 2D clipping window extending between the two opposite corner points (50, 50) and (250, 150), the outcode of the point (200, 200) is A. 0110 B. 1010 C. 1100 D. 1000 26. The main advantage of Bresenham’s algorithm compared to the DDA algorithm is A. Handling any line slope B. Using only integer arithmetic C. Better asymptotic complexity D. Producing better Jooking lines 28. If back-face culling (removal) is enables, which of the following conditions must be true for a polygon to be rendered (i.e. considered front- facing)? A. nxvs0 B.nxv>0 Cnvso D.n-v20 Dr. Mohamed E. Hussein (CC 485 - Computer Graphics Student Nami ‘Spring 2013 - Final Exam 1120 Minutes Student ID: 29. 6 Points] Consider the tetrahedron whose vertices are as follows: v, = [1,0,0], v2 = [0,1,0], v3 = [0,0,1], and v4 = [0,0,0]. Compute the normal vectors at v, and v3. The normals you compute do not have to be unit vectors. 30. [6 Points] Consider using Bresenham’s algorithms to rasterize the line segment going between pixel coordinates (50, 100) and (56, 103). Trace the algorithm and determine the pixel coordinates of the fragments to be generated by the algorithm by filling the following table. Xq Ye dy 50 100 6 51 52 53 54 55. Jon fur] fu» fs | Loar 56 103 Dr. Mohamed &. Hussein — -— oe ee ee oe ee ee ee ee ee ee ee ee oe oe we ee CC 485 - Computer Graphics ‘Spring 2013 — Final Exam 120 Minutes ‘Student Name: ‘Student ID: 31. [8 Points] In the figure below, two triangles are described by the pixels they cover and the depth (i.e. Z) value for each pixel. Assuming that the screen was all black and the Z-Buffer was filled with oo (infinity) before rendering the two triangles, fill in the Z-buffer and the frame buffer with the values resulting from rendering the two triangles. For the frame buffer, use ‘R’ for red, ‘G’ for green, and ‘B’ for black. Cells left blank will be considered oo in the Z-buffer and ‘B in the frame buffer. Break ties arbitrarily. A | 2\ 5 EERE What Red Triangle Green Triangle Z-Buffer Frame Buffer 32. [8 Points] Suppose that you want to apply a texture map to a polygon such that, for some artistic reason, you want the texture to appear distorted. You discovered a simple idea to achieve the desired effect. Instead of using the texture coordinates provided by the rasterizer for a given fragment, (s, t), you first map them to different coordinate, (s’, t") = (cos(st), sin(s + t)), and then apply (s’,t’) instead, Write the simplest possible vertex and fragment shaders needed to implement your idea. 517 Dr. Mohamed £. Hussein | CC 485 — Computer Graphics Spring 2013 - Final Exam 120 Minutes Student Name: ‘Student ID: 33. [20 Points] In front of each of the following sentences, write ‘True’ if the statement is correct or ‘False’ otherwise. A. The physical meaning of a vector is a quantity with two attributes: magnitude and direction. B. Aset of vectors %, V2, «., Up are linearly independent if a0 + @2¥) +--+ GnUy = Olffat least one a # 0. . The convex hull of a group of points is the smallest convex polygon that inciudes all the points. D. The barycentric coordinates of a point inside a triangle are the coefficients of the affine sum that represents the point in terms of the triangle’s vertices. E. Foran n-dimensional vector space, any basis must have n vectors. F._ The representation of a point in a vector space in terms of a basis for the space may not be unique. G. Anaffine transformation in 3D has 12 degrees of freedom. H. The inverse of the translation matrix T(t, ty, tz) is T(—ty, ~ty, tz). |. Translating a point by a vector ¢, and then, rotating it around the origin by an angle 8 is not equivalent to doing the two operations in reversed order. J. Inoblique project, projectors are parallel and perpendicular to the viewing plane. K. In perspective projection, changing the distance between the projection plane and the point of projection has the effect of scaling the projected image. [The orthographic projection matrix can be completely determined by the four planes: left, right, bottom, and top. M. The oblique projection matrix can be computed as a composition of translation, scaling, and shearing only. N. A spotlight light source is completely determined by its direction. ‘A smooth surface scatters light in all directions while a rough surface scatters light in a narrow range of directions. P. The ideal reflector vector makes an angle with the normal vector to a surface that is equal to the angle between the viewer vector and the normal vector. ‘Q. In Phong’s model, the higher the shininess coefficient, the larger the specular highlight becomes. R, Most texturing calculations typically occur during the vertex processing stage. S$. The main advantage of Liang-Barsky's algorithm over Cohen-Sutherland’s algorithm Is that the former does not have to compute outcodes. T. The main advantage of using the normalized clip frame (from -1 to 1 in all directions) is to simplify the clipping operation. 617 Dr. Mohamed E. Hussein CC 485 - Computer Graphics Spring 2013 — Final Exam 120 Minutes Student Name: Student iD: 34.[10 Points] The following vertex shader is an attempt to implement Gouraud shading. However, it has ‘multiple mistakes, particularly, in the lines printed in bold and italic. Your task is to correct the mistakes, in vecd Position; in vec3 vNormal; out vecd color: uniform vecd AnbientProduct, DiffuseProduct, uniform mat4 ModelViews uniform mat4 Projection; uniform vecd LightPosition; uniform float Shininess; void main() ( SpecularProduct; // Transform vertex position into eye coordinates vec3 pos = (Projection * ModelView * vPosition) .xyz; veo3 1 = normalize (LightPosition.xyz - pos ); vec3 E = normalize( -pos }; vec3 H = normalize( L +B); // Transform vertex normal into eye coordinates veo3 N = normalize( ModelView*vecd(vNormal, 0.0) ).xyz; // Compute terms in the illumination equation vecd anbient = AmbientProducts float Kd = max( dot(L, B), 0.0 ); vecé diffuse = Kd*DiffuseProduct; float Xs = pow( max(dot(W, E), 0.0), Shininess ); vec4 specular = Ks * SpecularProduct; S£( dot(L, N) < 0.0) 4 specular = vec4(0.0, 0.0, 0.0, 1.0) g1_Position = Projection * ModelView * vPositions color = ambient + diffuse - specular; color.a = 1.0; ne ee ee eee ae ee ee eS ee Se ee Dr. Mohamed £. Hussein Ce ee i i Formula Sheet Basic Algebra a axb=| a Pai sex tae 3D Affine Transformation Matrices TOO fy along the ans with respecttoy 5 Ete ransation:Mtesyet,) =| 1 9 | | cooddnate ones a5 09 Meee ela ie a 4 1 cote 0 9 Sealine S(5e55)=19 3 5, | loo ot qe te oo ooo =I) 0 10 oor Rotation about Rotation about Rotation about cos sind 0 0 neo 0 0) oe 0 sind esd 0 0 oO cose sine 9} 1 B@=!"0° “Or a of Jo sine coo} %O=| sno 0 a4 oo rs Tefetion wit the 2 plane Teteeon wr the Kp Tetection wrt ep Po 0 9 10 0 Oj ” 0 100 jo 1 0 9 0 ooo 4 | 0 Totation about an retary ax, given bya normal vector = [= Wal? with an ange O, whe fing a pot M(v,0.0) = T@)RECIRF(G,)R)R,(0,)ReCG)T~p), where ror 0 aoa g 0 @,/d ~ay/d 0 oo caer 8,62) =| a oh i. (G)=|o 3 8 Clwhered = fap +d qa gee Viewing Transformations : ‘Camera Transformation Perspective Equations na~ fue 2 venxu Xo ae aa Orthographic: Simple Perspective: 2 : i right + tert feo ° | right Toft right — left 2 i 2 _top + bottom| lp o Rewtfer 2:near- far top = bottom ‘op ~ bottom| ee ae le ° ° 2 far + near Jar=near — far-near a a a a ‘Shading and Lighting 1 kala) + hl + ly = halen) + als WY + kala r=2-nn-1, rm Parametric Surfaces Cylinder: Sphere: x=rcos2mu,y =rsin2m2 = hy x= reos 2mu,y = rsin 2mucos 2nv,z = rsin2musin 2m Pipeline Algorithms Outcode computation in 20: Bybi babs Bresenham’s update formula: but y > Yar D1: < Yrtns Ba! X > Hina eam {y Seta “2? ot = Lay — 2¢0y a2) 0. ee ee ee a Alexandria University Pattern Recognition Faculty of Engineering Final exam 120 Mins Special Scientific Programs (SSP) Spring 2013 ‘Computer and Communications all ms Q4(Metrics/Normalization) a, Name three dissimilarity measures. Determine if they are metrics. Why? Don’t name the Euclidean distance. 'b, Normalizing data points plays an important role in pattern recognition. Name three kinds of normalization we used in our course and tell when these normalizations can be used? Q2 (Classification) ‘Assume we want to classify the di course ] course subject into three categories. Hard, 10 fen (2) Moderate and Easy. The input feature is the 1 70 7 scores of the students in the class. If we 7 i m1 know that the mean of an easy course is 80 4 7 a with standard deviation as 12,, hard course has mean of 67 and standard deviation 18 = 70 zd and the moderate course has mean of 75 and Ss 16 23 6 7 8 9 standard deviation 15, 55. 62 a. Whats the class label for course (1) 80 387 a a (2). Use 3 ML classifiers 76 83 and voting, b. If the prior that exams are easy with = 7 prob 0.5 and difficult by 0.2. How can | | 20 el 7 that change the classification in part a1 91 98 cy a 92 99 c. What constants to be BE] 45 52, added/subtracted to the grades of 14 67 74. course (1) to change its label. Q3(Clustering) Cluster the course (1) data in question 2 using 3-means and initial seeds at instances 1,7,14. Perform 5 iterations or until convergence. 'b. Cluster the course (1) data in question 2 using 4-means and initial seeds at instances 1,7,9,14. Perform 5 iterations or until convergence. ©. Using Dunn’s and XB which clustering is better from parts a and b. Devise a comparison between clustering by partitioning and di ree Alexandria University Faculty of Engineering Comp. & Comm. Engineering CC474: Switching Theory and Huasigh als eMac y Gull Lala gall y Bags ike 5a Models of Computation Spring 2013 rete Final Exam eit Si lated P3 | P4 | P5 | P6 | Total Page | Pl | P2 Mark DO NOT WRITE ANYTHING ABOVE THIS LINE Name: 1) [Spts] Build a deterministic FSM for each of the following language: {w © (0, 1}* : w does not have 110 as a substring}. 2) For each of the following languages Z, state whether Z is regular, context-free but not regular, or not context-free and prove your answer. a) [Spts] {ayz: x,y, z € {a b}* and |x| = | = [2)}- b) [Spts] {vx : hw] =2:[x and w € a*b* and x € ab}. ©) [Spts] (w"ww": we (a, b}*). 3) [Spts] Show a possibly nondeterministic FSM to accept the language defined by the following regular expression: ((@Uba) bUaa)t. 4) [Spts] Use grammartofsm to generate an FSM M that accepts the language defined by the following grammar: S— aS|bS| aT TobW W-> bX XaX|bXle 5) [Spts] For the following grammar G, show that G is ambiguous. Then find an equivalent ‘grammar that is not ambiguous. (S, 4, B, T, a,c}, {a,c}, 8,5), where R= {S—> AB, S—> BA, A> ad, A-> ac, B-> Tc, Tal, Tra}. C C c c [ [ i i i E I i i i i i i E t c 6) [Spts] Give an unambiguous grammar for Boolean expressions on the forms of SumOfProduet and ProductOfSums. Hints: + you need to consider the operations AND (A), OR (v), NOT (=) + Examples of SumOfProducts expression AABA “CV AAB and A » Examples of ProductOfSums expres (AVB)A( =AVC) and —B 7) [Spts] Build a deterministic PDA to accept the following language: LS, where L = {w © {a,b c}* : Halw) = #u(w) + #e(w)}. rn SE aE aE aera Cee eee eee lL Ce TRUE OR FALSE. (Ipt each) @@- © ©? ul 13, 17. 19, PGODOODOOOODDODODOODODIDIDIIODSD ®©@O@OQDOODOOODODODOODOODOOOO ). The language L, = fa"b"ct: 12, 14, 16. 18, 20. ai. 23. 28. It is undecidable to determine whether a given context-free grammar G is ambiguous. ‘The intersection of a regular language and a nonregular language must not be regular. (aUb)* b(aUb)t U (audit a (aby =(auby. If L is regular, then so is (xy:x € Landy € L}. ‘The union of an infinite number of regular languages must be regular. If Ly and Z, are regular languages, then L, ® Lz = {w : w (L1~ a) or w € (La Li)} is regular. If and B are any two regular expressions, then (aB)*a. = a(Ba)* If Ly and £, are regular languages and Ly & L& Za, then L must be regular. Itis possible thatthe union of a regilar language and a nonregular language is regular. + kor m=n-+ k} is context-free. Every subset of a regular language is regular. If L* is regular, then Z is regular. If Ly is a context-free language and Ly < Ly, itis possible that L> is regular. Context-free languages are closed under letter substitution. . If Ly and Z, are not regular languages, then L, U Zz is not regular. If L; and L, are two context-free languages and L; = Lol, then Ls must also be context-free. ‘The language {a’, n is prime} is context-free. ‘The nonregular languages are closed under intersection. Proving the correctness of a grammar consists of proving that it generates all the strings in the language it defines. ‘Any language that can be defined with a regular expression can be generated by some context-free gramar. If L, and L, are two context-free languages, L; ~ La must also be context-free. . If Ly be an infinite regular language, then I, = Z,* is also an infinite regular language. Itis possible that the concatenation of two nonregular languages is regular. {Languages accepted by a DFSM} c {Languages accepted by a NDFSM} If Ly is a context-free language and Ly < 1, then L_ must be context-free. eo Mobile and Wireless communications CC Program Final exam May 2013-05-21 E esr said Einoubi : 1. The channel bandwidth in LTE system is 20 MHz. The resource block contains 12 subcarriers with subcarrier spacing of 15 kHz. If the transmission bandwidth is about 90% of the channel bandwidth, the number of used resource blocks per channel is I a. 100 ©. 50 ». 200 d. none of the above The FFT size in the previous question is i a. 1024 ©. 512 b, 2048 d. none oM symbol time is Bb ‘The number of used subcarriers in the previous questions is a. 1201 0512 b.256 d. none of the above 4 ImLTE downlink, a mobile user is assigned 5 pairs of resource blocks during a certain subframe containing no I syne or control channels. If his bit rate of this user is 6.4 Mbps, then modulation is a, QPSK c. 16-QAM i b. 64-QAM d. none of the above 5, I the LTE mobile user using QPSK modulation is uploading (transmitting a file at bitrate of 576 kbps, then he should be assigned I a. 2 pairs of resource blocks/subframe c. one pair of resource blocks/subframe 4.none of the above b. 4 pairs of resource blocks/subframe ] 6. If the LTE sampling rate is 15.36 MHZ, the FFT size is : a, 2048 ¢.512 . b. 1024 d.none of the above 5 7, In LTE uplink frame using 2048 FET size and normal CP, the CP of the first OFDM symbol in a slot consists of 160 samples while the CP of the other 6 OFDM symbols consists of 144 samples. The number of samples per subframe is « a. 15360 samples c. 30720 samples d. none of the above @ 8 In ODFDM signal, ifinstead of using CP, we employ a guard interval (no signal transmission) with length greater than the maximum delay spread ,the result is b. 3648 samples a. NoISIandno intersubcarrier interference (ICT) _¢. ISL but no ICI b. ICI but no ISI 4d. none of the above 9. For OFDM signal transmission in a channel with impulse response h(t) and AWGN, the demodulator exip by is the transmitted modulation symbol a, a. Scaled and rotated and impaired by noise m, _c. convolved with h(t) and impaired by noise b. multiplied by a real number and impaired by noise n.d. none of the above 10. Transmission errors in OFDM signal due to frequency selective fading, can be corrected using the following before OFDM modulation a.Error correcting codes c. channel coding and frequency interleaving b. Cyclie prefix 4. none of the above 11. The IDFT of a sequence of modulation symbols is a. Continuous time OFDM signal c. sum of modulated subcarriers 12. The statistical measure of the range of frequencies over which the channel can be considered "flat is called a. frequency selective fading c. coherence bandwidth b. flat fading d. none of the above 13. Frequency selective fading means that a. the delay spread < the symbol duration _. the coherence bandwidth > signal bandwidth b. coherence time>Doppler spread d. none of the above 14, Fast fading means that a. Doppler spread> coherence time ¢. the coherence bandwidth > signal bandwidth b. coherence time>Doppler spread 4d. none of the above 15. The output of the shown shift register is : aa [ fa in a. 111101010011000 ¢. 1111001101010 b. 111101011101000 . none of the above b. Time samples of an OFDM signal — d. none of the above 1 16. The following Walsh sequence [0011110000111100] is a Wi We 7 b. Wis . none of the above . 17. The last row in Hadamard matrix H16 is, E a, 0011110000111100 ¢. 0110 1001 1001 0110 : b. 0110100101101001 none of the above E 18, The Walsh spreading sequence of order 64 and rate 1.2288 Mops is used to spread a binary digital signal. The bit rate of the signal is = rapsstsiies [ E Cc Fre we wee SS a. 2.6 kbps. 19.2 kbps , 204.8 kbps d. none of the above 19, Walsh sequence W15 is given by a, 0101101010100101 ¢.1010101010101010 b, 0101010101010101 4. none of the above 20. WCDMA using PN codes requires signal-to-interference ratio Ep/Ip = 4 (6 dB). The channel bandwidth W=SMHZ Assuming 12.2 kb/s user rate, the number of users that can be served by one channel is approximately a, one user c. 125 users b. 131 users d. none of the above 21. For the previous question, considering voice activity and antenna gain factors of 2.67 and 2.4 respectively and neglecting other cell interference, the number of users is increased to about a. $56 users ©. 840 users b. 480 users . none of the above 22. In the previous question considering the other cell interference factor of 0.6, the number of users becomes a, 131 users ©. 410 users b. 1344 users 4, none of the above 23. For available bands of 1920-1980 MHz in reverse direction and 2110-2170 MHz in forward direction in question 21, the total number of users per cell ignoring interference from other cells is a. more than 16 thousands. ¢. less than 5 thousands b, 18000 d. none of the above 24. APN sequence has a length of 1023 bits (period). Any phase shift of the sequence (except shifts multiple to the period) gives with respect of the original sequence a, 512 agreements and 511 disagreements _c. none of the above b, 511 agreements and 512 disagreements 25. Ina multipath mobile environment with no line of sight the transmitted signal is a single tone with frequency f.. The received signal can be expressed as r(t)eos2rfat where r(t) has a. Gaussian distribution c, Ricean distribution b, Rayleigh distribution . none of the above 3

You might also like