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
In the simulation, player 2 will always play according to the same strategy. The number of coins player 2 spends is based on wha
baherus [9]

The simulation, player 2 will always play according to the same strategy.

Method getPlayer2Move below is completed by assigning the correct value to result to be returned.

Explanation:

  • You will write method getPlayer2Move, which returns the number of coins that player 2 will spend in a given round of the game. In the first round of the game, the parameter round has the value 1, in the second round of the game, it has the value 2, and so on.

#include <bits/stdc++.h>  

using namespace std;

bool getplayer2move(int x, int y, int n)  

{

   int dp[n + 1];  

   dp[0] = false;  

   dp[1] = true;  

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

       if (i - 1 >= 0 and !dp[i - 1])  

           dp[i] = true;  

       else if (i - x >= 0 and !dp[i - x])  

           dp[i] = true;  

       else if (i - y >= 0 and !dp[i - y])  

           dp[i] = true;  

       else

           dp[i] = false;  

   }  

   return dp[n];  

}  

int main()  

{  

   int x = 3, y = 4, n = 5;  

   if (findWinner(x, y, n))  

       cout << 'A';  

   else

       cout << 'B';  

   return 0;  

}

8 0
3 years ago
[20 pts] Write the function rectangle(perimeter, area), which takes two positive integers, perimeter and area. It returns an int
MrRissso [65]

Hi, you haven't provided the programing language in which you need the code, I'll explain how to do it using Python, and you can follow the same logic to make a program in the programing language that you need.

Answer:

import math

def rectangle(perimeter, area):

   l1_1 = (perimeter+math.sqrt((perimeter**2)-(16*area)))/4

   l1_2 = (perimeter-math.sqrt((perimeter**2)-(16*area)))/4

   l2_1 = area/l1_1

   l2_2 = area/l1_2

   print(l1_1,l2_1)

   print(l1_2,l2_2)

   if l1_1.is_integer() and l2_1.is_integer() and l1_1>0 and l2_1>0:

       return(int(max(l1_1,l2_1)))

   elif l1_2.is_integer() and l2_2.is_integer() and l1_2>0 and l2_2>0:

       return(int(max(l1_2,l2_2)))

   else:

       return(None)

Explanation:

  • We import math to make basic operations
  • We define the rectangle function that receives perimeter and area
  • We calculate one of the sides (l1_1) of the rectangle using the quadratic equation to solve 2h^2 - ph + 2a = 0
  • We calculate the second root of the quadratic equation for the same side (l1_2)
  • We calculate the second side of the rectangle using the first root on w = a/h
  • We calculate the second side of the rectangle using the second root on w= a/h
  • We verify that each component of the first result (l1_1, l2_1) is an integer (using the build-in method .is_integer) and greater than 0, if True we return the maximum value between them (using the max function) as w
  • If the first pair of sides evaluate to False we check the second root of the equation and if they meet the specification we return the max value
  • if all the if statements evaluate to false we return None to indicate that not positive or integer sides were found

7 0
2 years ago
When using a self-contained recovery device on a cfc, hcfc, or hfc system with an operating compressor, technicians must?
Neporo4naja [7]

When using a self-contained recovery device on a cfc, hcfc, or hfc system with an operating compressor. Technicians must recover 80% of the nameplate charge.

Compressor is a mechanical device used in many industries which has the function of increasing gas pressure by reducing its volume. The air compressor is a specific type of gas compressor.

Compressors can be characterized in a number of different ways, but are usually divided into types based on the functional method used to produce compressed air or gas. The following are common compressor types. Types covered include:

  • Pistons
  • Diaphragm
  • Helical Screw
  • Slide propeller
  • Scrolling
  • Rotary Lobe
  • Centrifugal
  • Axial

How to use an air compressor

  1. Position the Air Compressor
  2. Check the Oil Level
  3. Check the Drain Valve
  4. Set the PSI
  5. Prepare the Air Tank
  6. Connect the Air Hose
  7. Connect the Desired Tool
  8. Remove Excess Moisture

You can learn more about compressor here brainly.com/question/26581412

#SPJ4

7 0
1 year ago
Organizations should communicate with system users throughout the development of the security program, letting them know that ch
Fed [463]

Answer:

Yes it is true.The organization should indeed communicate with a system user throughout the development of a security program. A corporation needs a security policy that must be developed by management at all levels, including organization and employees at the operational level. For a corporate security plan, it is essential to reduce the resistance of the expected changes and define the objective.

Explanation:

Three objectives of the security plan in an organization are:

  • Identify the sensitive system and plan
  • Create and define the strategy and control of the system.
  • Develop and implement the training programs.

Security Information is one of the essential factors in the organization.For an organization, the information should be protected.

7 0
3 years ago
_____ is a group of Internet-based applications that build on the ideological and technological foundations of Web 2.0, and that
lutik1710 [3]

Answer: Social media

Explanation:

 Social media is defined as the group of the internet based various applications that basically build on the foundation of  technological and ideological of the web 2.0. It basically allow the exchange of the user content and creation.

It is the most flexible platform that enable the users with the huge experience. It is also known as free and open source platform. It basically contain the various content that are algorithm driven and machine learning.

 

3 0
3 years ago
Other questions:
  • True or False, PDF documents have many benefits, but their main disadvantage is that the formatting of their text and graphic el
    15·1 answer
  • An iPad Is An Example Of Which Type Of Computer?
    11·2 answers
  • What is the term for the typical layout of the keys on a keyboard?
    8·2 answers
  • In a @return tag statement the description:
    13·2 answers
  • It is a small hand tool used generally in decorative works such as making garnishes
    15·1 answer
  • A disk takes 1 ms per track seek time, and the head is currently on track 70. Assume it takes 5 ms to service a request once the
    10·1 answer
  • What is considered appropriate dress for men and women in the workplace? Select all that apply.
    6·2 answers
  • Taylor and Rory are hosting a party. They sent out invitations, and each one collected responses into dictionaries, with names o
    9·1 answer
  • Write a function named last_digit that returns the last digit of an integer. For example, last_digit(3572) should return 2. It s
    5·1 answer
  • Write the function evens which takes in a queue by reference and changes it to only contain the even elements. That is, if the q
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!