With reference to the characteristics and performance of the human visual system, provide an estimate for each
Question:
With reference to the characteristics and performance of the human visual system, provide an estimate for each of the following. In each case you are expected to justify your estimate: (i) the maximum resolution required by a display device; (ii) the maximum number of distinct intensity levels required by a display device; (iii) the optimal number of dimensions required to represent colour; (iv) the maximum refresh rate required of a CRT monitor. [5 marks] (b) A programmer suggests three different implementations of a polygon drawing algorithm: (i) standard z-buffer; (ii) standard A-buffer with an 8 8 mask size; (iii) standard z-buffer at 8 8 normal resolution followed by averaging operation which produces a normal resolution image by finding the average value of each 8 8 block. Compare the three implementations in terms of both execution speed and resulting image quality. Which would be the best implementation to use if the average polygon covers 50 pixels? Which would be the best implementation to use if the average polygon covers 2 pixels? Which would be the best implementation to use if the display resolution was equal to the answer that you gave to (a)(i) above?
Write Java program to read and write a plain text file using InputStream, OutputStream, FileOutputStream. rite aJAVA program to read a text file. Input any text file from your java program to read in a c++ program and capitalize all the comments(/*, */, and //) in the program.
(a) What input condition will cause a D flip-flop to go metastable? [3 marks] (b) What timing parameters have to be adhered to in order to avoid metastability? [3 marks] (c) Will a D flip-flop remain in the metastable state indefinitely? [3 marks] (d) What is the difference between synchronisation and debouncing? [3 marks] (e) How is a synchroniser made out of D flip-flops? [3 marks] (f ) What are the failure modes for the following two counters (count0 and count1) if asyncInput comes from a synchronous digital circuit clocked from a different clock source and keyInput comes directly from a mechanical push button? reg [63:0] count0, count1; reg [2:0] sync; always @(posedge clock) begin // count how many clock cycles asyncInput is high if(asyncInput) count0 <= count0+1; // count the number of times the keyInput is pressed sync <= {sync[1:0],keyInput}; if(!sync[2] && sync[1]) count1 <= count1+1; end [5 marks] 2 CST.2005.3.3 2 Data Structures and Algorithms (a) Briefly outline how a sequence of symbols can be encoded as a sequence of Huffman codes, and explain under what assumptions Huffman encoding generates optimally compact code. [6 marks] (b) Estimate the number of bits needed to Huffman encode a random permutation of As, Bs and Cs, with each letter occurring one million times. [3 marks] (c) Estimate the number of bits needed to Huffman encode a random permutation of As, Bs and Cs, where A occurs two million times and B and C each occur one million times. [3 marks] (d) Estimate how many bits would be needed to encode the sequence in part (b) above using arithmetic coding. You may assume that log2 3 is about 1.6. [4 marks] (e) Estimate, with justification, how many bits would be needed to encode the sequence in part (c) above using arithmetic coding. [4 marks] 3 Artificial Intelligence I (a) What are the advantages and disadvantages of constraint satisfaction problem (CSP) solvers compared with search algorithms such as A? search, etc? [3 marks] (b) Give a general definition of a CSP. Define the way in which a solution is represented and what it means for a solution to be consistent and complete. [5 marks] (c) Assuming discrete binary constraints and finite domains, explain how breadthfirst-search might be used to find a solution and why this is an undesirable approach. [3 marks] (d) Give a brief description of the basic backtracking algorithm for finding a solution. [4 marks] (e) Describe the minimum remaining values heuristic, the degree heuristic and the least constraining value heuristic. [5 marks] 3 [TURN OVER CST.2005.3.4 4 Comparative Programming Languages Consider the Prolog procedures named s and p defined as follows: s(H, [H|T], T). s(H, [N|T], [N|L]) :- s(H, T, L). p(X, [H|T]) :- s(H, X, Z), p(Z, T). p([], []). (a) Show how Prolog would evaluate the goal s(H, [a,b,c], T) giving all the successive instantiations of H and T that cause the goal to be satisfied, and hence describe in words what s does. [6 marks] (b) What value of Q causes the goal p([a], Q) to be satisfied? [3 marks] (c) What values of Q cause the goal p([a,b], Q) to be satisfied? [4 marks] (d) What values of Q cause the goal p([a,b,c], Q) to be satisfied? [5 marks] (e) Describe in words what p does. [2 marks] 5 Operating Systems II (a) Modern operating systems typically support both threads and processes. What is the basic difference between a thread and a process? Why do operating systems support both concepts? [2 marks] (b) You get a summer job with a company which has an in-house operating system called sOs. sOs uses static priority scheduling, supports at most 32 concurrently-executing processes, and works only on uniprocessor machines. Describe with justification how you would modify sOs in order to: (i) support up to 50000 concurrently executing processes; [2 marks] (ii) reduce or eliminate the possibility of starvation; [3 marks] (iii) efficiently schedule processes on an 8 CPU symmetric multiprocessor (SMP) machine; [5 marks] (iv) support threads in addition to processes on SMP machines. [3 marks] (c) How would you go about reducing the time taken to boot a modern operating system?