Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Answer the following questions in details. (1) The figure below illustrates, for a single TCP connection, changes in the advertised congestion window (CWND). (i) Indicate

Answer the following questions in details.

(1) The figure below illustrates, for a single TCP connection, changes in the advertised congestion window (CWND). (i) Indicate which phase of congestion control the TCP connection is in at G. (ii) Indicate which phase of congestion control the TCP connection is in at E. (iii) Describe the event that has occurred at D. (iv) Describe the event that has occurred at F. [1 mark each]

(a) (i) In programming languages in general, what is the difference between statically and dynamically-allocated variables? Without using the static keyword, give examples of both types of variable in the C language. [2 marks] (ii) What effect do the static and extern keywords have in C for both forms of variable? [3 marks] (b) There are 32 characters in the ASCII set between 'A' and 'a'. All are printable. A potentially-infinite stream of 8-bit bytes can be made printable by encoding into base 32 and represented by a longer stream just using these characters. Give a syntactically-accurate definition in C for encode32(unsigned char a), called for each byte, which invokes putchar(char c) once or twice per call to render the encoded output. [5 marks] (c) Show how the for statement in C can be used to traverse a linked list. Explain the benefits of this coding style, mentioning whether the continue statement works appropriately. [4 marks] (d) typedef char * mystring; mystring s201 = "201"; mystring s202 = s201; s202[2] += 1; A novice programmer writes the above code. What do you think they are intending to do and what two problems might they suffer? [2 marks] (e) An interpreter for a string processing language is written in C. Describe four storage and efficiency-related considerations when designing the module for storing strings for the interpreter? [4 marks]

(a) A key/value store holds pairs of strings in a non-volatile memory (NVM). The NVM is mapped as a memory region between two hardcoded virtual addresses, NV START and NV END. This memory is all set to zero as manufactured and can be freely read, but any write operations result in a logical ORing of the new data with the old data at the addressed location. Bits can never be cleared. Strings representing keys and values will be fewer than 250 characters long. Eventually the memory will fill up, but sufficient is available for the intended application. The API provides the following two operations: int store(char *key, char *value) // returns non-zero on error, and char *lookup(char *key) // returns NULL if not found. Provide a full C implementation of the store routine, explaining how the lookup function and changes to values under a given key would work, if this is not obvious from your code. Code efficiency is not important. Hint: You can directly access the non-volatile store using a construct such as ((char *)NV_START)[offset]. [10 marks] (b) The following text almost constitutes both a C++ and Java program: class Foo { public: int x, y; }; class Test { private: void f1(Foo p) { p.x = 1; } private: void f2(Foo &q) { q.y = 2; } //[Java]: ignore '&' public: void test() { Foo p; //[Java]: replace with: 'Foo p = new Foo();' p.x = p.y = 99; f1(p); Foo q = p; p = q; f2(q); print("HERE"); } }; (i) Explain the storage structure accessible from variables x and y when control reaches print("HERE") following a call to test(), both in the Java and the C++ interpretations. [3 marks] (ii) For the C++ interpretation, show how adjustments only to the definition of class Foo can cause (useful) debugging-style output to be produced at as many places as possible during the execution of method test(). [7 marks] (a) (i) Define the terms capacity and latency as applied to communication channels; explaining whether there is a strict relationship between the capacity of a channel and its latency. [3 marks] (ii) Using a clear example explain how the latency of a channel can have a direct effect on the capacity of a higher-layer channel which uses it. [8 marks] (iii) Describe how the capacity of the higher-layer channel may be improved, without any change to the characteristics of the underlying channel. [3 marks] (iv) Describe in what circumstances such changes would provide only limited benefit. [2 marks]

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction to Wireless and Mobile Systems

Authors: Dharma P. Agrawal, Qing An Zeng

4th edition

1305087135, 978-1305087132, 9781305259621, 1305259629, 9781305537910 , 978-130508713

More Books

Students also viewed these Programming questions