You are on page 1of 4

COS 216 Class Test 1

This test takes place on 10th February 2016.


The maximum duration of this test is 50 minutes.
This test consists of 4 questions for a total of 35 marks.

Name and surname:


Student number:

Question 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . (3 marks)
1.1 Jeff is working on a new IP address structure. It should also be noted that Jeff is a rather eccentric
individual. Jeff has decided that his new IP address structure should contain 3 hexadecimal digits, 3
octal digits, and 9 binary digits. Does Jeffs new IP address structure allow for more or less unique
addresses than IPv4? Show your calculations (you may use power notions).

(2)

1.2 Roughly explain what a domain name server does.

(1)

Question 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . (12 marks)


2.1 What does HTML stand for?

(1)

2.2 Explain the difference between the get and post methods and give emamples of where it could be used.

(2)

Page 1 of 4

COS 216 Class Test 1: 10th February 2016


2.3 Give the names and tags for two different types of lists in HTML

(2)

2.4 Write the HTML markup needed to create the following table (excluding the boarders):

(4)

2.5 List 3 different HTML5 input elements.

(3)

Question 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . (10 marks)


3.1 The IP protocol resides on the Network layer of the OSI reference model, which units are used as the
reference for this protocol?

(2)

3.2 On which layer of the OSI reference model does the Socket protocol reside?

(1)

Page 2 of 4

COS 216 Class Test 1: 10th February 2016


3.3 What constitutes a socket?

(2)

3.4 Complete the following sentences by filling in the respective word in the table which follows.
a) The acronym TCP stands for [i] .

(2)

b) TCP is a [ii] -oriented protocol, while UDP is [iii] -oriented and makes use of [iv] communication.

(3)

[i]
[ii]
[iii]
[iv]

Question 4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . (10 marks)


Consider the following UML class diagram of the ChatServer and answer the questions which follow. Note:
The GLOBAL class represents all non-class based functions defined in ChatServer.cpp.

4.1 Which C-language API needs to be included to make use of sockets?

(1)

4.2 Consider the following pseudocode segment which shows the process followed by a server using TCP/IP
and sockets to implement a chat server.
s e r v e r S o c k e t i d = s o c k e t ( I n t e r n e t P r o t o c o l , SocketStream , TCP) ;
serverAddress = getServerAddress ( ) ;
bind ( s e r v e r S o c k e t i d , s e r v e r A d d r e s s + s e r v e r P o r t ) ;
listen ( serverSocket id );
ChatServer c s ( s e r v e r P o r t , s e r v e r S o c k e t i d ) ;
c s . serverRun ( ) ;
The method serverRun spawns a thread for each client which contacts and runs the global function
chatFunction on this thread.
a) For the server to be able to accept multiple clients, an infinite loop is required. In which function or
method would you define this infinite loop?

Page 3 of 4

(1)

COS 216 Class Test 1: 10th February 2016


b) Within this loop, as mentioned in the previous question, the server negotiates an alternative socket
for communication with the client. Why is this necessary?

(1)

c) What is the call, in C++, to spawn a thread from which further communication with the client will
be controlled?

(3)

d) What functions are used to send and receive messages on the server?

(2)

4.3 What protocol can be used by the client to access the server if a specific client program has not been
written?

(1)

4.4 Which part in the connection, the client or the server, must terminate the connection? And why?

(1)

Page 4 of 4

You might also like