Technical (Networking) Flashcards
What does JSON stand for, and what is its primary purpose in web development?
JSON (JavaScript Object Notation) is a text-based file format that uses human-readable text to store and transmit data objects. JSON is a lightweight, language-independent, and self-describing data interchange format. It is based on a subset of the JavaScript programming language and is easy to understand and generate.
JSON is used to exchange data between web clients and web servers. It is also used to store temporary data, such as user-generated data from a submitted form on a website. JSON can be used as a data format for any programming language to provide a high level of interoperability.
Describe the basic structure of a JSON object
A JSON object is an unordered collection of name/value pairs. The name is a string, and the value can be a string, number, boolean, null, array, or object. The syntax is:
{
“name1”: “value1”,
“name2”: 2,
“name3”: true,
“name4”: [1,2,3],
“name5”: {
“name6”: null,
“name7”:34
}
}
How does JSON differ from XML in terms of data representation and usage?
JSON supports only text and number data type. XML support various data types such as number, text, images, charts, graphs, etc. It also provides options for transferring the structure or format of the data with actual data.
JSON (JavaScript Object Notation) is a format for storing and transmitting data. XML (eXtensible Markup Language) is a language for representing data in a machine-readable way. JSON is a good choice for data storage, APIs, and mobile apps. XML is better suited for complex document structures that require data exchange.
Can you give an example of a valid JSON object? Explain the purpose of each key-value pair.
{
“name”: “Name”, //provide person’s name
“lastName”: “LastName”, //provide person’s last name
“age”: 65, //provide person’s age
“work”: null, //provide person’s workplace
“email”: { //provide person’s emails (work email + personal email)
“workEmail”: “worl@dfd.com”,
“personal”:”pers@sff.com”
}
}
What does HTTP stand for, and what is its fundamental purpose in web communication?
HTTP (HyperText Transfer Protocol) is used for exchanging information over the internet. Main protocol to exchange information between client and server; any info can be transferred through it
Explain the difference between HTTP and HTTPS
HTTPS is secured (use TLS/SSL to encrypt normal HTTP requests), HTTP is not secured
What are the main components of an HTTP request?
Request line (method, request-uri, protocol version), headers, message-body
What are HTTP methods (verbs)?
GET - to request data from a resource,
POST - to send data to a server,
PUT - to update data on the server,
HEAD - to ask for a response identical to that of a GET request, but without a response body,
DELETE - to delete some data from the server,
PATCH - provides entity containing a list of changes to be added,
OPTIONS - to request information about communication options available
Describe the purpose and differences between GET and POST methods in HTTP
GET is used to request data from a resource; harmless for the data, can be bookmarked, can be cached, parameters remain in browser history, have restrictions of data length, only ASCII characters allowed, a bit less secure, data is visible to everyone in URL.
POST is used to send data to a server to create/update resource; data is completely re-submitted, can’t be bookmarked, parameters are not saved in browser history, no data length or data type restrictions, a bit safer that GET, data is not visible in URL
Describe the purpose and differences between PUT and PATCH methods in HTTP
Both sends data to the server, but PUT changes all data, PATCH can modify only some specified parts
What is the status codes in HTTP responses?
100-199 - Informational
200-299 - Successful
300-399 - Redirects
400-499 - Client side errors
500-599 - Server side errors
200 - OK
201 - created
204 - no content
304 - not modified
400 - bad request
401 - unauthorized
403 - forbidden
404 - not found
409 - conflict
500 - internal server error
Describe the concept of cookies in HTTP. How are they used for maintaining state?
HTTP cookies are small pieces of data that a web server sends to a user’s web browser. The browser stores the cookies and sends them back to the server with each request. Cookies are used to identify a client and maintain information about the client’s state. They are built specifically for Internet web browsers to track, personalize, and save information about each user’s session. Cookies are created to identify you when you visit a new website. There are three types of computer cookies: session, persistent, and third-party. Session cookies are temporary and only last for the duration of the user’s visit to the website. Persistent cookies are stored on the user’s computer for a longer period of time.
Explain differences between a LAN (Local Area Network) and a WAN (Wide Area Network)
A LAN (Local Area Network) is a network that covers a small geographical area, such as a home, office, or group of buildings. A WAN (Wide Area Network) is a network that covers larger geographical areas that can span the globe
What is an IP address, and how is it used in networking?
IP (Internet Protocol) is a unique numerical identifier for every device or network that connects to the internet; used for identifying and locating network devices
Explain the difference between IPv4 and IPv6
IPv4 have smaller length (4 octets of 8 bits, 32 bits overall), IPv6 (4 octets of 32 bits, 128 bits overall).