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
Reptile [31]
3 years ago
14

You have just starting working at Quantum Company. As a new programmer, you have been asked to review and correct various pseudo

code. The following pseudocode checks if an item number is valid: start Declarations num sub = 0 num SIZE = 5 num VALID_ITEM [5] = 27,53,84,89,95 string foundIt = "N" input item while sub < SIZE if item = VALID_ITEM[sub] then foundIt = "Y" endif sub = sub +1 endwhile if foundIt = "Y" then output "Valid item number" else output "Invalid item number" endif stop Which while loop makes this more efficient?
Computers and Technology
1 answer:
Alecsey [184]3 years ago
8 0

Answer:

The correct answer to the following question:

while sub < SIZE AND foundIt = "N"

Explanation:

Firstly, we start the pseudocode after that set the variable sub to 0 and size to 1 of num type and also set a num type array VALID_ITEM[5] and its elements are 27,53,84,89,95.

Than set string type variable foundIt to "N", then we set a while loop and correct its condition is "< SIZE AND foundIt = "N" ".

Than starts if condition which is "item = VALID_ITEM[sub]", if the condition is true than foundIt = "Y", after that endif.

Than increment the variable sub, after that endwhile, after this, we start if condition which is "foundIt = "Y" " if the condition is true then output "Valid item number" or else "Invalid item number", and then we endif and after all stop the pseudocode.

You might be interested in
You are implementing a RAID storage system and have found a system with eight 100 GB drives. How much storage space will you hav
asambeis [7]

Answer:

The space available will vary between 800 GB (100%) and 400 GB (50%) of the total disks, depending on the RAID level.

The OS will handle the RAID as a single disk.

Explanation:

Each RAID level implements parity and redundancy in a different way, so the amount of disks used for this extra information will reduce the space available for actual storage.

Usual RAID levels are:

<u>RAID 0:</u> does not implement any redundancy or parity, so you will have available 100% of the total storage: 8 x 100 GB = 800 GB

<u>RAID 1:</u> Duplicates all the information in one disk to a second disk. Space is reduced in half: 400 GB

<u>RAID 5:</u> Uses the equivalent of 1 disk of parity data distributed evenly on each disk, meaning the space available is \frac{n-1}{n} of the total disks: \frac{7}{8} of 800 GB = 700 GB

Writting and reading the information on a RAID storage is handled by a raid controller, either implemented in hardware or software. The OS will "see" a single disk and will read or write information as usual.

4 0
3 years ago
How can a user begin to work with a new sheet in excel?
Hitman42 [59]
I hope I'm answering this correctly I'm not too smart about it so I hope that sounds right if you arewanting to start with a new sheet in excel do one of the following click the new sheet button on the screen. now if you want to insert a new worksheet in front of its system worksheet and then click Home>insert> insert sheet. also Excel gives you three worksheets in a workbook, you can add much more worksheets and of course other types of sheets examples are micro sheet or dialog sheet. then you can rename them or delete them. so you can give any work sheet any name you want. sheets are displayed by default but if you don't see them click options>adcanced> display for options for the worksheet> show sheet tabs.
3 0
3 years ago
g Write a program that prompts the user for an integer n between 1 and 100. If the number is outside the range, it prints an err
grin007 [14]

Answer:

The cpp program is given below.

#include<iostream>

#include<iomanip>

using namespace std;

int main() {

   

   // variables declared

   int n;

   int sum=0;

   float avg;

   

   do

   {

       // user input taken for number    

       cout<< "Enter a number between 1 and 100 (inclusive): ";

       cin>>n;

       

       if(n<1 || n>100)

           cout<<" Number is out of range. Enter valid number."<<endl;

       

   }while(n<1 || n>100);

   

   cout<<" "<<endl;

   

   // printing even numbers between num and 50  

   for(int num=1; num<=n; num++)

   {

       sum = sum + num;

   }

   

   avg = sum/n;

   

   // displaying sum and average

   cout<<"Sum of numbers between 1 and "<<n<<" is "<<sum<<endl;

   cout<<"Average of numbers between 1 and "<<n<<" is ";

   printf("%.2f", avg);

   

       return 0;

}

OUTPUT

Enter a number between 1 and 100 (inclusive): 123

Number is out of range. Enter valid number.

Enter a number between 1 and 100 (inclusive): 56

 

Sum of numbers between 1 and 56 is 1596

Average of numbers between 1 and 56 is 28.00

Explanation:

The program is explained below.

1. Two integer variables are declared to hold the number, n, and to hold the sum of numbers from 1 to n, sum. The variable sum is initialized to 0.

2. One float variable, avg, is declared to hold average of numbers from 1 to n.

3. User input is taken for n inside do-while loop. The loop executes till user enters value between 1 and 100. Otherwise, error message is printed.

4. The for loop executes over variable num, which runs from 1 to user-entered value of n.

5. Inside for loop, all the values of num are added to sum.

sum = sum + num;

6. Outside for loop, average is computed and stored in avg.

avg = sum/n;

7. The average is printed with two numbers after decimal using the following code.

printf("%.2f", avg);

8. The program ends with return statement.

9. All the code is written inside main() and no classes are involved.

3 0
3 years ago
Two independent customers are scheduled to arrive in the afternoon. Their arrival times are uniformly distributed between 2 pm a
seraphim [82]

Answer:

1/3

Explanation:

T₁ , T₂ , be the arrival times of two customers.

See expected time for the earliest and latest below.

The formulas used will guide you.

4 0
3 years ago
What would be the result after the following code is executed? final int SIZE = 25; int[] array1 = new int[SIZE]; // Code that w
Maurinko [17]

Answer:

The "Value" variable contains the lowest value of array1 list.

Explanation:

  • When the user passes the value on the array, then the above code is used to find the minimum value from the list of value which is passed by the user.
  • The above array has the 25 sizes, so it will take only 25 value from the user, Then the loop will assume the first value as the minimum value and assign that value on the variable "value".
  • Then all the other elements accessed by the for loop and compare with the value of Value variable if the array value is minimum, then that value is assigned on the variable value.
  • Hence the minimum value of the list will be assigned on the variable value.
8 0
3 years ago
Other questions:
  • Write a program that takes a date as input and outputs the date's season. The input is a string to represent the month and an in
    13·2 answers
  • Why it’s important to keep the standard internet protocol TCP/IP?
    11·1 answer
  • When you align or size a group of selected controls, the changes are made relative to the
    14·1 answer
  • 2. What is a cap? (0.5 points)
    9·1 answer
  • What does social protocol means in network?
    9·1 answer
  • In the writing and language test of the SAT, questions ask students to do which of the following? A. Write an essay B. Define a
    14·2 answers
  • What are the pros and cons of using ICT
    5·1 answer
  • Cloud computing is an old phenomenon in computing infrastructure dating back to the early days of the Internet that involves mov
    10·1 answer
  • Explain the bad effect and good effect of mobile phone and internet.<br>​
    15·2 answers
  • Why is the yellow light blinking on the front of my computer
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!