Solution Q.1: (a)
As we router have capability to choose shortest path, and in the diagram we see that the shortest path to send request from computer C (sender) to Computer B (Receiver) is R4=>R2.
But if there is any blockages between them then the router 4 use the alternative path R4=>R3=>R1=>R2.
Solution Q.1: (b)
Convert the following IP addresses from decimal to binary and binary to decimal showing the steps involved.
a) 221.120.152.10 = 11011101.1111000.10011000.1010
- Quote :
221 to Binary 120 to Binary 152 to Binary 10 to Binary
2 221 2 120 2 152 2 10
2 110 1 2 60 0 2 76 0 2 5 0
2 55 0 2 30 0 2 38 0 2 2 1
2 27 1 2 15 0 2 19 0 1 0
2 13 1 2 7 1 2 9 1
2 6 1 2 3 1 2 4 1
2 3 0 1 1 2 2 0
1 1 1 0
b) 202.125.147.6 = 10001010.1111101.10010011.110
Working
202 to Binary 125 to Binary 147 to Binary 6 to Binary
2 202 2 125 2 147 2 6
2 101 0 2 62 1 2 73 1 2 3 0
2 50 1 2 31 0 2 36 1 1 1
2 25 0 2 15 1 2 18 0
2 12 1 2 7 1 2 9 0
2 6 0 2 3 1 2 4 1
2 3 0 1 1 2 2 0
1 1 1 0
c) 121.100.246.10 = 01111001.01100100.11110110.00001010
Working
01111001 = (2 x 0)^7 + (2 x 1)^6 + (2 x 1)^5 + (2 x 1)^4 + (2 x 1)^3 + (2 x 0)^2 + (2 x 0)^1 + (2 x 1)^0
= 0+64+32+16+8+0+0+1
= 121
01100100 = (2 x 0)^7 + (2 x 1)^6 + (2 x 1)^5 + (2 x 0)^4 + (2 x 0)^3 + (2 x 1)^2 + (2 x 0)^1 + (2 x 0)^0
= 0+64+32+0+0+4+0+0
= 100
11110110 = (2 x 1)^7 + (2 x 1)^6 + (2 x 1)^5 + (2 x 1)^4 + (2 x 0)^3 + (2 x 1)^2 + (2 x 1)^1 + (2 x 0)^0
= 128+64+32+16+0+4+2+0
= 246
00001010 = (2 x 0)^7 + (2 x 0)^6 + (2 x 0)^5 + (2 x 0)^4 + (2 x 1)^3 + (2 x 0)^2 + (2 x 1)^1 + (2 x 0)^0
= 0+0+0+0+8+0+2+0
= 10
d) 202.125.138.157 = 11001010.01111101.10001010.10011101
Working
11001010 = (2 x 1)^7 + (2 x 1)^6 + (2 x 0)^5 + (2 x 0)^4 + (2 x 1)^3 + (2 x 0)^2 + (2 x 1)^1 + (2 x 0)^0
= 128+64+0+0+8+0+2+0
= 202
01111101 = (2 x 0)^7 + (2 x 1)^6 + (2 x 1)^5 + (2 x 1)^4 + (2 x 1)^3 + (2 x 1)^2 + (2 x 0)^1 + (2 x 1)^0
= 0+64+32+16+8+4+0+1
= 125
10001010 = (2 x 1)^7 + (2 x 0)^6 + (2 x 0)^5 + (2 x 0)^4 + (2 x 1)^3 + (2 x 0)^2 + (2 x 1)^1 + (2 x 0)^0
= 128+0+0+0+8+0+2+0
= 138
10011101 = (2 x 1)^7 + (2 x 0)^6 + (2 x 0)^5 + (2 x 1)^4 + (2 x 1)^3 + (2 x 1)^2 + (2 x 0)^1 + (2 x 1)^0
= 128+0+0+16+8+4+0+1
= 157
- Code:
-
Solution Q.2:
Write down the HTML code for the following tasks.
a) Set the background colour of the browser window to blue, text colour to white and link colour to yellow.
<HTML>
<HEAD>
<TITLE> Assignment #1 </TITLE>
</HEAD>
<BODY BGCOLOR=”BLUE” TEXT=”WHITE” LINK=”YELLOW”>
</BODY>
</HTML>
b) Divide the browser window in 4 equal sized vertical frames. Also note that border of the frame should be invisible and user should not be able to change the size of frame.
<HTML>
<HEAD>
<TITLE> Assignment #1 </TITLE>
</HEAD>
<FRAMESET COLS="25%,25%,25%,25%" BORDER="0">
<FRAME NORESIZE>
<FRAME NORESIZE>
<FRAME NORESIZE>
<FRAME NORESIZE>
</FRAMESET>
</HTML>
c) Design a form in HTML that will contain two text boxes (ID, Password) and two buttons (Submit, Reset).
By clicking the submit button form should be submitted to
[You must be registered and logged in to see this link.] using POST method.
<HTML>
<HEAD>
<TITLE> Assignment #1 </TITLE>
<BODY>
<FORM ACTION=”http://www.vu.edu.pk” METHOD=”POST”>
I.D : <INPUT TYPE=”TEXT”>
<P>
PASSWORD : <INPUT TYPE=”TEXT”>
<P>
<INPUT TYPE=”SUBMIT” VALUE=”SUBMIT”>
<INPUT TYPE=”RESET” VALUE=”RESET”>
</FORM>
</BODY>
</HTML>