Você está na página 1de 5

Presentation Title: Socket Programming and threading using C#

Video Link: https://youtu.be/_5jq8v6X_fo

Repository Link:
https://www.dropbox.com/s/drqbxvqvdahd1hi/SOCKET%20PROGRAMMING%20and%20Threading%
20C%23.rar?dl=0

Members List
Member Roll No

Name

CGPA

BCSF13M053

Aleena Raza

2.75

BCSF13M041

Aneeba Khalid

2.89

BCSF13M054

M.Tayyab Tariq

3.15

Thirty best MCQs for Socket Programming


and threading using C#
Which of the following are the protocols defined by .NET runtime?
a) HTTP
b) HTTPS
c) File
d) All of these
Which of the following classes is used to encapsulate IP address and DNS?
a) Datagram Packet
b) URL
c) inetAddress
d) none of these
What is the advantage of the multithreading program?
a) Enables to utilize the idle and executing time present in most programs
b) Enables to utilize the idle time present in most programs
c) Both a & b
d) Only b
What does the given code snippet specify?
public Thread(Thread Start start)
a) Defines a thread
b) Declaration of a thread constructor
c) Only a
d) Only a & b
Explanation: To create a thread, instantiate an object of type Thread, which is a class defined in
System. Threading. The simplest Thread constructor is shown here:
public Thread(Thread Start start)
Here, start specifies the method that will be called to begin execution of the thread. IN other words,
it specifies the threads entry point.
Which of these classes is used to make a thread?
a) String
b) System
c) Thread
d) Runnable
Encoding.ASCII. Get Bytes is used to convert text to bytes in order to send it over Network
a) True
b) False
c) Unable to determine
d) There is no method in C# mentioned above

TcpClient.Client represent an object of which type?


a) Socket
b) There is no tcpclient class
c) It is an interface
d) None of these
Which method is called when a thread is blocked from running temporarily?
a) Pulse ()
b) PulseAll ()
c) Wait ()
d) Both b & c
Which method is used to abort thread prior to its normal execution?

a) sleep()
b) terminate()
c) suspend()
d) Abort()
Which of these method of Thread class is used to Suspend a thread for a period
of time?
a) sleep()
b) terminate()
c) suspend()
d) stop()
Which namespace is used for socket programming in C#?
a) System. Threading
b) System.Net.Socket
c) System.IO
d) None of these
Which class is used for UDP server in C#?
a) UDPClient
b) UDPServer
c) UDPProtocol
d) All of these
If thread is aborted () once it cannot be
a) aborted again
b) Join again
c) Start again
d) All of these
Which exception is thrown on safety of threads
a) ThreadStateException
b) ThreadException
c) Exception
d) None of these
Each Thread defines a unique flow of
a) Programs
b) Objects
c) Control

d) Executions
A dead State means for thread is
a) The thread has completed its execution
b) The thread is not safe
c) The thread is aborted
d) Both a & c
A TCPClient constructor takes two arguments
a) IPAddress and Portno
b) Portno and IPAddress
c) IPaddress and DNS
d) None of these
A Network Stream is a class in
a) System.NET
b) System.NET.Sockets
c) System. NETWORK. STREAMS
d) None of these
A Network Stream is used for
a) Connecting between client and server
b) Reading and writing data
c) It is used to get IPAddress
d) It is used to get Portno of host machine
A Network Stream passed data in the form of
a) Bytes
b) ASCII Codes
c) UNI Codes
d) All of these
-------------- Blocks the calling thread until a thread terminates
a) Join
b) Wait
c) Abort
d) Sleep
A thread is not executable when
a) Sleep method is called
b) Wait method is called
c) Blocked for I/O operations
d) All of these
TcpListener is used to monitor a TCP port for incoming requests and then create either a
Socket or a TcpClient
a) True
b) False
c) Only TCP Client
d) None of these are true
For UDP we must specify everytime
a) Portno
b) IPAddress
c) Both a & b
d) None of these to specify

One can have maximum portno upto


a) 65535
b) 65536
c) 100000
d) Only 1024
Mutex are used for
a) Mutual exclusion
b) There is no class of mutex
c) They are same as thread
d) None of these
Which of these are true
a) UDP is fast and TCP is slow
b) UDP is fast but it is reliable
c) UDP is slow and TCP is Fast
d) UDP and TCP are same
Which method is Used to get the stream
a) GetStream
b) GetInput
c) Read
d) Write
NetworkStream Does not Own the ----- Classes
a) TCP Classes
b) UDP Classes
c) Protocol Classes That uses Sockets
d) None
What if User Call the Close on NetworkStream
a) A Connection is Closed
b) A Client or Server Does not send or receive data
c) Both are false
d) Both are true
TCP client And TCPlistener parent class
a) Object
b) No parent
c) They are interface
d) None of these
Monitor are used for
a) Thread Safety Synchronization
b) They are used in Networking
c) They are not related to Programming language
d) Both a & b

Você também pode gostar