diff --git a/.prettierignore b/.prettierignore index e69de29..1085488 100644 --- a/.prettierignore +++ b/.prettierignore @@ -0,0 +1 @@ +test/data/**/*.html diff --git a/Readme.md b/Readme.md index 55516ea..afc7075 100644 --- a/Readme.md +++ b/Readme.md @@ -8,7 +8,14 @@ [![Install Userscript](https://img.shields.io/badge/Install_Userscript-CCNA_Autofill-gray?style=for-the-badge&logo=greasyfork&logoColor=black&labelColor=brown)](https://git.euph.dev/Userscripts/CCNA_Autofill/raw/branch/main/src/main.user.js) ## Description - + +A UserScript for autofilling the Answers on the **CCNA**. +inspired by [Merlinfuchs/ccna-extension](https://github.com/merlinfuchs/ccna-extension). ## Usage - + +This only works directly on the exam website. + +- `p`: Paste your answer-URL from [ItexamAnswers](https://itexamanswers.net) for the **CCNAv7** use [these](https://itexamanswers.net/ccna-1-v7-modules-1-3-basic-network-connectivity-and-communications-exam-answers.html). +- `a`: Try autofilling the current answer. There won't be any visual feedback when it fails. +- `n`: Go to the next Question. diff --git a/src/answer.js b/src/answer.js new file mode 100644 index 0000000..586e55f --- /dev/null +++ b/src/answer.js @@ -0,0 +1,77 @@ +/** + * + * @param {Array} answerData + * @returns + */ +function answerQuestion(answerData) { + const question = document.querySelector('.question:not(.hidden)'); + if (!question) { + return; + } + + const questionTextDom = question.querySelector('.questionText .mattext'); + if (!questionTextDom) return; + const questionText = questionTextDom.textContent.trim(); + + const answersDom = question.querySelector('ul.coreContent'); + if (!answersDom) return; + const answers = answersDom.children; + + for (let answer of Array.from(answers)) { + const input = answer.querySelector('input'); + if (!input) continue; + input.checked = false; + } + + const correctAnswers = findAnswers(answerData, questionText, answers); + if (correctAnswers.length === 0) { + return; + } + + for (const answer of correctAnswers) { + const input = answer.querySelector('input'); + if (!input) continue; + input.checked = true; + } +} + +/** + * + * @param {Array} answerData + * @param {string} questionText + * @returns + */ +function findAnswers(answerData, questionText, answers) { + if (answerData === null) { + return []; + } + + const correctAnswers = []; + for (let entry of answerData) { + if (matchAnswer(questionText.trim(), entry.question.trim())) { + for (let availableAnswer of answers) { + for (let possibleAnswer of entry.answers) { + if ( + matchAnswer( + availableAnswer.textContent.trim(), + possibleAnswer + ) + ) { + correctAnswers.push(availableAnswer); + } + } + } + } + } + + return correctAnswers; +} + +function matchAnswer(textA, textB) { + const replaceRegex = /[^\w]/gi; + textA = textA.replace(replaceRegex, ''); + textB = textB.replace(replaceRegex, ''); + return textA === textB; +} + +window.answerQuestion = answerQuestion; diff --git a/src/fetch.js b/src/fetch.js new file mode 100644 index 0000000..1deb0b5 --- /dev/null +++ b/src/fetch.js @@ -0,0 +1,149 @@ +const QUESTION_REGEX = /^[0-9]+\. (.*)$/; + +/** + * Fetches answers from the specified URL. + * @param {string} [answerURL=""] - The URL to fetch answers from. + * @returns {Promise>} A Promise that resolves with the fetched answers. + */ +function fetchAnswers(answerURL = '') { + return new Promise((resolve, reject) => { + GM_xmlhttpRequest({ + method: 'GET', + url: answerURL, + headers: { + 'Content-Type': 'text/html' + }, + onload: function (response) { + parseAnswers(response, resolve); + }, + onerror: function (error) { + reject(error); + } + }); + }); +} + +/** + * + * @param {GMXMLHttpRequestResponse} response + * @param {(value: Answer[] | PromiseLike) => void} resolve + */ +function parseAnswers(response, resolve) { + const results = []; + const allAnswersElement = getAllAnswersElement(response); + + let index = -1; + for (let child of Array.from(allAnswersElement.children)) { + index++; + const result = parseAnswerElement(index, child, allAnswersElement); + if (result != undefined) { + results.push(result); + } + } + + resolve(results); +} + +/** + * @param {GMXMLHttpRequestResponse} response + * @returns {Element} + */ +function getAllAnswersElement(response) { + const parser = new DOMParser(); + const virtualDOM = parser.parseFromString( + response.responseText, + 'text/html' + ); + + let answersElement = virtualDOM.querySelector('.pf-content'); + if (!answersElement) { + answersElement = virtualDOM.querySelector('.thecontent'); + } + return answersElement; +} + +/** + * @param {number} index + * @param {Element} allAnswersElement + * @param {Element} element + * @returns {Answer} + */ +function parseAnswerElement(index, element, allAnswersElement) { + // Check for Possible Tags + if ( + !(element.tagName === 'P' || element.tagName === 'STRONG') || + !element.innerHTML + ) { + return; + } + + // Get Question Element + /** @type {Element} */ + let questionElement = element.querySelector('strong'); + if (questionElement === null) { + if (!element.textContent) { + return; + } + questionElement = element; + } + + // Get Question + const questionText = parseQuestion(questionElement); + if (questionText === null) { + return; + } + + // Get Awsners + const answersElement = getAnswersElement(index, allAnswersElement); + if (answersElement === null || answersElement.tagName !== 'UL') return; + + return { + question: questionText, + answers: getAnswers(answersElement) + }; +} + +/** + * @param {Element} questionElement + * @returns {String} + */ +function parseQuestion(questionElement) { + const textContent = questionElement.textContent.trim(); + const matches = textContent.match(QUESTION_REGEX); + return matches !== null ? matches[1] : null; +} + +/** + * @param {number} index + * @param {Element} allAnswersElement + * @returns {Element} + */ +function getAnswersElement(index, allAnswersElement) { + let answersElement = allAnswersElement.children[index + 1]; + + if (answersElement.tagName === 'P') { + answersElement = allAnswersElement.children[index + 2]; + } + return answersElement; +} + +/** + * @param {Element} answersElement + * @returns {Array} + */ +function getAnswers(answersElement) { + const answers = []; + for (let answerDom of Array.from( + answersElement.querySelectorAll('strong') + )) { + let answerText = answerDom.textContent.trim(); + if (answerText.endsWith('*')) { + answerText = answerText.substring(0, answerText.length - 1); + } + answers.push(answerText); + } + + return answers; +} + +window.fetchAnswers = fetchAnswers; diff --git a/src/lib.js b/src/lib.js deleted file mode 100644 index ada0ad5..0000000 --- a/src/lib.js +++ /dev/null @@ -1,5 +0,0 @@ -function testLib() { - console.log('lib works!'); -} - -window.testLib = testLib; diff --git a/src/main.user.js b/src/main.user.js index 4d06ae4..e7df60b 100644 --- a/src/main.user.js +++ b/src/main.user.js @@ -1,13 +1,39 @@ // ==UserScript== // @name CCNA_Autofill // @namespace https://git.euph.dev/Userscripts -// @match * -// @require https://git.euph.dev/Userscripts/CCNA_Autofill/raw/branch/main/src/lib.js +// @match *://assessment.netacad.net/* +// @match *://www.assessment.netacad.net/* +// @require https://git.euph.dev/Userscripts/CCNA_Autofill/raw/branch/main/src/fetch.js +// @require https://git.euph.dev/Userscripts/CCNA_Autofill/raw/branch/main/src/answer.js // @grant GM_setValue // @grant GM_getValue // @grant GM_xmlhttpRequest -// @version 0.0.1 +// @version 1.0.0 // @author Userscripts // ==/UserScript== -window.testLib(); +const URL_STORAGE_KEY = 'itexamanswers.net URL'; +/** @type {Array} */ +let answerData; + +window.addEventListener('keydown', async event => { + switch (event.key) { + case 'p': + const oldAnswersURL = GM_getValue(URL_STORAGE_KEY); + const newAnswersURL = prompt( + 'Please input the answer url (itexamanswers.net)', + oldAnswersURL + ); + GM_setValue(URL_STORAGE_KEY, newAnswersURL); + answerData = await window.fetchAnswers(newAnswersURL); + break; + + case 'n': + document.getElementById('next').click(); + break; + + case 'a': + window.answerQuestion(answerData); + break; + } +}); diff --git a/test/.gitignore b/test/.gitignore new file mode 100644 index 0000000..c2658d7 --- /dev/null +++ b/test/.gitignore @@ -0,0 +1 @@ +node_modules/ diff --git a/test/data/ccna1v7mod1-3/data.html b/test/data/ccna1v7mod1-3/data.html new file mode 100644 index 0000000..0844caf --- /dev/null +++ b/test/data/ccna1v7mod1-3/data.html @@ -0,0 +1,6602 @@ + + + + + + + +
+ + +
+ + +
+
+
+
+
+

CCNA 1 v7 Modules 1 – 3: Basic Network + Connectivity and Communications Exam Answers

+ +
+
+
+ + + + + + + Tweet + + + + Share + + + + Pin it + +
+
+

+

How to find: Press “Ctrl + + F” + in the browser and fill in whatever wording is in the question to find + that question/answer. If the question is not here, find it in Questions Bank.

+ +

NOTE: + If you have the new question on this test, please comment Question and + Multiple-Choice list in form below this article. We will update answers + for you in the shortest time. Thank you! We truly value your + contribution to the website.

+
+

+

Introduction to Networks (Version 7.00) – Modules 1 – 3: Basic Network Connectivity + and Communications Exam

+

1. During a routine inspection, a technician discovered that + software that was installed on a computer was secretly collecting data + about websites that were visited by users of the computer. Which type of + threat is affecting this computer?

+
    +
  • DoS attack​
  • +
  • identity theft
  • +
  • spyware
  • +
  • zero-day attack
  • +
+

2. Which term refers to a network that provides secure access + to the corporate offices by suppliers, customers and collaborators?

+
    +
  • Internet
  • +
  • intranet
  • +
  • extranet
  • +
  • extendednet
  • +
+

3. A large corporation has modified its network to allow + users to access network resources from their personal laptops and smart + phones. Which networking trend does this describe?

+
    +
  • cloud computing
  • +
  • online collaboration
  • +
  • bring your own device
  • +
  • video conferencing
  • +
+

4. What is an ISP?

+
    +
  • It is a standards body that develops cabling and wiring standards for + networking. +
  • +
  • It is a protocol that establishes how computers within a local network + communicate. +
  • +
  • It is an organization that enables individuals and businesses to connect to the Internet. +
  • +
  • It is a networking device that combines the functionality of several different + networking devices in one. +
  • +
+

5. Match the requirements of a reliable network with the supporting network + architecture. (Not all options are used.)
+ CCNA 1 v7 Modules 1 - 3: Basic Network Connectivity and Communications Exam Answers 1

+

6. An employee at a branch office is creating a quote for a + customer. In order to do this, the employee needs to access confidential + pricing information from internal servers at the Head Office. What type + of network would the employee access?

+
    +
  • an intranet
  • +
  • the Internet
  • +
  • an extranet
  • +
  • a local area network
  • +
+

+

Explanation: + Intranet is a term used to refer to a private connection of LANs and + WANs that belongs to an organization. An intranet is designed to be + accessible only by the organization’s members, employees, or others with + authorization.

+
+ 7. Which statement describes the use of powerline networking + technology? +

+
    +
  • New “smart” electrical cabling is used to extend an existing home LAN.
  • +
  • A home LAN is installed without the use of physical cabling.
  • +
  • A device connects to an existing home LAN using an adapter and an existing electrical outlet. +
  • +
  • Wireless access points use powerline adapters to distribute data through the + home LAN. +
  • +
+

Explanation: Powerline + networking adds the ability to connect a device to the network using an + adapter wherever there is an electrical outlet.​ The network uses + existing electrical wiring to send data. It is not a replacement for + physical cabling, but it can add functionality in places where wireless + access points cannot be used or cannot reach devices.​

+

8. A networking technician is working on the wireless network + at a medical clinic. The technician accidentally sets up the wireless + network so that patients can see the medical records data of other + patients. Which of the four network characteristics has been violated in + this situation?

+
    +
  • fault tolerance
  • +
  • scalability
  • +
  • security
  • +
  • Quality of Service (QoS)
  • +
  • reliability
  • +
+

Explanation: + Network security includes protecting the confidentiality of data that is + on the network. In this case, because confidential data has been made + available to unauthorized users, the security characteristic of the + network has failed.

+

9. Match each characteristic to its corresponding Internet connectivity type. + (Not all options are used.)

+
ITN (Version 7.00) - Basic Network Connectivity and Communications Exam 5 +

ITN (Version 7.00) – Basic + Network Connectivity and Communications Exam 5

+

Explanation: DSL is + an always-on, high bandwidth connection that runs over telephone lines. + Cable uses the same coaxial cable that carries television signals into + the home to provide Internet access. Dialup telephone is much slower + than either DSL or cable, but is the least expensive option for home + users because it can use any telephone line and a simple modem. + Satellite requires a clear line of sight and is affected by trees and + other obstructions. None of these typical home options use dedicated + leased lines such as T1/E1 and T3/E3.

+

10. What two criteria are used to help select a network medium from various + network media? (Choose two.)

+
    +
  • the types of data that need to be prioritized
  • +
  • the cost of the end devices utilized in the network
  • +
  • the distance the selected medium can successfully carry a signal +
  • +
  • the number of intermediate devices installed in the network
  • +
  • the environment where the selected medium is to be installed +
  • +
+

Explanation: + Criteria for choosing a network medium are the distance the selected + medium can successfully carry a signal, the environment in which the + selected medium is to be installed, the amount of data and the speed at + which the data must be transmitted, and the cost of the medium and its + installation.

+

11. What type of network traffic requires QoS?

+
    +
  • email
  • +
  • on-line purchasing
  • +
  • video conferencing
  • +
  • wiki
  • +
+

12. A user is implementing security on a small office + network. Which two actions would provide the minimum security + requirements for this network? (Choose two.)

+
    +
  • implementing a firewall +
  • +
  • installing a wireless network
  • +
  • installing antivirus software +
  • +
  • implementing an intrusion detection system
  • +
  • adding a dedicated intrusion prevention device
  • +
+

Explanation: + Technically complex security measures such as intrusion prevention and + intrusion prevention systems are usually associated with business + networks rather than home networks. Installing antivirus software, + antimalware software, and implementing a firewall will usually be the + minimum requirements for home networks. Installing a home wireless + network will not improve network security, and will require further + security actions to be taken.

+

13. Passwords can be used to restrict access to all or parts + of the Cisco IOS. Select the modes and interfaces that can be protected + with passwords. (Choose three.)

+
    +
  • VTY interface
  • +
  • console interface
  • +
  • Ethernet interface
  • +
  • boot IOS mode
  • +
  • privileged EXEC mode
  • +
  • router configuration mode
  • +
+

+

Explanation: + Access to the VTY and console interfaces can be restricted using + passwords. Out-of-band management of the router can be restricted in + both user EXEC and privileged EXEC modes.

+
+ 14. Which interface allows remote management of a Layer 2 switch? +

+
    +
  • the AUX interface
  • +
  • the console port interface
  • +
  • the switch virtual interface +
  • +
  • the first Ethernet port interface
  • +
+

Explanation: In a Layer 2 switch, + there is a switch virtual interface (SVI) that provides a means for remotely + managing the device.

+

15. What function does pressing the Tab key have when entering a command in + IOS?

+
    +
  • It aborts the current command and returns to configuration mode.
  • +
  • It exits configuration mode and returns to user EXEC mode.
  • +
  • It moves the cursor to the beginning of the next line.
  • +
  • It completes the remainder of a partially typed word in a command. +
  • +
+

Explanation: Pressing the Tab key + after a command has been partially typed will cause the IOS to complete the rest of + the command.

+

16. While trying to solve a network issue, a technician made + multiple changes to the current router configuration file. The changes + did not solve the problem and were not saved. What action can the + technician take to discard the changes and work with the file in NVRAM?

+
    +
  • Issue the reload command without saving the running configuration. +
  • +
  • Delete the vlan.dat file and reboot the device.
  • +
  • Close and reopen the terminal emulation software.
  • +
  • Issue the copy startup-config running-config command.
  • +
+

Explanation: The + technician does not want to make any mistakes trying to remove all the + changes that were done to the running configuration file. The solution + is to reboot the router without saving the running configuration. The + copy startup-config running-config command does not overwrite the + running configuration file with the configuration file stored in NVRAM, + but rather it just has an additive effect.

+

17. An administrator uses the Ctrl-Shift-6 key combination on + a switch after issuing the ping command. What is the purpose of using + these keystrokes?

+
    +
  • to restart the ping process
  • +
  • to interrupt the ping process
  • +
  • to exit to a different configuration mode
  • +
  • to allow the user to complete the command
  • +
+

+

Explanation: + To interrupt an IOS process such as ping or traceroute, a user enters + the Ctrl-Shift-6 key combination. Tab completes the remainder of + parameters or arguments within a command. To exit from configuration + mode to privileged mode use the Ctrl-Z keystroke. CTRL-R will redisplay + the line just typed, thus making it easier for the user to press Enter + and reissue the ping command.

+
+ 18. Refer to the exhibit. A network administrator is configuring + access control to switch SW1. If the administrator uses a console + connection to connect to the switch, which password is needed to access + user EXEC mode? +

+
CCNA-1-v7-Modules-1-3-Basic Network Connectivity and Communications Exam Answers 14 +

CCNA-1-v7-Modules-1-3-Basic + Network Connectivity and Communications Exam Answers 14

+
    +
  • letmein
  • +
  • secretin
  • +
  • lineconin
  • +
  • linevtyin
  • +
+

Explanation: Telnet + accesses a network device through the virtual interface configured with + the line VTY command. The password configured under this is required to + access the user EXEC mode. The password configured under the line + console 0 command is required to gain entry through the console port, + and the enable and enable secret passwords are used to allow entry into + the privileged EXEC mode.

+

19. A technician configures a switch with these commands:

+
SwitchA(config)# interface vlan 1
+SwitchA(config-if)# ip address 192.168.1.1 255.255.255.0
+SwitchA(config-if)# no shutdown
+

What is the technician configuring?

+
    +
  • Telnet access
  • +
  • SVI
  • +
  • password encryption
  • +
  • physical switchport access
  • +
+

Explanation: For a + switch to have an IP address, a switch virtual interface must be + configured. This allows the switch to be managed remotely over the + network.

+

20. Which command or key combination allows a user to return to the previous + level in the command hierarchy?

+
    +
  • end
  • +
  • exit
  • +
  • Ctrl-Z
  • +
  • Ctrl-C
  • +
+

Explanation: End + and CTRL-Z return the user to the privileged EXEC mode. Ctrl-C ends a + command in process. The exit command returns the user to the previous + level.

+

21. What are two characteristics of RAM on a Cisco device? (Choose + two.)

+
    +
  • RAM provides nonvolatile storage.
  • +
  • The configuration that is actively running on the device is stored in RAM. +
  • +
  • The contents of RAM are lost during a power cycle. +
  • +
  • RAM is a component in Cisco switches but not in Cisco routers.
  • +
  • RAM is able to store multiple versions of IOS and configuration files.
  • +
+

+

Explanation: + RAM stores data that is used by the device to support network + operations. The running configuration is stored in RAM. This type of + memory is considered volatile memory because data is lost during a power + cycle. Flash memory stores the IOS and delivers a copy of the IOS into + RAM when a device is powered on. Flash memory is nonvolatile since it + retains stored contents during a loss of power.

+
+ 22. Which two host names follow the guidelines for naming conventions on Cisco + IOS devices? (Choose two.) +

+
    +
  • Branch2!
  • +
  • RM-3-Switch-2A4
  • +
  • Floor(15)
  • +
  • HO Floor 17
  • +
  • SwBranch799
  • +
+

Explanation: Some guidelines for + naming conventions are that names should:
+ Start with a letter
+ Contain no spaces
+ End with a letter or digit
+ Use only letters, digits, and dashes
+ Be less than 64 characters in length

+

23. How is SSH different from Telnet?

+
    +
  • SSH makes connections over the network, whereas Telnet is for out-of-band + access. +
  • +
  • SSH provides security to +remote sessions by encrypting messages and using user authentication. +Telnet is considered insecure and sends messages in plaintext.
  • +
  • SSH requires the use of the PuTTY terminal emulation program. Tera + Term must be used to connect to devices through the use of Telnet. +
  • +
  • SSH must be configured over an active network connection, whereas + Telnet is used to connect to a device from a console connection. +
  • +
+

Explanation: SSH is + the preferred protocol for connecting to a device operating system over + the network because it is much more secure than Telnet. Both SSH and + Telnet are used to connect to devices over the network, and so are both + used in-band. PuTTY and Terra Term can be used to make both SSH and + Telnet connections.

+

24. An administrator is configuring a switch console port + with a password. In what order will the administrator travel through the + IOS modes of operation in order to reach the mode in which the + configuration commands will be entered? (Not all options are used.)

+
CCNA-1-v7-Modules-1-3-Basic Network Connectivity and Communications Exam Answers 20 +

CCNA-1-v7-Modules-1-3-Basic + Network Connectivity and Communications Exam Answers 24

+

Explanation: The configuration mode + that the administrator first encounters is user EXEC mode. After the enable command + is entered, the next mode is privileged EXEC mode. From there, the configure + terminal command is entered to move to global configuration mode. Finally, + the administrator enters the line console 0 command to enter the mode in + which the configuration will be entered.

+

25. What are three characteristics of an SVI? (Choose three.)

+
    +
  • It is designed as a security protocol to protect switch ports.
  • +
  • It is not associated with any physical interface on a switch. +
  • +
  • It is a special interface that allows connectivity by different types of + media. +
  • +
  • It is required to allow connectivity by any device at any location.
  • +
  • It provides a means to remotely manage a switch. +
  • +
  • It is associated with VLAN1 by default. +
  • +
+

Explanation: + Switches have one or more switch virtual interfaces (SVIs). SVIs are + created in software since there is no physical hardware associated with + them. Virtual interfaces provide a means to remotely manage a switch + over a network that is using IP. Each switch comes with one SVI + appearing in the default configuration “out-of-the-box.” The default SVI + interface is VLAN1.

+

26. What command is used to verify the condition of the + switch interfaces, including the status of the interfaces and a + configured IP address?

+
    +
  • ipconfig
  • +
  • ping
  • +
  • traceroute
  • +
  • show ip interface brief +
  • +
+

Explanation: The + show ip interface brief command is used to display a brief synopsis of + the condition of the device interfaces. The ipconfig command is used to + verify TCP/IP properties on a host. The ping command is used to verify + Layer 3 connectivity. The traceroute command is used to trace the + network path from source to destination.

+

27. Match the description with the associated IOS mode. (Not all options are + used.)
+ CCNA 1 v7 Modules 1 - 3: Basic Network Connectivity and Communications Exam Answers 2

+

28. Match the definitions to their respective CLI hot keys and shortcuts. + (Not all options are used.)
+ CCNA 1 v7 Modules 1 - 3: Basic Network Connectivity and Communications Exam Answers 3
+

+

Explanation: The shortcuts with + their functions are as follows:
+ – Tab – Completes the remainder of a partially typed command or keyword
+ – Space bar – displays the next screen
+ – ? – provides context-sensitive help
+ – Up Arrow – Allows user to scroll backward through former commands
+ – Ctrl-C – cancels any command currently being entered and returns directly to + privileged EXEC mode
+ – Ctrl-Shift-6 – Allows the user to interrupt an IOS process such as ping or + traceroute

+

+

29. In the show running-config command, which part of the syntax is + represented by running-config ?

+
    +
  • the command
  • +
  • a keyword
  • +
  • a variable
  • +
  • a prompt
  • +
+

Explanation: The + first part of the syntax, show, is the command, and the second part of + the syntax, running-config, is the keyword. The keyword specifies what + should be displayed as the output of the show command.

+

30. After making configuration changes on a Cisco switch, a + network administrator issues a copy running-config startup-config + command. What is the result of issuing this command?

+
    +
  • The new configuration will be stored in flash memory.
  • +
  • The new configuration will be loaded if the switch is restarted. +
  • +
  • The current IOS file will be replaced with the newly configured file.
  • +
  • The configuration changes will be removed and the original configuration will be + restored. +
  • +
+

Explanation: With the copy + running-config startup-config + command, the content of the current operating configuration replaces + the startup configuration file stored in NVRAM. The configuration file + saved in NVRAM will be loaded when the device is restarted.

+

31. What command will prevent all unencrypted passwords from displaying in + plain text in a configuration file?

+
    +
  • (config)# enable password secret
  • +
  • (config)# enable secret Secret_Password
  • +
  • (config-line)# password secret
  • +
  • (config)# service password-encryption +
  • +
  • (config)# enable secret Encrypted_Password
  • +
+

+

Explanation: + To prevent all configured passwords from appearing in plain text in + configuration files, an administrator can execute the service + password-encryption command. This command encrypts all configured + passwords in the configuration file.

+
+ 32. A network administrator enters the service + password-encryption command into the configuration mode of a router. + What does this command accomplish? +

+
    +
  • This command encrypts passwords as they are transmitted across serial WAN + links. +
  • +
  • This command prevents someone from viewing the running configuration passwords. +
  • +
  • This command enables a strong encryption algorithm for the enable secret + password command. +
  • +
  • This command automatically encrypts passwords in configuration files that are + currently stored in NVRAM. +
  • +
  • This command provides an exclusive encrypted password for external service + personnel who are required to do router maintenance. +
  • +
+

Explanation: The + startup-config and running-config files display most passwords in + plaintext. Use the service password-encryption global config command to + encrypt all plaintext passwords in these files.

+

33. What method can be used by two computers to ensure that + packets are not dropped because too much data is being sent too quickly? +

+
    +
  • encapsulation
  • +
  • flow control
  • +
  • access method
  • +
  • response timeout
  • +
+

Explanation: In + order for two computers to be able to communicate effectively, there + must be a mechanism that allows both the source and destination to set + the timing of the transmission and receipt of data. Flow control allows + for this by ensuring that data is not sent too fast for it to be + received properly.

+

34. Which statement accurately describes a TCP/IP encapsulation process when + a PC is sending data to the network?

+
    +
  • Data is sent from the internet layer to the network access layer.
  • +
  • Packets are sent from the network access layer to the transport layer.
  • +
  • Segments are sent from the transport layer to the internet layer. +
  • +
  • Frames are sent from the network access layer to the internet layer.
  • +
+

Explanation: When + the data is traveling from the PC to the network, the transport layer + sends segments to the internet layer. The internet layer sends packets + to the network access layer, which creates frames and then converts the + frames to bits. The bits are released to the network media.

+

35. What three application layer protocols are part of the TCP/IP protocol + suite? (Choose three.)

+
    +
  • ARP
  • +
  • DHCP
  • +
  • DNS
  • +
  • FTP
  • +
  • NAT
  • +
  • PPP
  • +
+

Explanation: DNS, + DHCP, and FTP are all application layer protocols in the TCP/IP protocol + suite. ARP and PPP are network access layer protocols, and NAT is an + internet layer protocol in the TCP/IP protocol suite.

+

36. Match the description to the organization. (Not all options are + used.)
+ CCNA 1 v7 Modules 1 - 3: Basic Network Connectivity and Communications Exam Answers 4
+

+

Explanation: The EIA is + an international standards and trade organization for electronics + organizations. It is best known for its standards related to electrical + wiring, connectors, and the 19-inch racks used to mount networking + equipment.

+

+

37. Which name is assigned to the transport layer PDU?

+
    +
  • bits
  • +
  • data
  • +
  • frame
  • +
  • packet
  • +
  • segment
  • +
+

Explanation: + Application data is passed down the protocol stack on its way to be + transmitted across the network media. During the process, various + protocols add information to it at each level. At each stage of the + process, a PDU (protocol data unit) has a different name to reflect its + new functions. The PDUs are named according to the protocols of the + TCP/IP suite:
+ Data – The general term for the PDU used at the application layer.
+ Segment – transport layer PDU
+ Packet – network layer PDU
+ Frame – data link layer PDU
+ Bits – A physical layer PDU used when physically transmitting data over the medium +

+

38. When IPv4 addressing is manually configured on a web + server, which property of the IPv4 configuration identifies the network + and host portion for an IPv4 address?

+
    +
  • DNS server address
  • +
  • subnet mask
  • +
  • default gateway
  • +
  • DHCP server address
  • +
+

Explanation: There are several + components that need to be entered when configuring IPv4 for an end device:
+ IPv4 address – uniquely identifies an end device on the network
+ Subnet mask – determines the network address portion and host portion for an IPv4 + address
+ Default gateway – the IP address of the router interface used for communicating with + hosts in another network
+ DNS server address – the IP address of the Domain Name System (DNS) server
+ DHCP server address (if DHCP is used) is not configured manually on end + devices. It will be provided by a DHCP server when an end device + requests an IP address.

+

39. What process involves placing one PDU inside of another PDU?

+
    +
  • encapsulation
  • +
  • encoding
  • +
  • segmentation
  • +
  • flow control
  • +
+

Explanation: When a + message is placed inside of another message, this is known as + encapsulation. On networks, encapsulation takes place when one protocol + data unit is carried inside of the data field of the next lower protocol + data unit.

+

40. What layer is responsible for routing messages through an internetwork in + the TCP/IP model?

+
    +
  • internet
  • +
  • transport
  • +
  • network access
  • +
  • session
  • +
+

Explanation: The + TCP/IP model consists of four layers: application, transport, internet, + and network access. Of these four layers, it is the internet layer that + is responsible for routing messages. The session layer is not part of + the TCP/IP model but is rather part of the OSI model.

+

41. For the TCP/IP protocol suite, what is the correct order + of events when a Telnet message is being prepared to be sent over the + network?

+
CCNA-1-v7-Modules-1-3-Basic Network Connectivity and Communications Exam Answers 37 +

CCNA-1-v7-Modules-1-3-Basic + Network Connectivity and Communications Exam Answers 41

+

42. Which PDU format is used when bits are received from the network medium + by the NIC of a host?

+
    +
  • file
  • +
  • frame
  • +
  • packet
  • +
  • segment
  • +
+

Explanation: When + received at the physical layer of a host, the bits are formatted into a + frame at the data link layer. A packet is the PDU at the network layer. A + segment is the PDU at the transport layer. A file is a data structure + that may be used at the application layer.

+

43. Refer to the exhibit. ServerB is attempting to contact + HostA. Which two statements correctly identify the addressing that + ServerB will generate in the process? (Choose two.)

+

CCNA 1 v7 Modules 1 - 3: Basic Network Connectivity and Communications Exam Answers 5 +

+
    +
  • ServerB will generate a packet with the destination IP address of RouterB.
  • +
  • ServerB will generate a frame with the destination MAC address of SwitchB.
  • +
  • ServerB will generate a packet with the destination IP address of RouterA.
  • +
  • ServerB will generate a frame with the destination MAC address of RouterB. +
  • +
  • ServerB will generate a packet with the destination IP address of HostA. +
  • +
  • ServerB will generate a frame with the destination MAC address of RouterA.
  • +
+

Explanation: In order to send + data to HostA, ServerB will generate a packet that contains the IP + address of the destination device on the remote network and a frame that + contains the MAC address of the default gateway device on the local + network.

+

44. Which method allows a computer to react accordingly when + it requests data from a server and the server takes too long to respond? +

+
    +
  • encapsulation
  • +
  • flow control
  • +
  • access method
  • +
  • response timeout
  • +
+

Explanation: If a computer + makes a request and does not hear a response within an acceptable amount + of time, the computer assumes that no answer is coming and reacts + accordingly.

+

45. A web client is receiving a response for a web page from a + web server. From the perspective of the client, what is the correct + order of the protocol stack that is used to decode the received + transmission?

+
    +
  • Ethernet, IP, TCP, HTTP +
  • +
  • HTTP, TCP, IP, Ethernet
  • +
  • Ethernet, TCP, IP, HTTP
  • +
  • HTTP, Ethernet, IP, TCP
  • +
+

Explanation:
+ 1. HTTP governs the way that a web server and client interact.
+ 2. TCP manages individual conversations between web servers and clients.
+ 3. IP is responsible for delivery across the best path to the destination.
+ 4. Ethernet takes the packet from IP and formats it for transmission.

+

46. Which two OSI model layers have the same functionality as a single layer + of the TCP/IP model? (Choose two.)

+
    +
  • data link
  • +
  • network
  • +
  • physical
  • +
  • session
  • +
  • transport
  • +
+

Explanation: The + OSI data link and physical layers together are equivalent to the TCP/IP + network access layer. The OSI transport layer is functionally equivalent + to the TCP/IP transport layer, and the OSI network layer is equivalent + to the TCP/IP internet layer. The OSI application, presentation, and + session layers are functionally equivalent to the application layer + within the TCP/IP model.

+

47. At which layer of the OSI model would a logical address be added during + encapsulation?

+
    +
  • physical layer
  • +
  • data link layer
  • +
  • network layer
  • +
  • transport layer
  • +
+

Explanation: + Logical addresses, also known as IP addresses, are added at the network + layer. Physical addresses are edded at the data link layer. Port + addresses are added at the transport layer. No addresses are added at + the physical layer.

+

48. What is a characteristic of multicast messages?

+
    +
  • They are sent to a select group of hosts. +
  • +
  • They are sent to all hosts on a network.
  • +
  • They must be acknowledged.
  • +
  • They are sent to a single destination.
  • +
+

Explanation: Multicast is a + one-to-many type of communication. Multicast messages are addressed to a specific + multicast group.

+

49. Which statement is correct about network protocols?

+
    +
  • Network protocols define the type of hardware that is used and how it is mounted + in racks. +
  • +
  • They define how messages are exchanged between the source and the destination. +
  • +
  • They all function in the network access layer of TCP/IP.
  • +
  • They are only required for exchange of messages between devices on remote + networks. +
  • +
+

Explanation: + Network protocols are implemented in hardware, or software, or both. + They interact with each other within different layers of a protocol + stack. Protocols have nothing to do with the installation of the network + equipment. Network protocols are required to exchange information + between source and destination devices in both local and remote + networks.

+

50. What is an advantage of network devices using open standard + protocols?

+
    +
  • Network communications is confined to data transfers between devices from the + same vendor. +
  • +
  • A client host and a server running different operating systems can successfully exchange data. +
  • +
  • Internet access can be controlled by a single ISP in each market.
  • +
  • Competition and innovation are limited to specific types of products.
  • +
+

Explanation: An + advantage of network devices implementing open standard protocols, such + as from the TCP/IP suite, is that clients and servers running different + operating systems can communicate with each other. Open standard + protocols facilitate innovation and competition between vendors and + across markets, and can reduce the occurrence of monopolies in + networking markets.

+

51. Which device performs the function of determining the path that messages + should take through internetworks?

+
    +
  • a router
  • +
  • a firewall
  • +
  • a web server
  • +
  • a DSL modem
  • +
+

Explanation: A + router is used to determine the path that the messages should take + through the network. A firewall is used to filter incoming and outgoing + traffic. A DSL modem is used to provide Internet connection for a home + or an organization.

+

52. Open the PT Activity. Perform the tasks in the activity instructions and + then answer the question.

+
CCNA-1-v7-Modules-1-3-Basic Network Connectivity and Communications Exam Answers 48 +

CCNA-1-v7-Modules-1-3-Basic + Network Connectivity and Communications Exam Answers 52

+
+ +
+
+
+ Icon +
+ +
+ Download +
+
+ +
+ +
+

What is the IP address of the switch virtual interface (SVI) on + Switch0?

+
    +
  • 192.168.5.10
  • +
  • 192.168.10.5
  • +
  • 192.168.10.1
  • +
  • 192.168.5.0
  • +
+

Explanation: After + the enable command is issued, the show running-configuration command or + the show ip interfaces brief command will display the IP address of the + switch virtual interface (SVI).

+

53. Why would a Layer 2 switch need an IP address?

+
    +
  • to enable the switch to send broadcast frames to attached PCs
  • +
  • to enable the switch to function as a default gateway
  • +
  • to enable the switch to be managed remotely +
  • +
  • to enable the switch to receive frames from attached PCs
  • +
+

Explanation: A + switch, as a Layer 2 device, does not need an IP address to transmit + frames to attached devices. However, when a switch is accessed remotely + through the network, it must have a Layer 3 address. The IP address must + be applied to a virtual interface rather than to a physical interface. + Routers, not switches, function as default gateways.

+

54. Refer to the exhibit. An administrator is trying to + configure the switch but receives the error message that is displayed in + the exhibit. What is the problem?

+
CCNA-1-v7-Modules-1-3-Basic Network Connectivity and Communications Exam Answers 50 +

CCNA-1-v7-Modules-1-3-Basic Network Connectivity and + Communications Exam Answers 54

+
    +
  • The entire command, configure terminal, must be used.
  • +
  • The administrator is already in global configuration mode.
  • +
  • The administrator must first enter privileged EXEC mode before issuing the command. +
  • +
  • The administrator must connect via the console port to access global + configuration mode. +
  • +
+

Explanation: In + order to enter global configuration mode, the command configure + terminal, or a shortened version such as config t, must be entered from + privileged EXEC mode. In this scenario the administrator is in user EXEC + mode, as indicated by the > symbol after the hostname. The + administrator would need to use the enable command to move into + privileged EXEC mode before entering the configure terminal command.

+

55. What term describes a network owned by one organization + that provides safe and secure access to individuals who work for a + different organization?

+
    +
  • extranet
  • +
  • cloud
  • +
  • BYOD
  • +
  • quality of service
  • +
+

56. What term describes storing personal files on servers + over the internet to provide access anywhere, anytime, and on any + device?

+
    +
  • cloud
  • +
  • BYOD
  • +
  • quality of service
  • +
  • converged network
  • +
+

57. What term describes a network where one computer can be both client and + server?

+
    +
  • peer-to-peer
  • +
  • cloud
  • +
  • BYOD
  • +
  • quality of service
  • +
+

58. What term describes a type of network used by people who work from home + or from a small remote office?

+
    +
  • SOHO network
  • +
  • BYOD
  • +
  • quality of service
  • +
  • converged network
  • +
+

59. What term describes a computing model where server software runs on + dedicated computers?

+
    +
  • client/server
  • +
  • internet
  • +
  • intranet
  • +
  • extranet
  • +
+

61. What term describes a technology that allows devices to connect to the + LAN using an electrical outlet?

+
    +
  • powerline networking
  • +
  • internet
  • +
  • intranet
  • +
  • extranet
  • +
+

62. What term describes a policy that allows network devices to manage the + flow of data to give priority to voice and video?

+
    +
  • quality of service
  • +
  • internet
  • +
  • intranet
  • +
  • extranet
  • +
+

63. What term describes a private collection of LANs and WANs that belongs to + an organization?

+
    +
  • intranet
  • +
  • internet
  • +
  • extranet
  • +
  • peer-to-peer
  • +
+

64. What term describes the ability to use personal devices across a business + or campus network?

+
    +
  • BYOD
  • +
  • internet
  • +
  • intranet
  • +
  • extranet
  • +
+

65. At which OSI layer is a source IP address added to a PDU during the + encapsulation process?

+
    +
  • network layer
  • +
  • data link layer
  • +
  • transport layer
  • +
  • application layer
  • +
+

66. At which OSI layer is a destination port number added to a PDU during the + encapsulation process?

+
    +
  • transport layer
  • +
  • data link layer
  • +
  • network layer
  • +
  • application layer
  • +
+

67. At which OSI layer is data added to a PDU during the encapsulation + process?

+
    +
  • application layer
  • +
  • data link layer
  • +
  • network layer
  • +
  • transport layer
  • +
+

68. At which OSI layer is a source IP address added to a PDU during the + encapsulation process?

+
    +
  • network layer
  • +
  • data link layer
  • +
  • application layer
  • +
  • presentation layer
  • +
+

69. Which of the following is the name for all computers + connected to a network that participate directly in network + communication?

+
    +
  • Servers
  • +
  • Intermediary device
  • +
  • Host
  • +
  • media
  • +
+

Explanation: Hosts are all computers + connected to a network that participate directly in network communication.

+

70. At which OSI layer is a destination IP address added to a PDU during the + encapsulation process?

+
    +
  • network layer
  • +
  • application layer
  • +
  • transport layer
  • +
  • presentation layer
  • +
+

71. At which OSI layer is a source MAC address added to a PDU during the + encapsulation process?

+
    +
  • data link layer
  • +
  • application layer
  • +
  • transport layer
  • +
  • presentation layer
  • +
+

72. At which OSI layer is a source port number added to a PDU during the + encapsulation process?

+
    +
  • transport layer
  • +
  • application layer
  • +
  • network layer
  • +
  • presentation layer
  • +
  • data link layer
  • +
+

73. At which OSI layer is a destination MAC address added to a PDU during the + encapsulation process?

+
    +
  • data link layer
  • +
  • transport layer
  • +
  • application layer
  • +
  • network layer
  • +
+

74. When data is encoded as pulses of light, which media is being used to + transmit the data?

+
    +
  • Wireless
  • +
  • Fire optic cable
  • +
  • Copper cable
  • +
+

Explanation: Fiber-optic cable is the media + is being used to transmit the data when data is encoded as pulses of light.

+
+

75. Which two devices are intermediary devices? (Choose two)

+
    +
  • Host
  • +
  • Router
  • +
  • Switch
  • +
  • Servers
  • +
+

Explanation: Routers and switches are + intermediary devices.

+
+ + +
+
+
+
+
+
+
+
+
+
+
+
+ Subscribe + +
+
+ +
+
+
+
+
Notify of
+
+ +
+ +
+ +
+ +
+
+
+
+
+
+
+
+ guest
+
+ + + +
+


+
+
+
+
+
+
+ + + + + + + + + + + +
+ +
+
+
+
+
+
+ + +

+

+

+

+
+
+ +
+
+
+
+ 111 Comments +
+
+
+
+
+
+
Inline Feedbacks
+
View all comments
+
+
+
+
+
+
+ Harry Ikwayoni +
+ + +
+
+
+
+ Harry Ikwayoni +
+
+ + 1 month ago +
+ + +
+ +
+ +
+

I am a new student studying this ccna 1 so post the exam questions to + my email address

+ +
+ +
+
+
+
+
+
+
+
+ jonathan joestar +
+ + +
+
+
+
+ jonathan joestar +
+
+ + 4 months ago +
+ + +
+ +
+ +
+

Open the PT Activity. Perform the tasks in the activity instructions and then answer the question. +

+

What is the IP address of the switch virtual interface (SVI) on Switch0? +

+

192.168.5.10

+ +
+ +
+
+
+
+
+
+
+
+ BODE GANSALLO +
+ + +
+
+
+
+ BODE GANSALLO +
+
+ + 7 months ago +
+ + +
+ +
+ +
+

Thanks so much Mr ONI

+ +
+ +
+
+
+
+
+
+
+
+ Jas +
+ + +
+
+
+
+ Jas +
+
+ + 8 months ago +
+ + +
+ +
+ +
+

Are they the same questions for September 2023

+ +
+ +
+
+
+
+
+
+
+
+ Moiz +
+ + +
+
+
+
+ Moiz +
+
+ + 8 months ago +
+ + +
+ +
+ +
+

Question?

+ +
+ +
+
+
+
+
+
+
+
+ Sameer +
+ + +
+
+
+
+ Sameer +
+
+ + 10 months ago +
+ + +
+ +
+ +
+

user is implementing security on a small office network. Which + two actions would provide the minimum security requirements for this + network? (Choose two.)

+ +
+ +
+
+
+
+
+
+
+
+ Pritam kumar +
+ + +
+
+
+
+ Pritam kumar +
+
+ + 1 year ago +
+ + +
+ +
+ +
+

thanks a lot man

+ +
+ +
+
+
+
+
+
+
+
+ rayst +
+ + +
+
+
+
+ rayst +
+
+ + 1 year ago +
+ + +
+ +
+ +
+

Are they the same questions for February 2023?

+ +
+ +
+
+
+
+
+
+
+ r G +
+ + +
+
+
+
+ r G +
+
+ + 1 year ago +
+ + +
+ +
+
+ + Reply to  + + rayst + +
+
+

yes

+ +
+ +
+
+
+
+
+
+
+
+ Crl +
+ + +
+
+
+
+ Crl +
+
+ + 1 year ago +
+ + +
+ +
+
+ + Reply to  + + rayst + +
+
+

is the same ?

+ +
+ +
+
+
+
+
+
+
+
+ Crl +
+ + +
+
+
+
+ Crl +
+
+ + 1 year ago +
+ + +
+ +
+
+ + Reply to  + + rayst + +
+
+

Is the same?

+ +
+ +
+
+
+
+
+
+
+
+
+ rory +
+ + +
+
+
+
+ rory +
+
+ + 1 year ago +
+ + +
+ +
+ +
+

think u

+ +
+ +
+
+
+
+
+
+
+
+ Daniel +
+ + +
+
+
+
+ Daniel +
+
+ + 1 year ago +
+ + +
+ +
+ +
+

Thanks for helping. Much blessing to you

+ +
+ +
+
+
+
+
+
+
+
+ Faysal +
+ + +
+
+
+
+ Faysal +
+
+ + 1 year ago +
+ + +
+ +
+ +
+

Sehr hilfreich 🙏

+ +
+ +
+
+
+
+
+
+
+
+ sean +
+ + +
+
+
+
+ sean +
+
+ + 1 year ago +
+ + +
+ +
+ +
+

Match the term to the value represented.

+

BIT
+ BYTE
+ GIGABYTE
+ KILOBYTE
+ MEGABYTE
+ TERABYTE

+ +
+ +
+
+
+
+
+
+
+ BODE GANSALLO +
+ + +
+
+
+
+ BODE GANSALLO +
+
+ + 7 months ago +
+ + +
+ +
+
+ + Reply to  + + sean + +
+
+

BIT
+ BYTE
+ KILOBYTE
+ MEGABYTE
+ GIGABYTE
+ TERABYTE

+ +
+ +
+
+
+
+
+
+
+
+
+ Max +
+ + +
+
+
+
+ Max +
+
+ + 1 year ago +
+ + +
+ +
+ +
+

Thanks!

+ +
+ +
+
+
+
+
+
+
+
+ hue +
+ + +
+
+
+
+ hue +
+
+ + 1 year ago +
+ + +
+ +
+ +
+

thanks a lot

+ +
+ +
+
+
+
+
+
+
+
+ Evans +
+ + +
+
+
+
+ Evans +
+
+ + 1 year ago +
+ + +
+ +
+ +
+

thanks for helping

+ +
+ +
+
+
+
+
+
+
+
+ Rodrigue +
+ + +
+
+
+
+ Rodrigue +
+
+ + 1 year ago +
+ + +
+ +
+ +
+

Thanks for your help

+ +
+ +
+
+
+
+
+
+
+
+ Rose +
+ + +
+
+
+
+ Rose +
+
+ + 1 year ago +
+ + +
+ +
+ +
+

Thank you very much for sharing this. I didn’t + care much it’s legit or not. it’s finally done. 

+ +
+ +
+
+
+
+
+
+
+
+ Tam Tur +
+ + +
+
+
+
+ Tam Tur +
+
+ + 1 year ago +
+ + +
+ +
+ +
+

COOL Thank You vey much! ;o)

+ +
+ +
+
+
+
+
+
+
+
+ Thanh +
+ + +
+
+
+
+ Thanh +
+
+ + 1 year ago +
+ + +
+ +
+ +
+

Thanks so much

+ +
+ +
+
+
+
+
+
+
+
+ Jakeidk +
+ + +
+
+
+
+ Jakeidk +
+
+ + 1 year ago +
+ + +
+ +
+ +
+

Trust me guys, it only gets worse

+ +
+ +
+
+
+
+
+
+
+
+ hutr +
+ + +
+
+
+
+ hutr +
+
+ + 2 years ago +
+ + +
+ +
+ +
+

Thanks so much

+ +
+ +
+
+
+
+
+
+
+
+ Uche +
+ + +
+
+
+
+ Uche +
+
+ + 2 years ago +
+ + +
+ +
+ +
+

Thanks very much

+ +
+ +
+
+
+
+
+
+
+
+ Amr +
+ + +
+
+
+
+ Amr +
+
+ + 2 years ago +
+ + +
+ +
+ +
+

Thanks so much

+ +
+ +
+
+
+
+
+
+
+
+ Patrick +
+ + +
+
+
+
+ Patrick +
+
+ + 2 years ago +
+ + +
+ +
+ +
+

Thank you very much

+ +
+ +
+
+
+
+
+
+
+
+ Eduson +
+ + +
+
+
+
+ Eduson +
+
+ + 2 years ago +
+ + +
+ +
+ +
+

I love this page!

+ +
+ +
+
+
+
+
+
+
+
+ Tedy +
+ + +
+
+
+
+ Tedy +
+
+ + 2 years ago +
+ + +
+ +
+ +
+

PLS correct this:

+

69. Which of the following is the name for all computers connected to + a network that participate directly in network communication?

+

Servers
+ Intermediary device – not correct
+ Host media – correct
+ PLS corect this:

+ +
+ +
+
+
+
+
+
+
+
+ Zelalem +
+ + +
+
+
+
+ Zelalem +
+
+ + 2 years ago +
+ + +
+ +
+ +
+

Thank you for your support. but answers of question no 69 is not + correct

+ +
+ +
+
+
+
+
+
+
+
+ Pepa Jamnický dsf +
+ + +
+
+
+
+ Pepa Jamnický dsf +
+
+ + 2 years ago +
+ + +
+ +
+ +
+

very good wether todaj, maine svarta is god

+ +
+ +
+
+
+
+
+
+
+
+ Muhammed +
+ + +
+
+
+
+ Muhammed +
+
+ + 2 years ago +
+ + +
+ +
+ +
+

güzel 🇹🇷🇹🇷🇹🇷🇹🇷

+ +
+ +
+
+
+
+
+
+
+
+ ikot +
+ + +
+
+
+
+ ikot +
+
+ + 2 years ago +
+ + +
+ +
+ +
+

Which attack slows down or crashes equipment and programs?

+
    +
  1. Firewall
  2. +
  3. Virus, worm, or Trojan horse
  4. +
  5. Zero-day or Zero-hour
  6. +
  7. Virtual Private Network (VPN)
  8. +
  9. Denial of Service (DoS)
  10. +
+

Which option creates a secure connection for remote workers?

+
    +
  1. Firewall
  2. +
  3. Virus, worm, or Trojan horse
  4. +
  5. Zero-day or Zero-hour
  6. +
  7. Virtual Private Network (VPN) +
  8. +
  9. Denial of Service (DoS)
  10. +
+

Which option blocks unauthorized access to your network?

+
    +
  1. Firewall
  2. +
  3. Virus, worm, or Trojan horse
  4. +
  5. Zero-day or Zero-hour
  6. +
  7. Virtual Private Network (VPN)
  8. +
  9. Denial of Service (DoS)
  10. +
+

Which option describes a network attack that occurs on the first day + that a vulnerability becomes known?

+
    +
  1. Firewall
  2. +
  3. Virus, worm, or Trojan horse
  4. +
  5. Zero-day or Zero-hour
  6. +
  7. Virtual Private Network (VPN)
  8. +
  9. Denial of Service (DoS)
  10. +
+

Which option describes malicious code running on user devices?

+
    +
  1. Firewall
  2. +
  3. Virus, worm, or Trojan horse +
  4. +
  5. Zero-day or Zero-hour
  6. +
  7. Virtual Private Network (VPN)
  8. +
  9. Denial of Service (DoS)
  10. +
+ +
+ +
+
+
+
+
+
+
+
+ ikot +
+ + +
+
+
+
+ ikot +
+
+ + 2 years ago +
+ + +
+ +
+ +
+

Which feature is a good conferencing tool to use with others who are + located elsewhere in your city, or even in another country?

+
    +
  1. BYOD
  2. +
  3. Video communications
  4. +
  5. Cloud computing
  6. +
+

Which feature describes using personal tools to access information + and communicate across a business or campus network?

+
    +
  1. BYOD
  2. +
  3. Video communications
  4. +
  5. Cloud computing
  6. +
+

Which feature contains options such as Public, Private, Custom and + Hybrid?

+
    +
  1. BYOD
  2. +
  3. Video communications
  4. +
  5. Cloud computing
  6. +
+

Which feature is being used when connecting a device to the network + using an electrical outlet?

+
    +
  1. Smart home technology
  2. +
  3. Powerline
  4. +
  5. Wireless broadband
  6. +
+

Which feature uses the same cellular technology as a smart phone?

+
    +
  1. Smart home technology
  2. +
  3. Powerline
  4. +
  5. Wireless broadband
  6. +
+ +
+ +
+
+
+
+
+
+
+
+ ikot +
+ + +
+
+
+
+ ikot +
+
+ + 2 years ago +
+ + +
+ +
+ +
+

When designers follow accepted standards and protocols, which of + the four basic characteristics of network architecture is + achieved?

+
    +
  1. fault tolerance
  2. +
  3. Scalability
  4. +
  5. QoS
  6. +
  7. Security
  8. +
+

Confidentiality, integrity, and availability are requirements of + which of the four basic characteristics of network architecture?

+
    +
  1. fault tolerance
  2. +
  3. Scalability
  4. +
  5. QoS
  6. +
  7. Security
  8. +
+

With which type of policy, a router can manage the flow of data and + voice traffic, giving priority to voice communications if the + network + experiences congestion?

+
    +
  1. fault tolerance
  2. +
  3. Scalability
  4. +
  5. QoS
  6. +
  7. Security
  8. +
+

Having multiple paths to a destination is known as redundancy. This + is an example of which characteristic of network architecture?

+
    +
  1. fault tolerance
  2. +
  3. Scalability
  4. +
  5. QoS
  6. +
  7. Security
  8. +
+ +
+ +
+
+
+
+
+
+
+
+ ikot +
+ + +
+
+
+
+ ikot +
+
+ + 2 years ago +
+ + +
+ +
+ +
+

Which network infrastructure provides access to users and end + devices in a small geographical area, which is typically a network + in a + department in an enterprise, a home, or small business?

+
    +
  1. Extranet
  2. +
  3. Intranet
  4. +
  5. LAN
  6. +
  7. WAN
  8. +
+

Which network infrastructure might an organization use to provide + secure and safe access to individuals who work for a different + organization but require access to the organization’s data?

+
    +
  1. Extranet
  2. +
  3. Intranet
  4. +
  5. LAN
  6. +
  7. WAN
  8. +
+

Which network infrastructure provides access to other networks over a + large geographical area, which is often owned and managed by a + telecommunications service provider?

+
    +
  1. Extranet
  2. +
  3. Intranet
  4. +
  5. LAN
  6. +
  7. WAN
  8. +
+ +
+ +
+
+
+
+
+
+
+
+ someone +
+ + +
+
+
+
+ someone +
+
+ + 2 years ago +
+ + +
+ +
+ +
+

is there is a way to delete the mark of the answers and after + answering them to view it again ?

+ +
+ +
+
+
+
+
+
+
+ Anon +
+ + +
+
+
+
+ Anon +
+
+ + 2 years ago +
+ + +
+ +
+
+ + Reply to  + + someone + +
+
+

You can copy the text and transfer it to a text editor on your + computer, then assign a single color to the entire text and + remove the + bold text.

+ +
+ +
+
+
+
+
+
+
+
+
+ Anything +
+ + +
+
+
+
+ Anything +
+
+ + 2 years ago +
+ + +
+ +
+ +
+

Good quiz!!

+ +
+ +
+
+
+
+
+
+
+
+ Anonymous +
+ + +
+
+
+
+ Anonymous +
+
+ + 2 years ago +
+ + +
+ +
+ +
+

In the show running-config command, which + part of the syntax is represented by running-config ? +

+
    +
  • a keyword
  • +
  • a variable
  • +
  • a prompt
  • +
  • the command
  • +
  • Navigation Bar
  • +
+ +
+ +
+
+
+
+
+
+
+ Edgar +
+ + +
+
+
+
+ Edgar +
+
+ + 2 years ago +
+ + +
+ +
+
+ + Reply to  + + Anonymous + +
+
+

keyword

+ +
+ +
+
+
+
+
+
+
+
+ Anonymius +
+ + +
+
+
+
+ Anonymius +
+
+ + 2 years ago +
+ + +
+ +
+
+ + Reply to  + + Anonymous + +
+
+

a keyword

+ +
+ +
+
+
+
+
+
+
+
+ someone +
+ + +
+
+
+
+ someone +
+
+ + 2 years ago +
+ + +
+ +
+
+ + Reply to  + + Anonymous + +
+
+

is there is a way to delete the mark of the answers and after + answering them to view it again ?

+

?

+ +
+ +
+
+
+
+ +
+
+
+
+
+
+
+ Barath Kumar +
+ + +
+
+
+
+ Barath Kumar +
+
+ + 2 years ago +
+ + +
+ +
+
+ + Reply to  + + Anonymous + +
+
+

Keyword

+ +
+ +
+
+
+
+
+
+
+
+ Tob +
+ + +
+
+
+
+ Tob +
+
+ + 1 year ago +
+ + +
+ +
+
+ + Reply to  + + Anonymous + +
+
+

Keyword

+ +
+ +
+
+
+
+
+
+
+
+
+ balvinder +
+ + +
+
+
+
+ balvinder +
+
+ + 2 years ago +
+ + +
+ +
+ +
+

To prepare for exam, only CCNAv7 Questions are enough or should i + also complete CCNAv6 .
+ Waiting for reply
+ Thanks

+ +
+ +
+
+
+
+ +
+
+
+
+
+
+
+ Lucky +
+ + +
+
+
+
+ Lucky +
+
+ + 3 years ago +
+ + +
+ +
+ +
+

Nice job guys

+ +
+ +
+
+
+
+
+
+
+
+ Erdenebat +
+ + +
+
+
+
+ Erdenebat +
+
+ + 3 years ago +
+ + +
+ +
+ +
+

thanks guys

+ +
+ +
+
+
+
+
+
+
+
+ Guess +
+ + +
+
+
+
+ Guess +
+
+ + 3 years ago +
+ + +
+ +
+ +
+

Great job thanks guys.

+ +
+ +
+
+
+
+
+
+
+
+ Ali +
+ + +
+
+
+
+ Ali +
+
+ + 3 years ago +
+ + +
+ +
+ +
+

It’s also same questions in 2021. Good luck

+ +
+ +
+
+
+
+
+
+
+
+ idris wale +
+ + +
+
+
+
+ idris wale +
+
+ + 3 years ago +
+ + +
+ +
+ +
+

Is this for 2021 and will it definitely come up?

+ +
+ +
+
+
+
+
+
+
+ Ali +
+ + +
+
+
+
+ Ali +
+
+ + 3 years ago +
+ + +
+ +
+
+ + Reply to  + + idris wale + +
+
+

Same questions no changes at all I just took now.

+ +
+ +
+
+
+
+
+
+
+
+
+ M3mason +
+ + +
+
+
+
+ M3mason +
+
+ + 3 years ago +
+ + +
+ +
+ +
+

The last few questions are different between the Test and the answer + sheet

+ +
+ +
+
+
+
+
+
+
+
+ AnMej +
+ + +
+
+
+
+ AnMej +
+
+ + 3 years ago +
+ + +
+ +
+ +
+

+ A technician configures a switch with these commands:
+
+ SwitchA(config)# interface vlan + 1
+ SwitchA(config-if)# ip address + 192.168.1.1 255.255.255.0
+ SwitchA(config-if)# no + shutdown
+
+ What is the technician configuring?

+

Telnet access
+ SVI
+ password encryption
+ physical switchport access

+ +
+ +
+
+
+
+ +
+
+
+
+
+
+ Tob +
+ + +
+
+
+
+ Tob +
+
+ + 1 year ago +
+ + +
+ +
+
+ + Reply to  + + AnMej + +
+
+

Svi

+ +
+ +
+
+
+
+
+
+
+
+
+ Ajab Gul +
+ + +
+
+
+
+ Ajab Gul +
+
+ + 3 years ago +
+ + +
+ +
+ +
+

Admin plz solve them

+

Which of the following is the name for all computers connected to a + network that participate directly in network communication?

+

Servers
+ Intermediary device
+ Host media

+

2: When data is encoded as pulses of light, which media is being used + to transmit the data?

+

Wireless
+ Fire optic cable
+ Copper cable

+

3;
+ Which two devices are intermediary devices? (Choose two)

+

Host
+ Router
+ Switch
+ Servers

+ +
+ +
+
+
+
+ +
+
+
+
+
+
+ Bulbolits +
+ + +
+
+
+
+ Bulbolits +
+
+ + 3 years ago +
+ + +
+ +
+
+ + Reply to  + + Ajab Gul + +
+
+
    +
  1. host media
  2. +
  3. fiber optic
  4. +
+ +
+ +
+
+
+
+
+
+
+
+ Jap Preet Singh +
+ + +
+
+
+
+ Jap Preet Singh +
+
+ + 3 years ago +
+ + +
+ +
+
+ + Reply to  + + Ajab Gul + +
+
+

these were module practice question

+ +
+ +
+
+
+
+
+
+
+
+
+ imtiyaz +
+ + +
+
+
+
+ imtiyaz +
+
+ + 3 years ago +
+ + +
+ +
+ +
+

is this the 200-301 questions?

+ +
+ +
+
+
+
+
+
+
+
+ adobi +
+ + +
+
+
+
+ adobi +
+
+ + 3 years ago +
+ + +
+ +
+ +
+

help me this is too hard ,ohhhh,i am dying

+ +
+ +
+
+
+
+
+
+
+
+ Abodi +
+ + +
+
+
+
+ Abodi +
+
+ + 3 years ago +
+ + +
+ +
+ +
+

I am a new student in ccna ..

+

how can i know my number of exam, certificate ?

+

is this answers for my exam or not ?

+

Thanks Alot .. I am a beginner, sorry.

+ +
+ +
+
+
+
+
+
+
+ Teeviraj janki +
+ + +
+
+
+
+ Teeviraj janki +
+
+ + 3 years ago +
+ + +
+ +
+
+ + Reply to  + + Abodi + +
+
+

ccna 200 301 code num

+ +
+ +
+
+
+
+
+
+
+
+
+ Marcel +
+ + +
+
+
+
+ Marcel +
+
+ + 3 years ago +
+ + +
+ +
+ +
+

Thxxxxxx

+ +
+ +
+
+
+
+
+
+
+
+ Vikramaditya Sarja +
+ + +
+
+
+
+ Vikramaditya Sarja +
+
+ + 3 years ago +
+ + +
+ +
+ +
+

thanks a lot for providing the best able course to us from the + cisco.Also I request you to expand these launching with some new + ideas + and also providing a best material to the students for understanding + purpose.

+ +
+ +
+
+
+
+ +
+
+
+
+
+ +
+ +
+
+
+
+
+
+
+
+
+ +
+ +
+ + +
+ +
+
+
+ +
+ + + + diff --git a/test/data/ccna1v7mod1-3/test.json b/test/data/ccna1v7mod1-3/test.json new file mode 100644 index 0000000..b5f127c --- /dev/null +++ b/test/data/ccna1v7mod1-3/test.json @@ -0,0 +1,60 @@ +{ + "name": "CCNA 1 v7 Modules 1 - 3 Basic Network Connectivity and Communications Exam Answers", + "file": "data.html", + "expected": [ + { + "question": "What is an ISP?", + "answers": [ + "It is an organization that enables individuals and businesses to connect to the Internet." + ] + }, + { + "question": "What type of network traffic requires QoS?", + "answers": ["video conferencing"] + }, + { + "question": "Which interface allows remote management of a Layer 2 switch?", + "answers": ["the switch virtual interface"] + }, + { + "question": "How is SSH different from Telnet?", + "answers": [ + "SSH provides security to \nremote sessions by encrypting messages and using user authentication. \nTelnet is considered insecure and sends messages in plaintext." + ] + }, + { + "question": "What are three characteristics of an SVI? (Choose three.)", + "answers": [ + "It is not associated with any physical interface on a switch.", + "It provides a means to remotely manage a switch.", + "It is associated with VLAN1 by default." + ] + }, + { + "question": "Which name is assigned to the transport layer PDU?", + "answers": ["segment"] + }, + { + "question": "What process involves placing one PDU inside of another PDU?", + "answers": ["encapsulation"] + }, + { + "question": "What is a characteristic of multicast messages?", + "answers": ["They are sent to a select group of hosts."] + }, + { + "question": "Which statement is correct about network protocols?", + "answers": [ + "They define how messages are exchanged between the source and the destination." + ] + }, + { + "question": "Why would a Layer 2 switch need an IP address?", + "answers": ["to enable the switch to be managed remotely"] + }, + { + "question": "Which two devices are intermediary devices? (Choose two)", + "answers": ["Router", "Switch"] + } + ] +} diff --git a/test/fetch.test.js b/test/fetch.test.js new file mode 100644 index 0000000..6f04ea5 --- /dev/null +++ b/test/fetch.test.js @@ -0,0 +1,32 @@ +const fs = require('fs'); +const vm = require('vm'); +const { JSDOM } = require('jsdom'); +const { diff } = require('deep-diff'); + +const scriptContent = fs.readFileSync('../src/fetch.js', 'utf8'); + +/** + * @param testData {string} + * @param expectedData {Array} + * @returns {Promise>} + */ +module.exports = async function executeFetchTest(testData, expectedData) { + const sandbox = { + window: {}, + DOMParser: new JSDOM().window.DOMParser, + console: console + }; + vm.createContext(sandbox); + vm.runInContext(scriptContent, sandbox); + const { parseAnswers } = sandbox; + return new Promise((resolve, reject) => { + parseAnswers({ responseText: testData }, results => { + const { diff } = require('deep-diff'); + const changes = diff({ data: results }, { data: expectedData }); + if (changes !== undefined) { + reject(changes); + } + resolve(); + }); + }); +}; diff --git a/test/jsconfig.json b/test/jsconfig.json new file mode 100644 index 0000000..20ee0c8 --- /dev/null +++ b/test/jsconfig.json @@ -0,0 +1,7 @@ +{ + "compilerOptions": { + "checkJs": true, + "module": "commonjs", + "target": "es6" + } +} diff --git a/test/package-lock.json b/test/package-lock.json new file mode 100644 index 0000000..4f36b0a --- /dev/null +++ b/test/package-lock.json @@ -0,0 +1,548 @@ +{ + "name": "test", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "dependencies": { + "chalk": "^4", + "deep-diff": "^1.0.2", + "jsdom": "^24.0.0", + "vm": "^0.1.0" + } + }, + "node_modules/agent-base": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.3.tgz", + "integrity": "sha512-jRR5wdylq8CkOe6hei19GGZnxM6rBGwFl3Bg0YItGDimvjGtAvdZk4Pu6Cl4u4Igsws4a1fd1Vq3ezrhn4KmFw==", + "license": "MIT", + "engines": { + "node": ">= 14" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", + "license": "MIT" + }, + "node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "license": "MIT" + }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "license": "MIT", + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/cssstyle": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-4.1.0.tgz", + "integrity": "sha512-h66W1URKpBS5YMI/V8PyXvTMFT8SupJ1IzoIV8IeBC/ji8WVmrO8dGlTi+2dh6whmdk6BiKJLD/ZBkhWbcg6nA==", + "license": "MIT", + "dependencies": { + "rrweb-cssom": "^0.7.1" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/data-urls": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-5.0.0.tgz", + "integrity": "sha512-ZYP5VBHshaDAiVZxjbRVcFJpc+4xGgT0bK3vzy1HLN8jTO975HEbuYzZJcHoQEY5K1a0z8YayJkyVETa08eNTg==", + "license": "MIT", + "dependencies": { + "whatwg-mimetype": "^4.0.0", + "whatwg-url": "^14.0.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/debug": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz", + "integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/decimal.js": { + "version": "10.4.3", + "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.4.3.tgz", + "integrity": "sha512-VBBaLc1MgL5XpzgIP7ny5Z6Nx3UrRkIViUkPUdtl9aya5amy3De1gsUUSB1g3+3sExYNjCAsAznmukyxCb1GRA==", + "license": "MIT" + }, + "node_modules/deep-diff": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/deep-diff/-/deep-diff-1.0.2.tgz", + "integrity": "sha512-aWS3UIVH+NPGCD1kki+DCU9Dua032iSsO43LqQpcs4R3+dVv7tX0qBGjiVHJHjplsoUM2XRO/KB92glqc68awg==", + "license": "MIT" + }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "license": "MIT", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/entities": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", + "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==", + "license": "BSD-2-Clause", + "engines": { + "node": ">=0.12" + }, + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, + "node_modules/form-data": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.1.tgz", + "integrity": "sha512-tzN8e4TX8+kkxGPK8D5u0FNmjPUjw3lwC9lSLxxoB/+GtsJG91CO8bSWy73APlgAZzZbXEYZJuxjkHH2w+Ezhw==", + "license": "MIT", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/html-encoding-sniffer": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-4.0.0.tgz", + "integrity": "sha512-Y22oTqIU4uuPgEemfz7NDJz6OeKf12Lsu+QC+s3BVpda64lTiMYCyGwg5ki4vFxkMwQdeZDl2adZoqUgdFuTgQ==", + "license": "MIT", + "dependencies": { + "whatwg-encoding": "^3.1.1" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/http-proxy-agent": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-7.0.2.tgz", + "integrity": "sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig==", + "license": "MIT", + "dependencies": { + "agent-base": "^7.1.0", + "debug": "^4.3.4" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/https-proxy-agent": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.6.tgz", + "integrity": "sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==", + "license": "MIT", + "dependencies": { + "agent-base": "^7.1.2", + "debug": "4" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/iconv-lite": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", + "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", + "license": "MIT", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-potential-custom-element-name": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz", + "integrity": "sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==", + "license": "MIT" + }, + "node_modules/jsdom": { + "version": "24.1.3", + "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-24.1.3.tgz", + "integrity": "sha512-MyL55p3Ut3cXbeBEG7Hcv0mVM8pp8PBNWxRqchZnSfAiES1v1mRnMeFfaHWIPULpwsYfvO+ZmMZz5tGCnjzDUQ==", + "license": "MIT", + "dependencies": { + "cssstyle": "^4.0.1", + "data-urls": "^5.0.0", + "decimal.js": "^10.4.3", + "form-data": "^4.0.0", + "html-encoding-sniffer": "^4.0.0", + "http-proxy-agent": "^7.0.2", + "https-proxy-agent": "^7.0.5", + "is-potential-custom-element-name": "^1.0.1", + "nwsapi": "^2.2.12", + "parse5": "^7.1.2", + "rrweb-cssom": "^0.7.1", + "saxes": "^6.0.0", + "symbol-tree": "^3.2.4", + "tough-cookie": "^4.1.4", + "w3c-xmlserializer": "^5.0.0", + "webidl-conversions": "^7.0.0", + "whatwg-encoding": "^3.1.1", + "whatwg-mimetype": "^4.0.0", + "whatwg-url": "^14.0.0", + "ws": "^8.18.0", + "xml-name-validator": "^5.0.0" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "canvas": "^2.11.2" + }, + "peerDependenciesMeta": { + "canvas": { + "optional": true + } + } + }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "license": "MIT", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/nwsapi": { + "version": "2.2.16", + "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.16.tgz", + "integrity": "sha512-F1I/bimDpj3ncaNDhfyMWuFqmQDBwDB0Fogc2qpL3BWvkQteFD/8BzWuIRl83rq0DXfm8SGt/HFhLXZyljTXcQ==", + "license": "MIT" + }, + "node_modules/parse5": { + "version": "7.2.1", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-7.2.1.tgz", + "integrity": "sha512-BuBYQYlv1ckiPdQi/ohiivi9Sagc9JG+Ozs0r7b/0iK3sKmrb0b9FdWdBbOdx6hBCM/F9Ir82ofnBhtZOjCRPQ==", + "license": "MIT", + "dependencies": { + "entities": "^4.5.0" + }, + "funding": { + "url": "https://github.com/inikulin/parse5?sponsor=1" + } + }, + "node_modules/psl": { + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.15.0.tgz", + "integrity": "sha512-JZd3gMVBAVQkSs6HdNZo9Sdo0LNcQeMNP3CozBJb3JYC/QUYZTnKxP+f8oWRX4rHP5EurWxqAHTSwUCjlNKa1w==", + "license": "MIT", + "dependencies": { + "punycode": "^2.3.1" + }, + "funding": { + "url": "https://github.com/sponsors/lupomontero" + } + }, + "node_modules/punycode": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/querystringify": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz", + "integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==", + "license": "MIT" + }, + "node_modules/requires-port": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", + "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==", + "license": "MIT" + }, + "node_modules/rrweb-cssom": { + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/rrweb-cssom/-/rrweb-cssom-0.7.1.tgz", + "integrity": "sha512-TrEMa7JGdVm0UThDJSx7ddw5nVm3UJS9o9CCIZ72B1vSyEZoziDqBYP3XIoi/12lKrJR8rE3jeFHMok2F/Mnsg==", + "license": "MIT" + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "license": "MIT" + }, + "node_modules/saxes": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/saxes/-/saxes-6.0.0.tgz", + "integrity": "sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA==", + "license": "ISC", + "dependencies": { + "xmlchars": "^2.2.0" + }, + "engines": { + "node": ">=v12.22.7" + } + }, + "node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/symbol-tree": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz", + "integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==", + "license": "MIT" + }, + "node_modules/tough-cookie": { + "version": "4.1.4", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.1.4.tgz", + "integrity": "sha512-Loo5UUvLD9ScZ6jh8beX1T6sO1w2/MpCRpEP7V280GKMVUQ0Jzar2U3UJPsrdbziLEMMhu3Ujnq//rhiFuIeag==", + "license": "BSD-3-Clause", + "dependencies": { + "psl": "^1.1.33", + "punycode": "^2.1.1", + "universalify": "^0.2.0", + "url-parse": "^1.5.3" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/tr46": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-5.0.0.tgz", + "integrity": "sha512-tk2G5R2KRwBd+ZN0zaEXpmzdKyOYksXwywulIX95MBODjSzMIuQnQ3m8JxgbhnL1LeVo7lqQKsYa1O3Htl7K5g==", + "license": "MIT", + "dependencies": { + "punycode": "^2.3.1" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/universalify": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.2.0.tgz", + "integrity": "sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==", + "license": "MIT", + "engines": { + "node": ">= 4.0.0" + } + }, + "node_modules/url-parse": { + "version": "1.5.10", + "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz", + "integrity": "sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==", + "license": "MIT", + "dependencies": { + "querystringify": "^2.1.1", + "requires-port": "^1.0.0" + } + }, + "node_modules/vm": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/vm/-/vm-0.1.0.tgz", + "integrity": "sha512-1aKVjgohVDnVhGrJLhl2k8zIrapH+7HsdnIjGvBp3XX2OCj6XGzsIbDp9rZ3r7t6qgDfXEE1EoEAEOLJm9LKnw==", + "license": "MIT" + }, + "node_modules/w3c-xmlserializer": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-5.0.0.tgz", + "integrity": "sha512-o8qghlI8NZHU1lLPrpi2+Uq7abh4GGPpYANlalzWxyWteJOCsr/P+oPBA49TOLu5FTZO4d3F9MnWJfiMo4BkmA==", + "license": "MIT", + "dependencies": { + "xml-name-validator": "^5.0.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/webidl-conversions": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz", + "integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==", + "license": "BSD-2-Clause", + "engines": { + "node": ">=12" + } + }, + "node_modules/whatwg-encoding": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-3.1.1.tgz", + "integrity": "sha512-6qN4hJdMwfYBtE3YBTTHhoeuUrDBPZmbQaxWAqSALV/MeEnR5z1xd8UKud2RAkFoPkmB+hli1TZSnyi84xz1vQ==", + "license": "MIT", + "dependencies": { + "iconv-lite": "0.6.3" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/whatwg-mimetype": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-4.0.0.tgz", + "integrity": "sha512-QaKxh0eNIi2mE9p2vEdzfagOKHCcj1pJ56EEHGQOVxp8r9/iszLUUV7v89x9O1p/T+NlTM5W7jW6+cz4Fq1YVg==", + "license": "MIT", + "engines": { + "node": ">=18" + } + }, + "node_modules/whatwg-url": { + "version": "14.1.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-14.1.0.tgz", + "integrity": "sha512-jlf/foYIKywAt3x/XWKZ/3rz8OSJPiWktjmk891alJUEjiVxKX9LEO92qH3hv4aJ0mN3MWPvGMCy8jQi95xK4w==", + "license": "MIT", + "dependencies": { + "tr46": "^5.0.0", + "webidl-conversions": "^7.0.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/ws": { + "version": "8.18.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.0.tgz", + "integrity": "sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==", + "license": "MIT", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/xml-name-validator": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-5.0.0.tgz", + "integrity": "sha512-EvGK8EJ3DhaHfbRlETOWAS5pO9MZITeauHKJyb8wyajUfQUenkIg2MvLDTZ4T/TgIcm3HU0TFBgWWboAZ30UHg==", + "license": "Apache-2.0", + "engines": { + "node": ">=18" + } + }, + "node_modules/xmlchars": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/xmlchars/-/xmlchars-2.2.0.tgz", + "integrity": "sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==", + "license": "MIT" + } + } +} diff --git a/test/package.json b/test/package.json index 2c44c11..80d69a1 100644 --- a/test/package.json +++ b/test/package.json @@ -1,5 +1,11 @@ { "scripts": { "test": "node test.js" + }, + "dependencies": { + "chalk": "^4", + "deep-diff": "^1.0.2", + "jsdom": "^24.0.0", + "vm": "^0.1.0" } } diff --git a/test/test.js b/test/test.js index e67afbc..eb3e645 100644 --- a/test/test.js +++ b/test/test.js @@ -1 +1,70 @@ -console.log('Test Okay'); +const fs = require('fs'); +const path = require('path'); +const chalk = require('chalk'); +const executeFetchTest = require('./fetch.test'); + +const ERROR_MESSAGE = chalk.red('[Error]'); +const TEST_MESSAGE = chalk.blue('[Test]'); +const SUCCESS_MESSAGE = chalk.green('Success:'); +const FAILED_MESSAGE = chalk.red('Failed:'); + +(async () => { + let fail = 0; + const dataDirectory = path.join(__dirname, 'data'); + const directories = fs.readdirSync(dataDirectory); + const promises = directories.map(directory => { + const testDataDirectory = path.join(dataDirectory, directory); + + if (!fs.lstatSync(testDataDirectory).isDirectory()) { + console.error( + ERROR_MESSAGE, + 'Test data directory is not a directory:', + testDataDirectory + ); + return Promise.resolve(); + } + + const testJSONFilePath = path.join(testDataDirectory, 'test.json'); + if (!fs.existsSync(testJSONFilePath)) { + console.error( + ERROR_MESSAGE, + 'Test config file missing:', + testJSONFilePath + ); + return Promise.resolve(); + } + + const data = fs.readFileSync(testJSONFilePath, 'utf8'); + try { + const jsonData = JSON.parse(data); + const testData = fs.readFileSync( + path.join(testDataDirectory, jsonData.file), + 'utf8' + ); + + return executeFetchTest(testData, jsonData.expected) + .then(() => { + console.log(TEST_MESSAGE, SUCCESS_MESSAGE, jsonData.name); + }) + .catch(error => { + fail++; + console.error( + TEST_MESSAGE, + FAILED_MESSAGE, + jsonData.name, + error + ); + }); + } catch (parseErr) { + console.error(ERROR_MESSAGE, 'Parsing test config file:', parseErr); + return Promise.resolve(); + } + }); + + await Promise.all(promises); + + if (fail > 0) { + process.exitCode = 1; + console.error(`${ERROR_MESSAGE} Failed Tests: ${fail}`); + } +})(); diff --git a/types/Answer.d.js b/types/Answer.d.js new file mode 100644 index 0000000..ac3db36 --- /dev/null +++ b/types/Answer.d.js @@ -0,0 +1,5 @@ +/** + * @typedef {Object} Answer + * @property {string} question + * @property {Array} answers + */