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
anygoal [31]
3 years ago
6

Consider the partially-filled array named a. What does the following loop do? (cin is a Scanner object)int[] a = {1, 3, 7, 0, 0,

0};int size = 3, capacity = 6;int value = cin.nextInt();while (size < capacity && value > 0){a[size] = value;}
1. Reads up to 3 values and places them in the array in the unused space.
2. Reads one value and places it in the remaining first unused space endlessly.
3. Reads up to 3 values and inserts them in the array in the correct position.
4. Crashes at runtime because it tries to write beyond the array.
Computers and Technology
1 answer:
lozanna [386]3 years ago
4 0

Answer:

Option 2: Reads one value and places it in the remaining first unused space endlessly.

Explanation:

Given the code as follows:

  1. int[] a = {1, 3, 7, 0, 0, 0};
  2. int size = 3, capacity = 6;
  3. int value = cin.nextInt();
  4. while (size < capacity && value > 0)
  5. {
  6.              a[size] = value;  
  7. }

The a is an array with 6 elements (Line 1). The program will prompt the user for an integer and assign it to variable <em>value </em>(Line 3).

The while loop have been defined with two conditions, 1) <em>size < capacity </em>and <em> value > 0</em>. The first condition will always be true since the size and capacity are <em>constant</em> throughout the program flow and therefore<em> size</em> will always smaller than capacity.

Hence, if user input an integer larger than 0, the while loop will infinitely place the same input value to the remaining first unused space of the array, <em>a[3]</em>.

You might be interested in
Smart art is considered a​
mina [271]

Explanation:

visual representation of information and ideas, and a chart is a visual illustration of numeric values or data. Basically, SmartArt graphics are designed for text and charts are designed for numbers. Use the information below to decide when to use a SmartArt graphic and when to use a chart.

4 0
3 years ago
Sniffer turns the NIC of a system to the promiscuous mode so that it listens to all the data transmitted on its segment. It can
Mamont248 [21]

Answer:

The right answer will be "Sniffing through a hub".

Explanation:

  • Packet sniffer seems to be a device that listens for transmitted data on what seems like a channel. Sniffing enables the detection of data by individual people as it has been transferred throughout a cable.
  • Appropriate nodes are using this methodology to make a diagnosis of connection issues, or even just harmful programs to obtain confidential information, like authentication and encryption.
6 0
3 years ago
What is an example of using the Internet of Things (IoT) to deliver innovative Cloud based solutions to customers?
VladimirAG [237]

An example of using the Internet of Things (IoT) to deliver innovative Cloud-based solutions to customers is: A. wearable technology that provides customers with on-the-spot personalized experiences.

<h3>What is cloud computing?</h3>

Cloud computing can be defined as a Cloud-based solutions that typically requires the use of shared computing resources over the Internet, rather than using local servers, wired-connection and hard drives to provide various services to customers.

In Computer technology, a good example of an application of the Internet of Things (IoT) to deliver innovative Cloud-based solutions to end users is wearable technology that is designed and developed to provide users with on-the-spot personalized experiences.

Read more on cloud computing here: brainly.com/question/19057393

#SPJ1

<u>Complete Question:</u>

What is an example of using the Internet of Things (IoT) to deliver innovative Cloud-based solutions to customers?

A. wearable technology that provides customers with on-the-spot personalized experiences

B. scheduled conferences with brand ambassadors to pitch customers on new offers

C. customers using a PC connected to a local network to search for recommendations

D. online surveys that gather customer input to improve services in the future

E. I don't know this yet.

8 0
2 years ago
What is data called that is input into a cryptographic algorithm for the purpose of producing encrypted data?
labwork [276]
<span>A key is data called that is input into a cryptographic algorithm for the purpose of producing encrypted data. There are two types of cryptography, the public key and the private key. The public key uses public keys to encrypt data and private key uses private key to decrypt data. They are produced by a group of algorithms. </span>
8 0
4 years ago
Write a program that prints the day number of the year, given the date in the form month-day-year. For example, if the input is
vlabodo [156]

Answer:

C++:

C++ Code:

#include <iostream>

#include <string>

using namespace std;

struct date

{

  int d,m,y;

};

int isLeap(int y)

{

  if(y%100==0)

  {

      if(y%400==0)

      return 1;

      return 0;

  }

  if(y%4==0)

  return 1;

  return 0;

}

int day_no(date D)

{

  int m = D.m;

  int y = D.y;

  int d = D.d;

  int i;

  int mn[13] = {0,31,28,31,30,31,30,31,31,30,31,30,31};

  for(i=0;i<m;i++)

  {

      d += mn[i];

  }

  if(isLeap(y))

  {

      if(m>2)

      d++;

  }

  return d;

}

date get_info(string s)

{

  date D;

  int i,p1,p2,l = s.length();

  for(i=0;i<l;i++)

  {

      if(s[i] == '-')

      {

      p1 = i;

      break ;

      }

  }

  for(i=p1+1;i<l;i++)

  {

      if(s[i] == '-')

      {

      p2 = i;

      break ;

      }

  }

 

  D.m = 0;

  for(i=0;i<p1;i++)

  D.m = (D.m)*10 + (s[i]-'0');

 

  D.d = 0;

  for(i=p1+1;i<p2;i++)

  D.d = (D.d)*10 + (s[i]-'0');

 

  D.y = 0;

  for(i=p2+1;i<l;i++)

  D.y = (D.y)*10 + (s[i]-'0');

 

  return D;

 

}

int main()

{

  string s1 = "4-5-2008";

  string s2 = "12-30-1995";

  string s3 = "6-21-2000";

  string s4 = "1-31-1500";

  string s5 = "7-19-1983";

  string s6 = "2-29-1976";

 

  cout<<"Date\t\tDay no\n\n";

  cout<<s1<<"\t"<<day_no(get_info(s1))<<endl;

  cout<<s2<<"\t"<<day_no(get_info(s2))<<endl;

  cout<<s3<<"\t"<<day_no(get_info(s3))<<endl;

  cout<<s4<<"\t"<<day_no(get_info(s4))<<endl;

  cout<<s5<<"\t"<<day_no(get_info(s5))<<endl;

  cout<<s6<<"\t"<<day_no(get_info(s6))<<endl;

 

 

  return 0;

}

Explanation:

4 0
3 years ago
Other questions:
  • What is the meaning of "At work, I am quite reserved."?
    15·2 answers
  • What specific type of DNS query instructs a DNS server to process the query until the server replies with an address that satisf
    5·1 answer
  • Sandra wants to have her new technology up and running as soon as possible. She is looking for a tool that she can
    8·1 answer
  • Although the traditional model of software acquisition still accounts for more software acquisition, a new model, called _______
    7·1 answer
  • PLEASE HELP THIS IS MY LAST CHANCE TO PASS MY QUIZ
    13·2 answers
  • You have three users who travel to four branch offices often and need to log on to the RODCs at these offices. The branch office
    10·1 answer
  • Choose the correct term to complete the sentence.
    12·1 answer
  • 8. Given the array String[] words, which already contains 1 or more values, write a block of code which counts and returns the n
    7·1 answer
  • Assume that you have implemented a sequence class. Describe the mySequence object (i.e., items with the correct order and the po
    9·1 answer
  • Using robots to replace workers in factories is an example of which of the following forms of information processing systems? a.
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!