PRN221 FE EXAM QUESTIONS WITH
CORRECT ANSWERS
Choose |the |correct |statement |about |key |components |of |the |System.Net.* |Namespaces |
a. |HttpServer |for |consuming |HTTP |web |APIs |and |RESTful |services |
b. |WebRequest |and |WebResponse |classes |for |high-level |control |over |client-side |TCP |or |UDP |
operations |
c. |All |of |the |others |
*d. |A |WebClient |facade |class |for |simple |download/upload |operations |via |HTTP |or |FTP* |- |
CORRECT |ANSWER✔✔-d
To |configure |a |custom |number |of |reconnect |attempts |before |disconnecting |or |change |the |
reconnect |timing, |the |withAutomaticReconnect |accepts |an |array |of |numbers |representing |the |
delay |in |milliseconds |to |wait |before |starting |each |reconnect |attempt. |Choose |the |correct |
option |for |making |automatically |reconnect. |
a. |const |connection |= |new |signalR.HubConnectionBuilder() |.withUrl("/chathub")
|.withAutomaticReconnect(0, |0, |10000) |.create(); |
b. |const |connection |= |new |signalR.HubConnectionBuilder() |.withUrl("/chathub")
|.withAutomaticReconnect([0, |0, |10000]) |.build(); |
c. |const |connection |= |new |signalR.HubConnectionBuilder() |.withUrl("/chathub")
|.withAutomaticReconnect([0], |[0], |[10000]) |.build(); |
d. |None |of |the |others |- |CORRECT |ANSWER✔✔-b
Choose |the |correct |statement |related |to |Networking |Definitions |
a. |Port: |unsigned |4-byte |integer |helps |operating |system |differentiating |a |network |
communicating |process |
,b. |IP |address |includes |IPv4 |(4-byte) |and |IPv6 |(6-byte) |
*c. |IP |address |(Internet |Protocol): |unsigned |integer |helps |to |identify |a |network |
element(computer, |router, |etc)*
d. |None |of |the |others |- |CORRECT |ANSWER✔✔-c
Which |of |the |following |methods |of |the |HttpClient |Class |can |be |used |to |send |a |POST |request |
to |the |specified |Uri |as |an |asynchronous |operation? |
a. |CreatePostAsync(String, |HttpContent) |
b. |PostRequestAsync(String, |HttpContent) |
c. |PutAsync(String, |HttpContent) |
*d. |PostAsync(String, |HttpContent)* |- |CORRECT |ANSWER✔✔-d
Which |of |the |following |classes |of |the |System.Threading.Tasks |Namespace |provides |support |for |
creating |and |scheduling |Task |objects? |
*a. |TaskFactor*
b. |Task |
c. |TaskInit |
d. |None |of |the |others |
e. |TaskScheduler |- |CORRECT |ANSWER✔✔-a
In |the |case |working |ASP.NET |SignalR |with |JavaScript |client |library, |which |the |following |code |to |
create |and |start |a |connection? |
a. |var |connection |= |new |signalR.ConnectionBuilder() |.withUrl("/chatHub") |.build(); |
connection.start(); |
b. |var |connection |= |new |signalR.HubConnectionBuilder(.withUrl("/chatHub") |.create(); |
connection.start(); |
,c. |var |connection |= |new |signalR.HubConnectionBuilder().withUrl("/chatHub") |.build(); |
connection.start(); |
d. |var |connection |= |new |
signalR.HubBuilder() |.withUrl("/chatHub") |.build(); |
connection.start(); |- |CORRECT |ANSWER✔✔-c
A |hub |is |a |class |that |serves |as |a |high-level |pipeline |that |handles |client-server |communication. |
Create |a |SignalR |for |your |application |by |adding |a |class |named |ChatHub |that |inherits |from |
Microsoft.AspNetCore.SignalR.Hub |
a. |public |class |ChatHub |: |IHub |{ |
public |async |Task |SendMessage(string |user, |string |message) |{ |
await |Clients.All.SendAsync("ReceiveMessage", |user, |message);
| }}
|
b. |public |class |Hub |: |ChatHub |{ |
public |async |Task |SendMessage(string |user, |string |message) |{ |
await |Clients.All.SendAsync("ReceiveMessage", |user, |message); |
} |} |
c. |public |class |ChatHub |: |Hub |{ |
public |async |Task |SendMessage(string |user, |string |message) |{ |
await |Clients.All.SendAsync("ReceiveMessage", |user, |message);
| }
, d. |public |class |ChatHub |: |IHubContext |{ |
public |async |Task |SendMessage(string |user, |string |message) |{ |
await |Clients.All.SendAsync("ReceiveMessage", |user, |message); |
} |} |- |CORRECT |ANSWER✔✔-c
Choose |the |correct |statement |related |to |the |HttpClient |Class |
a. |HttpClient |was |written |in |response |to |the |growth |of |TCP-based |web |APIs |and |TCP |services |
to |provide |a |better |experience |than |the |WebClient |class |
b. |None |of |the |others |
c. |HttpClient |is |a |newer |API |for |working |with |TCP |Service |and |is |designed |to |work |well |with |
libraries, |REST-based |services, |and |custom |authentication |schemes |
*d. |HttpClient |provides |another |layer |on |top |of |HttpWebRequest |and |HttpWeb |Response* |- |
CORRECT |ANSWER✔✔-d
ASP.NET |Core |SignalR |supports |two |protocols |for |encoding |messages. |Each |protocol |has |
serialization |configuration |options. |Please |choose |the |correct |protocols. |
*a. |JSON |and |MessagePack* |
b. |BSON |and |MessagePack |
c. |JSON |and |BSON |
d. |JSON |and |XML |- |CORRECT |ANSWER✔✔-a
Which |of |the |following |statements |related |to |Worker |Service |.NET |is |False? |
Statement |1: |A |worker |service |is |a |.NET |project |built |using |a |template |which |supplies |a |few |
useful |features |that |turn |a |regular |console |application |into |something |more |powerful |
**Statement |2**: |A |worker |service |runs |on |bottom |of |the |concept |of |a |host, |which |maintains |
the |lifetime |of |the |application. |The |host |also |makes |available |some |familiar |features, |such |as |
dependency |injection, |logging, |and |configuration |
CORRECT ANSWERS
Choose |the |correct |statement |about |key |components |of |the |System.Net.* |Namespaces |
a. |HttpServer |for |consuming |HTTP |web |APIs |and |RESTful |services |
b. |WebRequest |and |WebResponse |classes |for |high-level |control |over |client-side |TCP |or |UDP |
operations |
c. |All |of |the |others |
*d. |A |WebClient |facade |class |for |simple |download/upload |operations |via |HTTP |or |FTP* |- |
CORRECT |ANSWER✔✔-d
To |configure |a |custom |number |of |reconnect |attempts |before |disconnecting |or |change |the |
reconnect |timing, |the |withAutomaticReconnect |accepts |an |array |of |numbers |representing |the |
delay |in |milliseconds |to |wait |before |starting |each |reconnect |attempt. |Choose |the |correct |
option |for |making |automatically |reconnect. |
a. |const |connection |= |new |signalR.HubConnectionBuilder() |.withUrl("/chathub")
|.withAutomaticReconnect(0, |0, |10000) |.create(); |
b. |const |connection |= |new |signalR.HubConnectionBuilder() |.withUrl("/chathub")
|.withAutomaticReconnect([0, |0, |10000]) |.build(); |
c. |const |connection |= |new |signalR.HubConnectionBuilder() |.withUrl("/chathub")
|.withAutomaticReconnect([0], |[0], |[10000]) |.build(); |
d. |None |of |the |others |- |CORRECT |ANSWER✔✔-b
Choose |the |correct |statement |related |to |Networking |Definitions |
a. |Port: |unsigned |4-byte |integer |helps |operating |system |differentiating |a |network |
communicating |process |
,b. |IP |address |includes |IPv4 |(4-byte) |and |IPv6 |(6-byte) |
*c. |IP |address |(Internet |Protocol): |unsigned |integer |helps |to |identify |a |network |
element(computer, |router, |etc)*
d. |None |of |the |others |- |CORRECT |ANSWER✔✔-c
Which |of |the |following |methods |of |the |HttpClient |Class |can |be |used |to |send |a |POST |request |
to |the |specified |Uri |as |an |asynchronous |operation? |
a. |CreatePostAsync(String, |HttpContent) |
b. |PostRequestAsync(String, |HttpContent) |
c. |PutAsync(String, |HttpContent) |
*d. |PostAsync(String, |HttpContent)* |- |CORRECT |ANSWER✔✔-d
Which |of |the |following |classes |of |the |System.Threading.Tasks |Namespace |provides |support |for |
creating |and |scheduling |Task |objects? |
*a. |TaskFactor*
b. |Task |
c. |TaskInit |
d. |None |of |the |others |
e. |TaskScheduler |- |CORRECT |ANSWER✔✔-a
In |the |case |working |ASP.NET |SignalR |with |JavaScript |client |library, |which |the |following |code |to |
create |and |start |a |connection? |
a. |var |connection |= |new |signalR.ConnectionBuilder() |.withUrl("/chatHub") |.build(); |
connection.start(); |
b. |var |connection |= |new |signalR.HubConnectionBuilder(.withUrl("/chatHub") |.create(); |
connection.start(); |
,c. |var |connection |= |new |signalR.HubConnectionBuilder().withUrl("/chatHub") |.build(); |
connection.start(); |
d. |var |connection |= |new |
signalR.HubBuilder() |.withUrl("/chatHub") |.build(); |
connection.start(); |- |CORRECT |ANSWER✔✔-c
A |hub |is |a |class |that |serves |as |a |high-level |pipeline |that |handles |client-server |communication. |
Create |a |SignalR |for |your |application |by |adding |a |class |named |ChatHub |that |inherits |from |
Microsoft.AspNetCore.SignalR.Hub |
a. |public |class |ChatHub |: |IHub |{ |
public |async |Task |SendMessage(string |user, |string |message) |{ |
await |Clients.All.SendAsync("ReceiveMessage", |user, |message);
| }}
|
b. |public |class |Hub |: |ChatHub |{ |
public |async |Task |SendMessage(string |user, |string |message) |{ |
await |Clients.All.SendAsync("ReceiveMessage", |user, |message); |
} |} |
c. |public |class |ChatHub |: |Hub |{ |
public |async |Task |SendMessage(string |user, |string |message) |{ |
await |Clients.All.SendAsync("ReceiveMessage", |user, |message);
| }
, d. |public |class |ChatHub |: |IHubContext |{ |
public |async |Task |SendMessage(string |user, |string |message) |{ |
await |Clients.All.SendAsync("ReceiveMessage", |user, |message); |
} |} |- |CORRECT |ANSWER✔✔-c
Choose |the |correct |statement |related |to |the |HttpClient |Class |
a. |HttpClient |was |written |in |response |to |the |growth |of |TCP-based |web |APIs |and |TCP |services |
to |provide |a |better |experience |than |the |WebClient |class |
b. |None |of |the |others |
c. |HttpClient |is |a |newer |API |for |working |with |TCP |Service |and |is |designed |to |work |well |with |
libraries, |REST-based |services, |and |custom |authentication |schemes |
*d. |HttpClient |provides |another |layer |on |top |of |HttpWebRequest |and |HttpWeb |Response* |- |
CORRECT |ANSWER✔✔-d
ASP.NET |Core |SignalR |supports |two |protocols |for |encoding |messages. |Each |protocol |has |
serialization |configuration |options. |Please |choose |the |correct |protocols. |
*a. |JSON |and |MessagePack* |
b. |BSON |and |MessagePack |
c. |JSON |and |BSON |
d. |JSON |and |XML |- |CORRECT |ANSWER✔✔-a
Which |of |the |following |statements |related |to |Worker |Service |.NET |is |False? |
Statement |1: |A |worker |service |is |a |.NET |project |built |using |a |template |which |supplies |a |few |
useful |features |that |turn |a |regular |console |application |into |something |more |powerful |
**Statement |2**: |A |worker |service |runs |on |bottom |of |the |concept |of |a |host, |which |maintains |
the |lifetime |of |the |application. |The |host |also |makes |available |some |familiar |features, |such |as |
dependency |injection, |logging, |and |configuration |