Deck 10: Multithreading Networks and Client Server Programming
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/50
العب
ملء الشاشة (f)
Deck 10: Multithreading Networks and Client Server Programming
1
Time-sharing systems are still in widespread use in the form of Web servers, e-mail servers, print servers, and other kinds of servers on networked systems.
True
2
A thread object can die if it raises an exception that is not handled.
True
3
The most common way to create a thread is to define a class that extends the class threading.Runnable.
False
4
Clients connect to servers via objects known as channels.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
5
Producer/consumer threads can suffer from synchronization problems.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
6
A port serves as a channel through which several clients can exchange data with the same server or with different servers.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
7
Ports are usually specified by IP addresses.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
8
Because an IDLE itself runs in a thread, it is not generally a good idea to test a multithreaded application in that environment.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
9
The late 1960s and early 1970s saw the rise of networked systems.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
10
Threads cannot share data between them.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
11
You cannot create and open several sockets on the same port of a host computer.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
12
The process of saving or restoring a thread's state is called a scheduling switch.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
13
A thread's block method is invoked automatically by start.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
14
When developing a network application, the programmer can first try it out on a local host-that is, on a standalone computer that may or may not be connected to the Internet.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
15
In Python, a thread is an object like any other in that it can hold data, be run with methods, be stored in data structures, and be passed as parameters to methods.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
16
To properly handle functions that may raise exceptions, you can embed these function calls in a try-catch statement.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
17
The release() method of the Condition class relinquishes the lock, leaving it to be acquired by others.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
18
Few modern computers use threads to represent processes.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
19
When a thread's run method has executed its last instruction, the thread dies as a process but continues to exist as an object.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
20
The notify() method of the Condition class lets all threads waiting on the lock know that it's available.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
21
What thread method can be used to test if the thread is dead or not?
A) isDead()
B) isAlive()
C) isActive()
D) isQueued()
A) isDead()
B) isAlive()
C) isActive()
D) isQueued()
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
22
After the creation of a thread, what makes a thread "ready"?
A) The calling of the start method.
B) The calling of the ready method.
C) The instantiation of the thread, followed by the use of the "begin" function.
D) The creation of the thread itself places it in a "ready" state.
A) The calling of the start method.
B) The calling of the ready method.
C) The instantiation of the thread, followed by the use of the "begin" function.
D) The creation of the thread itself places it in a "ready" state.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
23
What two thread condition methods can be used to release a lock? (Choose two.)
A) notify()
B) release()
C) notifyAll()
D) wait()
A) notify()
B) release()
C) notifyAll()
D) wait()
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
24
A server can send data to a client using a socket's put method.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
25
A socket resembles a file object, in that the programmer opens it, receives data from it, and closes it when finished.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
26
The procedure by which a process's state is saved before being swapped out of the CPU, then us restored to the state when the process is about to execute, is known as?
A) processing handling
B) context switching
C) state cycling
D) priority slicing
A) processing handling
B) context switching
C) state cycling
D) priority slicing
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
27
What does the socket module function gethostname() do?
A) It returns the IP number of the computer whose IP name is passed to the function.
B) It returns the IP address of the host computer running the Python interpreter.
C) It returns the name of the host computer running the Python interpreter.
D) It returns the name of the IP address passed to it.
A) It returns the IP number of the computer whose IP name is passed to the function.
B) It returns the IP address of the host computer running the Python interpreter.
C) It returns the name of the host computer running the Python interpreter.
D) It returns the name of the IP address passed to it.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
28
When working with sockets, it is important to synchronize the sending and the receiving of messages between the client and the server.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
29
What two Python data structures are already thread-safe, because they provide automatic support for synchronizing multiple readers and writers? (Choose two.)
A) tuples
B) strings
C) lists
D) dictionaries
A) tuples
B) strings
C) lists
D) dictionaries
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
30
What statement accurately describes the role of a socket?
A) A socket is an object that serves as a communication link between a single server process and a single client process.
B) A socket is a named pipe that is used to pass communications one way to a remote location.
C) A socket is a unique computer resource that provides access to hardware.
D) A socket is a communications channel within the TCP/IP stack that communicates only with the localhost.
A) A socket is an object that serves as a communication link between a single server process and a single client process.
B) A socket is a named pipe that is used to pass communications one way to a remote location.
C) A socket is a unique computer resource that provides access to hardware.
D) A socket is a communications channel within the TCP/IP stack that communicates only with the localhost.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
31
Using the "gethostbyname('localhost')" function of the socket module will return what IP address?
A) 10.0.0.1
B) 127.0.0.1
C) 169.254.1.1
D) 192.168.1.1
A) 10.0.0.1
B) 127.0.0.1
C) 169.254.1.1
D) 192.168.1.1
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
32
What is the purpose of a condition object in a threaded application?
A) The condition object functions as a lock on a resource.
B) The condition object provides a similar function to if-else in threads.
C) The condition object provides a try-except function in threads.
D) The condition object functions as a timer for the ready-queue.
A) The condition object functions as a lock on a resource.
B) The condition object provides a similar function to if-else in threads.
C) The condition object provides a try-except function in threads.
D) The condition object functions as a timer for the ready-queue.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
33
The discipline of building hardware architectures, operating systems, and specialized algorithms for running a program on a cluster of processors is known by what term?
A) multi-computing
B) resource sharing
C) process distributing
D) parallel computing
A) multi-computing
B) resource sharing
C) process distributing
D) parallel computing
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
34
A thread that is waiting for user input is most likely in what state?
A) A time-out state.
B) A sleeping state.
C) A blocking state.
D) A wait state.
A) A time-out state.
B) A sleeping state.
C) A blocking state.
D) A wait state.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
35
A socket is bound to an address (host, port) by running its bind method.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
36
What two items must be passed in a tuple to the socket module's connect method in order to connect a socket? (Choose two.)
A) The target host's IP address.
B) The protocol type that will be used.
C) The operating system used by the host.
D) A valid port number.
A) The target host's IP address.
B) The protocol type that will be used.
C) The operating system used by the host.
D) A valid port number.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
37
In the event that a thread loses access to the CPU, such as via a time-out, sleep, block, or wait state, what happens when the thread is ready to resume execution?
A) The thread is moved to the front of the ready-queue.
B) The thread is moved to the rear of the ready-queue.
C) The thread is given a chance to execute as soon as the running process enters a wait state.
D) The thread is given a random interval to check if it is the thread's turn to execute, or if the processor is available.
A) The thread is moved to the front of the ready-queue.
B) The thread is moved to the rear of the ready-queue.
C) The thread is given a chance to execute as soon as the running process enters a wait state.
D) The thread is given a random interval to check if it is the thread's turn to execute, or if the processor is available.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
38
What kind of problem occurs in a producer/consumer relationship in which the consumer attempts to access data that are not there, or accesses the same data more than once?
A) procedural problems
B) communication problems
C) coordination problems
D) synchronization problems
A) procedural problems
B) communication problems
C) coordination problems
D) synchronization problems
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
39
The Python function time.currenttime returns a string representing the day/time.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
40
In order to execute code in a thread as a process, what must be done?
A) The thread's class must implement a run method.
B) The thread's class must implement an exec method.
C) The thread must include the "process" class as a parent.
D) The thread must be told to execute using the exec=yes key.
A) The thread's class must implement a run method.
B) The thread's class must implement an exec method.
C) The thread must include the "process" class as a parent.
D) The thread must be told to execute using the exec=yes key.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
41
What two items must be given to the socket function in order to create a socket object?
A) The IP address to be used.
B) The socket family that will be used.
C) The socket type that will be used.
D) The socket port that will be used.
A) The IP address to be used.
B) The socket family that will be used.
C) The socket type that will be used.
D) The socket port that will be used.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
42
When a client connects to a server, what does the socket accept method return?
A) A string containing the client's IP address.
B) A list containing the client's IP address and port.
C) A tuple containing the client's socket and its address information.
D) A bytes object containing the client's IP address.
A) A string containing the client's IP address.
B) A list containing the client's IP address and port.
C) A tuple containing the client's socket and its address information.
D) A bytes object containing the client's IP address.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
43
A program starting another program or a new process is known by what term?
A) spawning
B) forking
C) cloning
D) generating
A) spawning
B) forking
C) cloning
D) generating
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
44
In order to utilize the socket module's recv method, what must you pass as an argument?
A) The source IP address the information will be coming from.
B) The destination port you will receive information on.
C) The maximum size in bytes of the data to be read from the socket.
D) The address family used by the network socket.
A) The source IP address the information will be coming from.
B) The destination port you will receive information on.
C) The maximum size in bytes of the data to be read from the socket.
D) The address family used by the network socket.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
45
After using the socket.recv method, what type of data is returned?
A) An object of type bytes.
B) A list object containing lines of data separated by carriage returns.
C) A string containing all data that was received.
D) A Boolean value indicating whether the receive was successful.
A) An object of type bytes.
B) A list object containing lines of data separated by carriage returns.
C) A string containing all data that was received.
D) A Boolean value indicating whether the receive was successful.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
46
Assuming that a socket has been created with a name of server, what effect does the server.listen(10) have?
A) The socket will listen for a maximum of 10 minutes, and then close.
B) The socket will allow a maximum of 10 connections, then close.
C) The socket will accept a maximum of 10 concurrent connections.
D) The socket will listen until the integer "10" is seen in the data stream.
A) The socket will listen for a maximum of 10 minutes, and then close.
B) The socket will allow a maximum of 10 connections, then close.
C) The socket will accept a maximum of 10 concurrent connections.
D) The socket will listen until the integer "10" is seen in the data stream.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
47
What is the socket bind method used for?
A) It binds the socket to a IP address.
B) It binds the socket to a port.
C) It binds the socket to a listening pipe.
D) It binds the socket to the localhost.
A) It binds the socket to a IP address.
B) It binds the socket to a port.
C) It binds the socket to a listening pipe.
D) It binds the socket to the localhost.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
48
You have just captured data using the socket.recv method into a variable named client_data. What can you use to convert client_data to a string?
A) codecs.decode(client_data, "string")
B) socket.decode(client_data, type="string")
C) codecs.decode(client_data, 'ascii')
D) network.data(client_data, %s)
A) codecs.decode(client_data, "string")
B) socket.decode(client_data, type="string")
C) codecs.decode(client_data, 'ascii')
D) network.data(client_data, %s)
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
49
You are designing a script that needs to get the current date and time as a string. What function can you use for this?
A) time.ptime
B) time.ctime
C) time.today
D) time.now
A) time.ptime
B) time.ctime
C) time.today
D) time.now
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
50
Which of the following is an example of time slicing?
A) A running process is automatically moved to the rear of the ready queue after a few milliseconds of run time.
B) A process is put to sleep as a result of the sleep method, and moves to the rear of the ready queue.
C) A process is waiting for input from a user and is moved to the rear of the ready queue.
D) A process is waiting for a condition to become true, and is moved to the rear of the ready queue.
A) A running process is automatically moved to the rear of the ready queue after a few milliseconds of run time.
B) A process is put to sleep as a result of the sleep method, and moves to the rear of the ready queue.
C) A process is waiting for input from a user and is moved to the rear of the ready queue.
D) A process is waiting for a condition to become true, and is moved to the rear of the ready queue.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck