Sei sulla pagina 1di 9

SOCKET

PROGRAMMIN
G

AND
THREADING

Socket Programming and Threading


Video Link:
https://www.youtube.com/watch?v=4-vZtIUqIz8&feature=youtu.be

MCQs:

1-What is true about threads?


a) Threads consumes CPU in best possible manner
b) Threads enables multi-processing.
c) Multi-threading reduces idle time of CPU
d) All
2-What are valid points about thread
a) Thread are subdivision of Process.
b) One or more Threads runs in the context of process.
c) Threads can execute any part of process. And same part of process
d) All

3-Which of these is not a Thread state?


a) New
b) Runnable
c) Sleep
d) Terminated
4-How can Thread go from waiting to runnable state?
a) Notify

b) When sleep time is up


c) Using resume () method when thread was suspended
5- The time required to create a new thread in an existing process is
a) greater than the time required to create a new process
c) less than the time required to create a new process
c) equal to the time required to create a new process
d) none of the mentioned
6-Termination of the process terminates
a) first thread of the process
b) first two threads of the process
c) all threads within the process
d) no thread within the process

7- Thread synchronization is required because


a) all threads of a process share the same address space
b) all threads of a process share the same global variables
c) all threads of a process can share the same files
d) all of the mentioned
8-When the event for which a thread is blocked occurs,
a) thread moves to the ready queue
b) thread remains blocked
c) thread completes
d) a new thread is provided

9- Which of the following will not directly cause a thread to stop?


a)
b)
c)
d)

Notify
Wait
InputStream access
Sleep

10-What state does Thread enter in when it has been created and started?
a) New
b) Runnable

c) Sleep
d) Terminated

11- What are valid point about processes?


a) Processes have their own copy of the data segment of the parent process
b) Threads have direct access to the data segment of its process
c)
Processes
have
their
own
address
d) All of these
12-How can we create Thread?
a) By Extending Thread class
b) Implementing Runnable interface
c) By using Executor framework - which can internally form threads
d) All
13-A thread can acquire a lock by using which reserved keyword?
a) volatile
b) Synchronized
c) Locked
d) None

14-Which is thread safe?


a) StringBuffer
b) StringBuilder
c) All
d) None
15-synchronized instance methods acquire lock on?
a) Object
b) Runnable
c) Running
d) Waiting

16-What is valid about threads


a) Threads have their own heap allocated area.
b) Threads have their own stack.
c) Threads doesn't have own stack.
d) None
17-How can you ensure all threads that started from main must end in order in which
they started and also main should end in last
a) Join () method
b) sleep () method
c) wait () method
d) run () method
18-What are valid statements for suspend () and resume () method?
a) Suspend() method is deadlock prone.
b) If the target thread holds a lock on object when it is suspended, no thread can
lock this object until the target thread is resumed.
c) If the thread that would resume the target thread attempts to lock this monitor
prior to calling resume, it results in deadlock formation.
d) All
19-What is difference between starting thread with run () and start () method?
a) There is no difference
b) When you call start () method, main thread internally calls run () method to
start newly created Thread
c) Run () calls start() method internally
d) None
20-What state does Thread enter in when it has been created and started?
a) New
b) Runnable
c) Running
d) Waiting

21-SOCK_DGRAM sockets are used by ______ processes.


a)
b)
c)
d)

UDP
TCP
SCTP
None

22-SOCK_DGRAM sockets are used by ______ processes.


a)
b)
c)
d)

UDP
TCP
SCTP
None

23- SOCK_STREAM sockets are used by ______ processes.


a)
b)
c)
d)

UDP
TCP
SCTP
None

24- Communication using TCP is usually____________.


a)
b)
c)
d)

connectionless, iterative
connectionless, concurrent
connection-oriented, iterative
connection-oriented, concurrent

25- Communication using UDP is usually____________.


a) connectionless, iterative
b) connectionless, concurrent
c) connection-oriented, iterative
d) connection-oriented, concurrent
26- In __________ representation, the most significant byte is stored in the starting
address.
a) big-endian
b) little-endian
c) middle-endian
d) None of the choices are correct
27-In __________ representation, the least significant byte is stored in the starting
address.
a) big-endian
b) little-endian
c) middle-endian

d) None of the choices are correct


28- Network programming needs information to be in __________ byte order.
a) Host
b) Network
c) Server
d) None
29- Information in a computer is stored in __________ byte order.
a) Host
b) Network
c) Server
d) None
30- A _______ is a program requesting services from a _______ .
a) server; client
b) client; server
c) client: client
d) None
31- ________ server can process only one request at a time.
a) An iterative
b) A concurrent
c) A concurrent or an iterative
d) None of the choices are correct
32- ________ server can process multiple requests at a time.
a) An iterative
b) A concurrent
c) A concurrent or an iterative
d) None of the choices are correct
33- An interface is a set of ___________ designed to facilitate interaction between two
entities.
a) Programs
b) Instructions
c) Rules
d) None
34- A _______ is a program providing services to the ______ program.
a)
server; client
b) client; server
c) client: client
d) None
35-Which method is called when a thread is blocked from running temporarily?
a) Pulse()
b) PulseAll()
c) Wait()

d) Both b & c
36- SOCK_SEQPACKET sockets are used by ______ processes.
a) UDP
b) TCP
c) SCTP
d) None
37- SOCK_RAW sockets are used by ______ processes.
a) UDP
b) TCP
c) SCTP
d) None
38- A thread can acquire a lock by using which reserved keyword?
a)
b)
c)
d)

Volatile
Synchronized
Locked
None

39- URL is an acronym for?


a)
b)
c)
d)

Uniform Resource Locator


Unified Resource Locator
Uniform Restore Locator
Unified Restore Locator

40- Which keyword is used for using the synchronization features defined by the
Monitor class?
a)
b)
c)
d)

Lock
Synchronized
Moniter
Locked

Reference:
https://www.udemy.com/tcpip-socket-programming-for-coders-using-csharp-net/
http://highered.mheducation.com/sites/0073376043/student_view0/chapter_17__multiple_choice_quiz.html
http://www.sanfoundry.com/csharp-mcqs-multithreaded-programming-2/
http://www.sanfoundry.com/csharp-mcqs-multithreaded-programming-1/

http://www.javamadesoeasy.com/2015/10/threadmulti-threading-quiz-in-java-mcq.html

Potrebbero piacerti anche