URLs Flashcards

Understand how links work

1
Q

What does URL stand for and what is its purpose in the context of the World Wide Web?

A

URL stands for Universal Resource Locator, and its purpose is to provide a way to reference and access specific resources on the internet through hypertext links.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How did the World Wide Web adapt the idea of hypertext, and what technology did it introduce to standardize it?

A

The World Wide Web adapted the idea of hypertext by incorporating it into its fundamental structure, allowing for interconnected web pages. It introduced Uniform Resource Locators (URLs) to standardize the naming and linking of web content.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What does the ‘scheme’ in a URL specify, and give an example?

A

The ‘scheme’ in a URL specifies the protocol used to fetch the content. For example, ‘http’ in ‘http://host.company.com’.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Explain the significance of the server’s port number in a URL.

A

The server’s port number in a URL, like ‘80’ in ‘http://host.company.com:80’, allows multiple servers to run on the same machine by distinguishing them through different port numbers.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How does the hierarchical portion of a URL function, and provide an example from the given URL.

A

The hierarchical portion of a URL, such as ‘/a/b/c.html’, is used by the server to locate the specific content requested. In the provided URL ‘http://host.company.com:80/a/b/c.html’, it directs to the file ‘c.html’ located in the directory ‘/a/b’.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What role do query parameters play in a URL, and give an example?

A

Query parameters in a URL provide additional data to the server, often for dynamic page generation or tracking purposes. An example is ‘?user=Alice&year=2008’, which sends the parameters ‘user’ and ‘year’ to the server.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the primary function of a URL scheme and give an example of two commonly used schemes.

A

The primary function of a URL scheme is to define the protocol or method to be used for accessing a specified resource. Common examples include http: for accessing web resources using HTTP, and https: which is similar but includes SSL encryption for security.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What does the file: URL scheme indicate, and how is it used?

A

The file: URL scheme indicates that the resource is a file located on the local disk. It is used to access or read files directly from the user’s computer.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Explain the purpose of the websocket: URL scheme.

A

The websocket: URL scheme is used to create a TCP (Transmission Control Protocol) connection, typically for real-time data exchange in web applications, such as live messaging or streaming services.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What action does the mailto: URL scheme trigger, and give a practical example of its use.

A

The mailto: URL scheme triggers an email program to open, composing a message to the specified email address. A practical example is mailto:example@email.com, which would open the user’s default email client with a new message addressed to example@email.com.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is the hierarchical portion of a URL, and what was its original purpose in early web servers?

A

The hierarchical portion of a URL is the part following the domain name and a slash, used to direct the web server to the requested content. In early web servers, it was typically a path name to a static HTML file.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

How does modern web server routing use the hierarchical portion of a URL?

A

Modern web servers use routing information to interpret the hierarchical portion of a URL, mapping specific paths to functions and possibly their parameters. This is essential in API design, allowing URLs to represent different operations like creating, listing, or deleting resources.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Give examples of how the hierarchical portion of a URL is used in API design.

A

In API design, the hierarchical portion of a URL represents different operations. For example, /user/create might be used to create a user, /user/list to list users, /user/0x23490 to retrieve a specific user, and /user/delete/0x23433 to delete a user.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What are query parameters in a URL, and how are they structured?

A

Query parameters in a URL are additional parameters provided to a web operation, appended to the end of the URL with a question mark (?). They consist of key-value pairs, separated by an equals sign (=), and multiple parameters are separated by an ampersand (&).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Explain the role of query parameters in modern web applications.

A

In modern web applications, query parameters are used not only to provide additional data to web operations but also to control when the browser switches pages or dynamically updates content, especially in single-page applications where content changes without a full page reload.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

How is a URL used in an <img> tag in HTML?

A

In an <img> tag, a URL is used in the src attribute to specify the location of the image to be displayed. For example, <img> uses the URL to load and display the image located at “path/to/image.jpg”.

17
Q

Describe how a URL is used in the <link></link> tag for loading stylesheets in HTML.

A

In the ` <link></link> ‘ tag, a URL is used in the href attribute to link an external CSS stylesheet to the HTML document. For example,

<head>
<link></link>
</head>

`` uses the URL in the href attribute to load the stylesheet.

18
Q

Explain how the <iframe> tag uses a URL to embed a page within an HTML document.

A

The <iframe> tag uses a URL in its src attribute to embed another HTML page within the current page.

For example, <iframe src="http://www.google.com"></iframe> embeds the Google homepage within the current document using the specified URL.

19
Q

Why is referential integrity important in hypertext systems?

A

Referential integrity is crucial in hypertext systems to ensure that all hyperlinks are valid and lead to the correct destinations. It prevents the occurrence of broken links, thereby maintaining the integrity and usability of the information structure.

20
Q

What does Error 404 signify on the web, and why is it important?

A

Error 404 signifies that the requested resource could not be found on the server. It is important as it informs users that the page they are trying to access is missing or unavailable, and helps in maintaining a good user experience by directing users to valid content or providing guidance when a resource is not found.

21
Q

What is the difference between a URI and a URL?

A

A URI (Uniform Resource Identifier) is a generic term for identifying a resource either by location, name, or both, while a URL (Uniform Resource Locator) is a specific type of URI that provides the means of locating a resource. All URLs are URIs, but not all URIs are URLs. A URL specifies where a resource is and how to retrieve it, whereas a URI more broadly identifies a resource.

22
Q

Given an HTML document loaded from the URL file:///Users/mendel/index.html that contains a <link></link> element in its head section
(<link rel="stylesheet" type="text/css" href="CS142 Project #1/styleA.css?ref=v1" />),

explain why the fetched URL for the stylesheet is file:///Users/mendel/CS142%20Project%20 and discuss any potential issues with how the browser interprets this URL.

A

The fetched URL for the stylesheet is derived from the base URL of the HTML document (file:///Users/mendel/index.html) and the relative path provided in the href attribute of the <link></link> element. The correct fetched URL should be file:///Users/mendel/CS142%20Project%20#1/styleA.css?ref=v1. If the browser reports a different URL, such as file:///Users/mendel/CS142%20Project%20, it might be due to an error in URL resolution, possibly caused by improper handling of spaces or special characters in the folder name.