A URL (Uniform Resource Locator) is an identifier used to locate resources on the web. A URL is composed of the following components: Scheme, Host Name (with optional Port Number), Path, (optional) Query String, (optional) Anchor. These components are arranged in the following format: Scheme://Hostname:Port/Path?QueryString#Anchor For example, in the URL "https://en.wikipedia.org:443/wiki/Kitten?printable=yes&download=no#External_links": "https" is the Scheme, "en.wikipedia.org" is the Hostname, 443 is the Port Number, "wiki/Kitten" is the Path, "printable=yes&download=no" is the Query String, and "External links" is the Anchor. The Hostname is composed of (optional) subdomain(s), second-level domain, and top-level domain. e.g., for the Hostname "en.wikipedia.org": "en" is the subdomain, "wikipedia" is the second-level domain, and "org" is the top-level domain. Consider a variable "URL" containing a valid URL that follows the format above. Which of the following expression(s) correctly extracts the second-level domain from the URL and assigns it into the "seconddomain" variable? There may be more than one correct answer. Select all correct answers. parts strsplit/IIRI CollapseDelimiter' false):

Np Ms Office 365/Excel 2016 I Ntermed
1st Edition
ISBN:9781337508841
Author:Carey
Publisher:Carey
Chapter8: Working With Advanced Functions
Section: Chapter Questions
Problem 4.4CP
icon
Related questions
Question

matlab

A URL (Uniform Resource Locator) is an identifier used to locate resources on the web. A URL is composed of the following components:
Scheme, Host Name (with optional Port Number), Path, (optional) Query String, (optional) Anchor. These components are arranged in the
following format:
Scheme://Hostname:Port/Path?QueryString#Anchor
For example, in the URL "https://en.wikipedia.org:443/wiki/Kitten?printable=yes&download=no#External_links": "https" is the Scheme,
"en.wikipedia.org" is the Hostname, 443 is the Port Number, "wiki/Kitten" is the Path, "printable=yes&download=no" is the Query String, and
"External_links" is the Anchor.
The Hostname is composed of (optional) subdomain(s), second-level domain, and top-level domain. e.g., for the Hostname
"en.wikipedia.org": "en" is the subdomain, "wikipedia" is the second-level domain, and "org" is the top-level domain.
Consider a variable "URL" containing a valid URL that follows the format above. Which of the following expression(s) correctly extracts the
second-level domain from the URL and assigns it into the "seconddomain" variable?
There may be more than one correct answer. Select all correct answers.
O parts = strsplit(URL,'','CollapseDelimiter',false);
parts2 = strsplit(parts{3},'.','CollapseDelimiter',false);
seconddomain = parts2{end-1};
O parts = strsplit(URL,'/');
parts2 = strsplit(parts{3},'.');
seconddomain = parts2{end-1};
O I = find(URL == '/');
host = URL(I(2)+1:1(3)-1);
J = find(host == '.');
seconddomain = host(J(end-1)+1:J(end)-1);
O I = find(URL == '/');
J = find(URL == '.');
K=J(J<I(3));
H = fliplr(K);
seconddomain = URL(H(2)+1:H(1)-1);
Transcribed Image Text:A URL (Uniform Resource Locator) is an identifier used to locate resources on the web. A URL is composed of the following components: Scheme, Host Name (with optional Port Number), Path, (optional) Query String, (optional) Anchor. These components are arranged in the following format: Scheme://Hostname:Port/Path?QueryString#Anchor For example, in the URL "https://en.wikipedia.org:443/wiki/Kitten?printable=yes&download=no#External_links": "https" is the Scheme, "en.wikipedia.org" is the Hostname, 443 is the Port Number, "wiki/Kitten" is the Path, "printable=yes&download=no" is the Query String, and "External_links" is the Anchor. The Hostname is composed of (optional) subdomain(s), second-level domain, and top-level domain. e.g., for the Hostname "en.wikipedia.org": "en" is the subdomain, "wikipedia" is the second-level domain, and "org" is the top-level domain. Consider a variable "URL" containing a valid URL that follows the format above. Which of the following expression(s) correctly extracts the second-level domain from the URL and assigns it into the "seconddomain" variable? There may be more than one correct answer. Select all correct answers. O parts = strsplit(URL,'','CollapseDelimiter',false); parts2 = strsplit(parts{3},'.','CollapseDelimiter',false); seconddomain = parts2{end-1}; O parts = strsplit(URL,'/'); parts2 = strsplit(parts{3},'.'); seconddomain = parts2{end-1}; O I = find(URL == '/'); host = URL(I(2)+1:1(3)-1); J = find(host == '.'); seconddomain = host(J(end-1)+1:J(end)-1); O I = find(URL == '/'); J = find(URL == '.'); K=J(J<I(3)); H = fliplr(K); seconddomain = URL(H(2)+1:H(1)-1);
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Form and its Elements
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Np Ms Office 365/Excel 2016 I Ntermed
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:
9781337508841
Author:
Carey
Publisher:
Cengage