1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
otez555 [7]
3 years ago
13

Write an If/else statement to check whether host is online. If it is online, then print system is online otherwise print system

is unreachable.
Computers and Technology
1 answer:
Reika [66]3 years ago
4 0

Answer:

from socket import *

hostname = input('Enter the host to be scanned: ')

ip_add = gethostbyname(hostname)

connections = [ ]    

for i in range(133, 136):

   s = socket(AF_INET, SOCK_STREAM)

     

   conn = s.connect_ex((ip_add, i))

   print(conn)

   connections.append(conn)

if 0 in connections:

   print ('Host is online')

   s.close()

else:

   print ('system is unreachable')

Explanation:

The python source code above scans for all the available range of ports in the provided hostname, if any port is available, the host is online else the program print the error message "system is unreachable.

You might be interested in
Enzymes_____________.
lord [1]

Answer:

b. speed up chemical reactions.

Explanation:

brainly plz

4 0
2 years ago
Read one positive integer n. Then create an n X n two-dimensional array and write the code that stores integers from 1 to n2 as
marysya [2.9K]

Answer:

The program in Java is as follows:

import java.util.*;

public class Main{

public static void main(String[] args) {

    int n;

    Scanner input = new Scanner(System.in);

 System.out.print("Size of array: ");

 n = input.nextInt();

 int count = 1;

 int[][] arr = new int[n][n];

 for(int i = 0; i<n;i++){

     for(int j = 0; j<n;j++){

         arr[i][j] = count;

         count++;      }  }

 for(int i = 0; i<n;i++){

     for(int j = 0; j<n; j++){

         System.out.printf(arr[i][j]+" ");      }

     System.out.println();  } }}

Explanation:

This declares the size of the array

    int n;

    Scanner input = new Scanner(System.in);

This prompts the user for size of array

 System.out.print("Size of array: ");

This gets input for size of array

 n = input.nextInt();

This initializes the array element to 1

 int count = 1;

This creates a 2d array

 int[][] arr = new int[n][n];

This iterates through the rows

 for(int i = 0; i<n;i++){

This iterates through the columns

     for(int j = 0; j<n;j++){

This populates the array

         arr[i][j] = count;

         count++;      }  }

The following nested loop prints the array elements

 for(int i = 0; i<n;i++){

     for(int j = 0; j<n; j++){

         System.out.printf(arr[i][j]+" ");      }

     System.out.println();  } }}

8 0
2 years ago
IBM’s system that is built on the middle ground approach to AI.
Norma-Jean [14]

Answer:

IBM Watson is AI for business. Watson helps organizations predict future outcomes, automate complex processes, and optimize employees' time.

Explanation:

6 0
2 years ago
In a forest ecosystem, which of the following is the best example of a limiting factor for a rabbit population?
Verdich [7]

Answer:

A rise in the population of predators is followed by a decrease in the population of prey.

5 0
3 years ago
After Sally adds the Print Preview and Print command to the Quick Access Toolbar, which icon would she have added? the icon that
rewona [7]

Answer: the icon that shows a sheet of paper and a magnifying glass

Explanation:

The Quick Access Toolbar, gives access to the features that are usually used like Save, Undo/Redo. It can also be customized such that the commands that the users usually use can be placed quicker and therefore makes them easier to use.

After Sally adds the Print Preview and Print command to the Quick Access Toolbar, the icon that she would have added is the icon that shows a sheet of paper and a magnifying glass.

3 0
2 years ago
Read 2 more answers
Other questions:
  • What are the differences in LAN and WAN and how they are used to Increase Cybersecurity
    7·1 answer
  • Write a program that reads a person's first and last names separated by a space, assuming the first and last names are both sing
    10·1 answer
  • You have just purchased a motherboard that has an LGA 1156 socket for an Intel Pentium processor. What type of memory modules wi
    14·1 answer
  • A student opens a recently purchased software package and begins reading the enclosed materials. What information might be inclu
    6·1 answer
  • One of the main responsibilities employers have under OSHA is to:
    9·2 answers
  • When you are working in Performance Monitor, in the "Add Counters" dialog box, and need more information about a particular coun
    8·1 answer
  • Which of the following is an example of a tax?
    11·1 answer
  • Micro sleep is when you ____.
    11·2 answers
  • A company is acquiring a smaller firm and is setting up a new IT system in order to consolidate the data and assets of the acqui
    11·1 answer
  • Write an algorithm to create a customer’s bill for a company. The company sells only five different products. TV, VCR, Remote Co
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!