COMPLETE ALL THE ANSWERS 2) Implement reverse_iterator (33.2.1)….
Question Answered step-by-step COMPLETE ALL THE ANSWERS 2) Implement reverse_iterator (33.2.1)…. COMPLETE ALL THE ANSWERS?2) Implement reverse_iterator (§33.2.1).[3] ( ?1.5) Implement ostream_iterator (§38.5).[4] ( ?2) Implement istream_iterator (§38.5).[5] ( ?2.5) Design, implement, and test a run-time range-checked random-access iteratorChecked_iter.[6] ( ?2) Design and implement a handle class that can act as a proxy for a container by providinga complete container interface to its users. Its implementation should consist of a pointer to acontainer plus implementations of container operations that do range checkingYou have available a 20 Gbyte disc on which you need to hold an indexed sequentialfifile consisting of variable length records each having a 20 byte key. Records,including the key, are typically 500 bytes long but never exceed 1000 bytes. Thetotal size of all the records is never more than 10 Gbytes.(a) Suggest, in detail, how you would represent this fifile on the disc. You shouldchoose an organisation that allows?(i) effiffifficient insertion of new records,(ii) effiffifficient updating of existing records identifified by key, and(iii) effiffifficient inspection of all records in key order.[14 marks](b) If the total size of the database is 10 Gbytes, estimate, for your organisationof the fifile, how many disc transfers would be needed to access a record witha given key, and estimate how many transfers would be required to read theentire database in sequential order. [6 marks]2 Computer DesignModern dynamic random access memories (e.g. DRAM, SDRAM and RAMBUS)all support burst mode read and write access.(a) Give an outline of the bus activity for a burst mode read access. [4 marks](b) Explain the difffference between a direct mapped cache and an associative cache.[4 marks](c) What cache line replacement policies are typically used for a direct mappedcache and a set associative cache? [4 marks](d) Why are caches able to exploit burst mode accesses, and why is a write bufffferoften used? [4 marks](e) What is bus snooping and what does it achieve? [4 marks]2CST.2002.5.33 Digital Communication I?Consider the real-time transport of audio across a network.(a) What are the advantages of digitising the audio? [5 marks](b) What are the disadvantages and how can they be mitigated? [5 marks](c) What characteristics of the end-to-end channel across the network would bedesirable, and how are these difffferent from those which would be desirable fortime-insensitive data? [5 marks](d) Discuss the applicability of asynchronous and synchronous multiplexing incarrying real-time audio traffiffiffic. [5 marks]3burst mode read and write access.(a) Give an outline of the bus activity for a burst mode read access. [4 marks](b) Explain the difffference between a direct mapped cache and an associative cache.[4 marks](c) What cache line replacement policies are typically used for a direct mappedcache and a set associative cache? [4 marks](d) Why are caches able to exploit burst mode accesses, and why is a write bufffferoften used? [4 marks](e) What is bus snooping and what does it achieve? [4 marks]2CST.2002.5.33 Digital Communication IConsider the real-time transport of audio across a network.(a) What are the advantages of digitising the audio? [5 marks](b) What are the disadvantages and how can they be mitigated? [5 marks](c) What characteristics of the end-to-end channel across the network would bedesirable, and how are these difffferent from those which would be desirable fortime-insensitive data? [5 marks](d) Discuss the applicability of asynchronous and synchronous multiplexing incarrying real-time audio traffiffiffic. [5 marks]3[TURN OVERCST.2002.5.4?4 Concurrent Systems and Applications(a) The suspend() and resume() methods defifined on java.lang.Thread can beused to block and unblock a designated thread. Explain why these methodsshould not be used. [4 marks](b) Defifine a Java class Barrier that pairs together two difffferent kinds of thread(A and B) in a concurrent system. It should support two methods,enterA(Object o) and enterB(Object o). A call to one enter methodblocks until a call is made to the other. At that point both invocationscontinue, enterA returning the value passed to enterB and vice versa.[8 marks](c) A number of barbers and customers have to co-ordinate their actions in abarbers’ shop. Each barber has a chair in which a customer sits while receivinga haircut and in which that barber dozes when he has no customer. There isplenty of waiting space.Defifine Java classes Barber, Customer and Shop to model this situation. Theclass Customer should support two methods:(i) Barber getHaircut(Shop s) – request service at s, blocking until thecustomer is served and returning the allocated barber;(ii) void leaveChair(Barber b) – signal that b can take another customer.The class Barber should support two corresponding methods:?(i) Customer getCustomer(Shop s) – wait to be allocated a customer at s;(ii) void finishedCustomer(Customer c) – signal to c that the haircut isfifinished and wait for c to leave the chair.[8 marks]4CST.2002.5.5SECTION B5 Comparative Programming LanguagesThis question concerns the representation of parse tree nodes for expressionscomposed of integer constants, identififiers, and integer operators for addition,subtraction, multiplication and division. In a typeless language, such as BCPL,each node can be implemented as a vector whose fifirst element holds an integeridentifying the node operator. The size of the vector and the kinds of value held inthe other elements then depends on this node operator.(a) Complete the description of how you would represent such integer expressionsin a typeless language. [5 marks](b) Suggest how you would represent such integer expressions in C and either MLor Java. [10 marks](c) Brieflfly discuss the relative merits of your C data structure compared with thatused in the typeless approach. [5 marks]6 Compiler Construction?(a) Assuming a Java type is given to each variable, state a method by which anoverloaded operator (such as +,- etc.) in a Java program can be determinedto be an int, real or other operator. [3 marks](b) Explain, using pseudo-code as appropriate, how to convert a syntax-tree intostack code such as that used in the JVM. For the purposes of this question, youonly need consider trees representing bodies of void-returning functions, andthese bodies only as consisting of a list of statements of the form int x = e;or x = e; where x ranges over variables and e over expressions; expressionscontain variables, integer constants, the binary operator + and static methodinvocations. [10 marks](c) Show how a sequence of simple stack code instructions, such as those usedin your answer to part (b) above, can be translated into a sequence ofinstructions for a register-oriented architecture of your choice, for exampleARM or Pentium. [7 marks]5[TURN OVERCST.2002.5.67 Prolog for Artifificial Intelligence(a) Give a simple defifinition of the Prolog predicate dfx that can perform symbolic[TURN OVERCST.2002.5.44 Concurrent Systems and Applications(a) The suspend() and resume() methods defifined on java.lang.Thread can beused to block and unblock a designated thread. Explain why these methodsshould not be used. [4 marks](b) Defifine a Java class Barrier that pairs together two difffferent kinds of thread(A and B) in a concurrent system. It should support two methods,enterA(Object o) and enterB(Object o). A call to one enter methodblocks until a call is made to the other. At that point both invocationscontinue, enterA returning the value passed to enterB and vice versa.[8 marks]?(c) A number of barbers and customers have to co-ordinate their actions in abarbers’ shop. Each barber has a chair in which a customer sits while receivinga haircut and in which that barber dozes when he has no customer. There isplenty of waiting space.Defifine Java classes Barber, Customer and Shop to model this situation. Theclass Customer should support two methods:(i) Barber getHaircut(Shop s) – request service at s, blocking until thecustomer is served and returning the allocated barber;(ii) void leaveChair(Barber b) – signal that b can take another customer.The class Barber should support two corresponding methods:(i) Customer getCustomer(Shop s) – wait to be allocated a customer at s;(ii) void finishedCustomer(Customer c) – signal to c that the haircut isfifinished and wait for c to leave the chair.[8 marks]4CST.2002.5.5SECTION B5 Comparative Programming LanguagesThis question concerns the representation of parse tree nodes for expressionscomposed of integer constants, identififiers, and integer operators for addition,subtraction, multiplication and division. In a typeless language, such as BCPL,each node can be implemented as a vector whose fifirst element holds an integeridentifying the node operator. The size of the vector and the kinds of value held inthe other elements then depends on this node operator.(a) Complete the description of how you would represent such integer expressionsin a typeless language. [5 marks](b) Suggest how you would represent such integer expressions in C and either MLor Java. [10 marks]?(c) Brieflfly discuss the relative merits of your C data structure compared with thatused in the typeless approach. [5 marks]6 Compiler Construction(a) Assuming a Java type is given to each variable, state a method by which anoverloaded operator (such as +,- etc.) in a Java program can be determinedto be an int, real or other operator. [3 marks](b) Explain, using pseudo-code as appropriate, how to convert a syntax-tree intostack code such as that used in the JVM. For the purposes of this question, youonly need consider trees representing bodies of void-returning functions, andthese bodies only as consisting of a list of statements of the form int x = eor x = e; where x ranges over variables and e over expressions; expressionscontain variables, integer constants, the binary operator + and static method COMPLETE ALL THE ANSWERS Computer Science Engineering & Technology C++ Programming COM295 V.2 Share QuestionEmailCopy link Comments (0)


