1/99
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
In the OSI reference model, IP belongs to the _______________ layer.
Network
In the TCP/IP reference model, UDP belongs to the _______________ layer.
None of these answers
In the TCP/IP reference model, IP belongs to the _______________ layer.
Internet
Match these popular protocols (services) to their port number/transport protocol.
HTTP (world wide web)
SMTP (early email)
Telnet (unsecure remote login)
SSH (secure remote login)
DNS (Domain Name System)
80 TCP
25 TCP
23 TCP
22 TCP
53 UDP
The original RFC specifying UDP was _________.
RFC 768
A UDP port number has ______________ bits.
16
Check all that apply to TCP or UDP ports.
None of these choices
In the OSI reference model, TCP belongs to the _______________ layer.
Transport
An IPv6 address has ______________ bits.
128
A TCP port number has ______________ bits.
16
These OSI reference model layers do not appear explicitly in the TCP/IP model.
Session
Presentation
Physical
The function call ServerSocket is used by ________________.
a Java TCP Server to establish a TCP server
The function call SocketServer is called by a ________________.
None of these answers
The original RFC specifying TCP was _________.
RFC 793
The highest UDP port number is __________.
65535
A (TCP or UDP) port _______
is a 16 bit number
varies from 0 to 65535
The original RFC specifying IP was
RFC 791
Check all that apply to TCP
TCP stands for Transmission Control Protocol
Is a peer-to-peer communication protocol
provides a reliable in-order byte-stream delivery stream
Adapts to a slow receiver's speed
Adapts to network congestion
Adapts to the slowest intermediary node speed
(May not have all choices listed)
In the OSI reference model, UDP belongs to the _______________ layer.
Transport
An IPv4 address has ______________ bits.
32
In the OSI reference model, socket programming functions like ntohs(), htons(), ntohl(), or htonl() belong logically to the [name1] layer.
presentation
The function call Socket is called by a ________________.
Java TCP Client to initiate a connection with a TCP server
The function call socketclient is used by a ________________.
None of these answers
Check all that apply to IP addresses.
IPv4 has 32 bits addresses
It uniquely identifies a network interface
A host cannot have multiple IP addresses at the same time
All interfaces on a host have the same IP address
IPv6 has 64 bits adresses
IPv4 has 32 bits addresses
It uniquely identifies a network interface
The call ServerSocket in Java performs these actions.
it binds to a port
it may adjust the incoming queue
it creates a socket
Match each socket function call to the sequence it will appear on a Java TCP server. The first/earliest call is assigned the number 1. The earlier is a function call, the smaller is its assigned number. The statements must be compatible (i.e., use appropriate variables from earlier valid statements).
- If a call is NOT absolutely necessary, assign it the number 99.
- If a call is NOT applicable to a TCP server socket, assign it the number 77.
- If two calls can be interchanged, assign them the same number.
b = s.getInputStream();
s = new ServerSocket(..);
a = cs.getOutputStream();
s.close()
cs = s.accept();
a.read(...)
PARTIAL (7.08/8.5)
77
1
3
99
2
4
Match each socket function call to the sequence it will appear on a Java TCP server. The first/earliest call is assigned the number 1. The earlier is a function call, the smaller is its assigned number. The statements must be compatible (i.e., use appropriate variables from earlier valid statements).
- If a call is NOT absolutely necessary, assign it the number 99.
- If a call is NOT applicable to a TCP server socket, assign it the number 77.
- If two calls can be interchanged, assign them the same number.
b = s.getInputStream();
s = new ServerSocket(..);
a = cs.getOutputStream();
s.close()
cs = s.accept();
a.write(...)
PARTIAL (7.08/8.5)
77
1
3
99
2
5
Check all that apply to UDP
-UDP offers a minimal service to the application layer
-uses a checksum to detect corrupted datagrams
Any TCP server socket program in Java must use this function call to establish a socket.
ServerSocket
The call Socket in Java performs these actions
it creates a socket
it may bind to a port
it connects to a server
Any TCP client socket program in Java must use this function call to establish a socket.
Socket
Check all that apply about TCP or UDP port numbers
they are 16 bit numbers
they range from 0 to 65535
TCP and UDP ports are independent from each other
Match each socket function call to the sequence it will appear on a Java TCP client....
Partial 1.21/8.5
b = s.getOutputStream(); 77
s = new ServerSocket(..); 1
a = cs.getInputStream(); 3
s.close() 99
cs = s.accept(); 2
b.write(...) 4
s = new Socket(..); 99
Match each socket function call to the sequence it will appear on a Java TCP client....
b = s.getInputStream(); - 77
s = new ServerSocket(..); - 1
a = cs.getInputStream(); - 3
s.close() - 99
cs = s.accept(); - 2
a.read(...) - 4
The function call DatagramSocket is used by a ________________.
Java UDP Server to establish a UDP socket
Java UDP client to establish a UDP socket
An IP address identifies ___________.
a network interface
The type of the parameter d is _____________ assuming that d is a port number.
int
The function call datagramsocket is used by a ________________. Pay attention! Java is case sensitive.
None of these answers
(There are multiple questions with different choices, but in my experience they are always "None of these Answers". Double check before proceeding.)
Any UDP client socket program in Java must use this function call to establish a socket.
DatagramSocket
The type of the parameter a is _____________ assuming that d is a port number.
byte[ ]
Check all true statements.
TCP identifies upper processes (applications) using the port number
UDP identifies upper processes (applications) using the port number
TCP identifies upper processes (applications) using the IP address
UDP identifies upper processes (applications) using the IP address
Only one port on a host can be active at a time.
TCP identifies upper processes (applications) using the port number
UDP identifies upper processes (applications) using the port number
Match each socket function call to the sequence it will appear on a Java UDP server.
s = new ServerSocket(.....)
s.receive(p)
s = new DatagramSocket(serverPort);
s.send(p)
p = new DatagramPacket(...)
s.close()
Partial 7.08/8.5
77
3
1
4
2
77
Partial 7.08/8.5
77
3
1
4
2
5
Consider the method p.send(s) where p = new DatagramSocket();
DELETE THIS
Consider the method p.receive(s) where p = new DatagramSocket();
The type of the parameter s is _____________ .
DatagramPacket
Check all statements/method calls that TCP server or client must absolutely include to send data using I/O streams a and b. The TCP server or client uses the socket variable sock.
b.write(...)
OutputStream b = sock.getOutputStream();
Any UDP server socket program in Java must use this function call to establish a socket.
DatagramSocket
Consider the method DatagramPacket(a, b, c, d).
The type of the parameter b is _____________ assuming that d is a port number.
int
Consider the method DatagramPacket(a, b, c, d).
The type of the parameter a is _____________ assuming that d is a port number.
byte[]
Consider the method DatagramPacket(a, b, c, d).
The type of the parameter d is _____________ assuming that d is a port number.
int
The function call socketserver is called by a ________________. (Pay attention! Java is case sensitive)
None of these answers
The method DatagramSocket() returns a result of type _________.
DatagramSocket
Match each socket function call to the sequence it will appear on a Java UDP client.
cs = s.accept()
s.receive(p)
s = new DatagramSocket(serverPort);
s.send(p)
p = new DatagramPacket(...)
s.close()
PARTIAL(4.25/8.5):
cs = s.accept()-77
s.receive(p)-4
s = new DatagramSocket(serverPort);-1
s.send(p)-2
p = new DatagramPacket(...)-3
s.close()-5
Consider the method DatagramPacket(a, b, c, d).
The type of the parameter c is _____________ assuming that d is a port number.
inetAddress
The method DatagramPacket(a, b, c, d) returns a result of type _________.
None of these answers
The highest TCP port number is __________.
65535
Check all that apply to TCP.
Partial (5/10)
TCP stands for Transmission Control Protocol
Consider this code snapshot:
String str = new String("CD456");
byte[] a = str.getBytes();
The content of a[2] is ___________.
52
Consider this code snapshot:
String str = new String("CD456");
byte[] a = str.getBytes();
The content of a[5] is ___________.
invalid
Consider this code snapshot:
String str = new String("CD456");
byte[] a = str.getBytes("UTF-16");
The content of a[2] is ___________.
0
Consider this code snapshot:
String str = new String("CD456");
byte[] a = str.getBytes("UTF-16");
The content of a[5] is ___________.
68
Consider this code snapshot:
String str = new String("CD456");
byte[] a = str.getBytes("UTF-16BE");
The content of a[7] is ___________.
None of these answers
Consider this code snapshot:
String str = new String("CD456");
byte[] a = str.getBytes("UTF-16");
The content of a[3] is ___________.
67
Check all that apply.
During the lecture, we encoded the three boolean members single, rich, and female using one byte b using the following rules as illustrated by this figure:
bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0
0 0 0 0 0 female rich single
- bit 0 is the least significant bit. bit 0 is set to 1 if the friend is single.
- bit 1 is set to 1 if the friend is rich.
- bit 2 is set to 1 if the friend is female.
Suppose that after encoding the three boolean members single, rich, and female of a friend f into a byte b, we get b = 0x6. Check all that apply about the friend f.
rich
female
Consider this code snapshot:
String str = new String("CD456");
byte[] a = str.getBytes("UTF-16BE");
The content of a[3] is ___________.
68
Consider this code snapshot:
String str = new String("CD456");
byte[] a = str.getBytes();
The content of a[3] is ___________.
None of these answers
Consider this code snapshot:
String str = new String("CD456");
byte[] a = str.getBytes("UTF-16BE");
The content of a[4] is ___________.
0
Consider this code snapshot:
String str = new String("CD456");
byte[] a = str.getBytes("UTF-16BE");
The content of a[0] is ___________.
0
During the lecture, we encoded the three boolean members single, rich, and female using one byte b using the following rules as illustrated by this figure:
bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0
0 0 0 0 0 female rich single
- bit 0 is the least significant bit. bit 0 is set to 1 if the friend is single.
- bit 1 is set to 1 if the friend is rich.
- bit 2 is set to 1 if the friend is female.
Suppose that after encoding the three boolean members single, rich, and female of a friend f into a byte b, we get b = 0x5. Check all that apply about the friend f.
female
single
Consider this incomplete code snapshot:
int a, e;
short b, f;
byte g;
DataOutputStream c;
DatagramSocket d;
InputStream w;
ByteArrayOutStream x = new ByteArrayOutputStream();
c = new DataOutputStream(x);
DataInputStream s = new DataInputStream(w);
If I write a statement d.send(m), m is most likely of type __________.
DatagramPacket
Consider this code snapshot:
int a, e;
short b, f;
byte g;
DataOutputStream c;
DataInputStream d;
ByteArrayOutStream x = new ByteArrayOutputStream();
c = new DataOutputStream(x);
Select the most likely valid statement to encode data to be sent out using TCP or UDP sockets.
c.writeInt(a);
Consider this code snapshot:
int a, e;
short b, f;
byte g;
DataOutputStream c;
DataInputStream d;
ByteArrayOutStream x = new ByteArrayOutputStream();
c = new DataOutputStream(x);
Select the most likely valid statement to encode data to be sent out using TCP or UDP sockets.
c.writeShort(b);
Consider this code snapshot:
int a, e;
short b, f;
byte g;
DataOutputStream c;
DataInputStream d;
ByteArrayOutStream x = new ByteArrayOutputStream();
c = new DataOutputStream(x);
Select the most likely valid statement to encode data to be sent out using TCP or UDP sockets.
c.writeByte(g);
Consider this code snapshot:
String str = new String("CD456");
byte[] a = str.getBytes("UTF-16");
The content of a[0] is ___________.
None of these answers
Consider this code snapshot:
String str = new String("CD456");
byte[] a = str.getBytes("UTF-16");
The content of a[6] is ___________.
0
Consider this code snapshot:
String str = new String("CD456");
byte[] a = str.getBytes();
The content of a[0] is ___________.
67
Consider this variable:
byte flags;
The expression ((flags & 4) == 4) is of type ____________.
boolean
Consider this incomplete code snapshot:
int a, e;
long h;
short b, f;
byte g;
DataOutputStream c;
DatagramSocket d;
InputStream m;
ByteArrayOutStream x = new ByteArrayOutputStream();
c = new DataOutputStream(x);
DataInputStream v = new DataInputStream(m);
Select any valid statement.
h = v.readLong();
Consider this code snapshot:
String str = new String("CD456");
byte[] a = str.getBytes("UTF-16BE");
The content of a[9] is ___________.
54
Select the best answer.
Assume you just received data is stored in network byte order. Below is a snapshot of the data memory storing data. The first column is the address while second one is the data at that address.
The integer (short) variable at address 0x1004 is ___________.
Address Content
0x1000 0x34
0x1001 0xB4
0x1002 0x20
0x1003 0xAE
0x1004 0x42
0x1005 0x67
0x1006 0x19
0x1007 0x3C
0x1008 0x8C
0x4267
Check all that apply.
During the lecture, we encoded the three boolean members single, rich, and female using one byte b using the following rules as illustrated by this figure:
bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0
0 0 0 0 0 female rich single
- bit 0 is the least significant bit. bit 0 is set to 1 if the friend is single.
- bit 1 is set to 1 if the friend is rich.
- bit 2 is set to 1 if the friend is female.
Suppose that after encoding the three boolean members single, rich, and female of a friend f into a byte b, we get b = 0x7. Check all that apply about the friend f.
rich
single
female
Select the best answer.
Assume you just prepared data stored in little endian order. Below is a snapshot of the data memory storing data. The first column is the address while second one is the data at that address.
The integer (short) variable at address 0x1004 is ___________.
Address Content
0x1000 0x34
0x1001 0xB4
0x1002 0x20
0x1003 0xAE
0x1004 0x42
0x1005 0x67
0x1006 0x19
0x1007 0x3C
0x1008 0x8C
0x6742
Select the best answer.
Assume you just prepared data stored in little endian order. Below is a snapshot of the data memory storing data. The first column is the address while second one is the data at that address.
The integer (int) variable at address 0x1002 is ___________.
Address Content
0x1000 0x34
0x1001 0xB4
0x1002 0x20
0x1003 0xAE
0x1004 0x42
0x1005 0x67
0x1006 0x19
0x1007 0x3C
0x1008 0x8C
0x6742AE20
Select the best answer.
Assume you just prepared data stored in little endian order. Below is a snapshot of the data memory storing data. The first column is the address while second one is the data at that address.
The integer (short) variable at address 0x1002 is ___________.
Address Content
0x1000 0x34
0x1001 0xB4
0x1002 0x20
0x1003 0xAE
0x1004 0x42
0x1005 0x67
0x1006 0x19
0x1007 0x3C
0x1008 0x8C
0xAE20
Select the best answer.
Consider this code snapshot:
String str = new String("CD456");
byte[] a = str.getBytes("UTF-16BE");
The content of a[1] is ___________.
67
Select the best answer.
Consider this incomplete code snapshot:
int a, e;
long h;
short b, f;
byte g;
DataOutputStream c;
DatagramSocket d;
InputStream m;
ByteArrayOutStream x = new ByteArrayOutputStream();
c = new DataOutputStream(x);
DataInputStream v = new DataInputStream(m);
Select any valid statement.
e = v.readInt();
Select the best answer.
Assume you just received data is stored in network byte order. Below is a snapshot of the data memory storing data. The first column is the address while second one is the data at that address.
The integer (int) variable at address 0x1000 is ___________.
Address Content
0x1000 0x34
0x1001 0xB4
0x1002 0x20
0x1003 0xAE
0x1004 0x42
0x1005 0x67
0x1006 0x19
0x1007 0x3C
0x1008 0x8C
0x20AE
None of these answers
0x6742AE20
0x20AE4267
0xAE20
None of these answers
Assume you just received data is stored in network byte order. Below is a snapshot of the data memory storing data. The first column is the address while second one is the data at that address.
The integer (short) variable at address 0x1006 is ___________.
Address Content
0x1000 0x34
0x1001 0xB4
0x1002 0x20
0x1003 0xAE
0x1004 0x42
0x1005 0x67
0x1006 0x19
0x1007 0x3C
0x1008 0x8C
None of these answers (answer is 193C)
Assume you just prepared data stored in little endian order. Below is a snapshot of the data memory storing data. The first column is the address while second one is the data at that address.
The integer (int) variable at address 0x1004 is ___________.
Address Content
0x1000 0x34
0x1001 0xB4
0x1002 0x20
0x1003 0xAE
0x1004 0x42
0x1005 0x67
0x1006 0x19
0x1007 0x3C
0x1008 0x8C
0x3C196742
Assume you just received data is stored in network byte order. Below is a snapshot of the data memory storing data. The first column is the address while second one is the data at that address.
The integer (short) variable at address 0x1002 is ___________.
Address Content
0x1000 0x34
0x1001 0xB4
0x1002 0x20
0x1003 0xAE
0x1004 0x42
0x1005 0x67
0x1006 0x19
0x1007 0x3C
0x1008 0x8C
0x20AE
Consider this code snapshot:
String str = new String("CD456");
byte[] a = str.getBytes("UTF-16");
The content of a[1] is ___________.
None of these answers
During the lecture, we encoded the three boolean members single, rich, and female using one byte b using the following rules as illustrated by this figure:
bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0
0 0 0 0 0 female rich single
- bit 0 is the least significant bit. bit 0 is set to 1 if the friend is single.
- bit 1 is set to 1 if the friend is rich.
- bit 2 is set to 1 if the friend is female.
Suppose that after encoding the three boolean members single, rich, and female of a friend f into a byte b, we get b = 0x3. Check all that apply about the friend f.
single
rich
Consider this incomplete code snapshot:
int a, e;
long h;
short b, f;
byte g;
DataOutputStream c;
DatagramSocket d;
InputStream m;
ByteArrayOutStream x = new ByteArrayOutputStream();
c = new DataOutputStream(x);
DataInputStream v = new DataInputStream(m);
Select any valid statement.
None of these answers
f = v.readInt();
f = v.readLong();
f = c.readInt();
f = c.readLong();
None of these answers
Consider this code snapshot:
int a, e;
short b, f;
byte g;
DataOutputStream c;
DataInputStream d;
ByteArrayOutStream x = new ByteArrayOutputStream();
c = new DataOutputStream(x);
If I write a statement c.write(y,0,8), y is most likely of type __________.
byte[]
Check all statements/method calls that TCP server or client must absolutely include to receive data using I/O streams a and b. The TCP server or client uses the socket variable sock.
b.write(...)
b.read(......)
OutputStream b = sock.getOutputStream();
None of these answers
InputStream a = sock.getInputStream();
InputStream a = sock.getInputStream();
Check all that apply.
During the lecture, we encoded the three boolean members single, rich, and female using one byte b using the following rules as illustrated by this figure:
bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0
0 0 0 0 0 female rich single
- bit 0 is the least significant bit. bit 0 is set to 1 if the friend is single.
- bit 1 is set to 1 if the friend is rich.
- bit 2 is set to 1 if the friend is female.
Suppose that after encoding the three boolean members single, rich, and female of a friend f into a byte b, we get b = 0x0. Check all that apply about the friend f.
None of these answers
The function call Socket is used by a ________________.
None of these answers
The expression (flags & 4) is of type ____________.
NOT boolean
NOT byte
NOT None of these Answers
Matching.
Match each socket function call to the sequence it will appear on a Java TCP server. The first/earliest call is assigned the number 1. The earlier is a function call, the smaller is its assigned number. The statements must be compatible (i.e., use appropriate variables from earlier valid statements).
- If a call is NOT absolutely necessary, assign it the number 99.
- If a call is NOT applicable to a TCP server socket, assign it the number 77.
- If two calls can be interchanged, assign them the same number.
b = s.getInputStream();
s = new ServerSocket(..);
a = cs.getInputStream();
s.close()
cs = s.accept();
a.read(...)
b = s.getInputStream(); - 77
s = new ServerSocket(..); - 1
a = cs.getInputStream(); - 3
s.close() - 99
cs = s.accept(); - 2
a.read(...) - 4
The Internet is a network covering typically _____
A planet
Transmission lines on WANs are in general made of _______.
Radio links
optical fiber
copper wire