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):

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
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.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education