M1 & M2

0.0(0)
studied byStudied by 0 people
GameKnowt Play
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/99

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

100 Terms

1
New cards

In the OSI reference model, IP belongs to the _______________ layer.

Network

2
New cards

In the TCP/IP reference model, UDP belongs to the _______________ layer.

None of these answers

3
New cards

In the TCP/IP reference model, IP belongs to the _______________ layer.

Internet

4
New cards

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

5
New cards

The original RFC specifying UDP was _________.

RFC 768

6
New cards

A UDP port number has ______________ bits.

16

7
New cards

Check all that apply to TCP or UDP ports.

None of these choices

8
New cards

In the OSI reference model, TCP belongs to the _______________ layer.

Transport

9
New cards

An IPv6 address has ______________ bits.

128

10
New cards

A TCP port number has ______________ bits.

16

11
New cards

These OSI reference model layers do not appear explicitly in the TCP/IP model.

Session

Presentation

Physical

12
New cards

The function call ServerSocket is used by ________________.

a Java TCP Server to establish a TCP server

13
New cards

The function call SocketServer is called by a ________________.

None of these answers

14
New cards

The original RFC specifying TCP was _________.

RFC 793

15
New cards

The highest UDP port number is __________.

65535

16
New cards

A (TCP or UDP) port _______

is a 16 bit number

varies from 0 to 65535

17
New cards

The original RFC specifying IP was

RFC 791

18
New cards

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)

19
New cards

In the OSI reference model, UDP belongs to the _______________ layer.

Transport

20
New cards

An IPv4 address has ______________ bits.

32

21
New cards

In the OSI reference model, socket programming functions like ntohs(), htons(), ntohl(), or htonl() belong logically to the [name1] layer.

presentation

22
New cards

The function call Socket is called by a ________________.

Java TCP Client to initiate a connection with a TCP server

23
New cards

The function call socketclient is used by a ________________.

None of these answers

24
New cards

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

25
New cards

The call ServerSocket in Java performs these actions.

it binds to a port

it may adjust the incoming queue

it creates a socket

26
New cards

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

27
New cards

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

28
New cards

Check all that apply to UDP

-UDP offers a minimal service to the application layer

-uses a checksum to detect corrupted datagrams

29
New cards

Any TCP server socket program in Java must use this function call to establish a socket.

ServerSocket

30
New cards

The call Socket in Java performs these actions

it creates a socket

it may bind to a port

it connects to a server

31
New cards

Any TCP client socket program in Java must use this function call to establish a socket.

Socket

32
New cards

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

33
New cards

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

34
New cards

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

35
New cards

The function call DatagramSocket is used by a ________________.

Java UDP Server to establish a UDP socket

Java UDP client to establish a UDP socket

36
New cards

An IP address identifies ___________.

a network interface

37
New cards

The type of the parameter d is _____________ assuming that d is a port number.

int

38
New cards

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.)

39
New cards

Any UDP client socket program in Java must use this function call to establish a socket.

DatagramSocket

40
New cards

The type of the parameter a is _____________ assuming that d is a port number.

byte[ ]

41
New cards

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

42
New cards

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

43
New cards

Consider the method p.send(s) where p = new DatagramSocket();

DELETE THIS

44
New cards

Consider the method p.receive(s) where p = new DatagramSocket();

The type of the parameter s is _____________ .

DatagramPacket

45
New cards

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();

46
New cards

Any UDP server socket program in Java must use this function call to establish a socket.

DatagramSocket

47
New cards

Consider the method DatagramPacket(a, b, c, d).

The type of the parameter b is _____________ assuming that d is a port number.

int

48
New cards

Consider the method DatagramPacket(a, b, c, d).

The type of the parameter a is _____________ assuming that d is a port number.

byte[]

49
New cards

Consider the method DatagramPacket(a, b, c, d).

The type of the parameter d is _____________ assuming that d is a port number.

int

50
New cards

The function call socketserver is called by a ________________. (Pay attention! Java is case sensitive)

None of these answers

51
New cards

The method DatagramSocket() returns a result of type _________.

DatagramSocket

52
New cards

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

53
New cards

Consider the method DatagramPacket(a, b, c, d).

The type of the parameter c is _____________ assuming that d is a port number.

inetAddress

54
New cards

The method DatagramPacket(a, b, c, d) returns a result of type _________.

None of these answers

55
New cards

The highest TCP port number is __________.

65535

56
New cards

Check all that apply to TCP.

Partial (5/10)

TCP stands for Transmission Control Protocol

57
New cards

Consider this code snapshot:

String str = new String("CD456");

byte[] a = str.getBytes();

The content of a[2] is ___________.

52

58
New cards

Consider this code snapshot:

String str = new String("CD456");

byte[] a = str.getBytes();

The content of a[5] is ___________.

invalid

59
New cards

Consider this code snapshot:

String str = new String("CD456");

byte[] a = str.getBytes("UTF-16");

The content of a[2] is ___________.

0

60
New cards

Consider this code snapshot:

String str = new String("CD456");

byte[] a = str.getBytes("UTF-16");

The content of a[5] is ___________.

68

61
New cards

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

62
New cards

Consider this code snapshot:

String str = new String("CD456");

byte[] a = str.getBytes("UTF-16");

The content of a[3] is ___________.

67

63
New cards

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

64
New cards

Consider this code snapshot:

String str = new String("CD456");

byte[] a = str.getBytes("UTF-16BE");

The content of a[3] is ___________.

68

65
New cards

Consider this code snapshot:

String str = new String("CD456");

byte[] a = str.getBytes();

The content of a[3] is ___________.

None of these answers

66
New cards

Consider this code snapshot:

String str = new String("CD456");

byte[] a = str.getBytes("UTF-16BE");

The content of a[4] is ___________.

0

67
New cards

Consider this code snapshot:

String str = new String("CD456");

byte[] a = str.getBytes("UTF-16BE");

The content of a[0] is ___________.

0

68
New cards

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

69
New cards

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

70
New cards

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);

71
New cards

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);

72
New cards

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);

73
New cards

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

74
New cards

Consider this code snapshot:

String str = new String("CD456");

byte[] a = str.getBytes("UTF-16");

The content of a[6] is ___________.

0

75
New cards

Consider this code snapshot:

String str = new String("CD456");

byte[] a = str.getBytes();

The content of a[0] is ___________.

67

76
New cards

Consider this variable:

byte flags;

The expression ((flags & 4) == 4) is of type ____________.

boolean

77
New cards

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();

78
New cards

Consider this code snapshot:

String str = new String("CD456");

byte[] a = str.getBytes("UTF-16BE");

The content of a[9] is ___________.

54

79
New cards

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

80
New cards

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

81
New cards

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

82
New cards

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

83
New cards

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

84
New cards

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

85
New cards

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();

86
New cards

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

87
New cards

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)

88
New cards

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

89
New cards

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

90
New cards

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

91
New cards

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

92
New cards

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

93
New cards

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[]

94
New cards

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();

95
New cards

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

96
New cards

The function call Socket is used by a ________________.

None of these answers

97
New cards

The expression (flags & 4) is of type ____________.

NOT boolean

NOT byte

NOT None of these Answers

98
New cards

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

99
New cards

The Internet is a network covering typically _____

A planet

100
New cards

Transmission lines on WANs are in general made of _______.

Radio links

optical fiber

copper wire