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
What is sum after the following loop terminates? int sum = 0; int item = 0; do { item ; sum = item; if (sum &gt; 4) break; } whi
irinina [24]
Int sum = 0;
int item = 0;
do
{
    item;
    sum = item;
    if (sum > 4)
        break;
} while (item < 5);


You will generate a compile error, as having (item;) as a statement on its own is invalid.
8 0
3 years ago
Read 2 more answers
What will be the biased exponent of 1,100.1? <br> A:130<br> B:127<br> C:-127<br> D:2^3
telo118 [61]
D. 2^3 is correct

hope this helps

7 0
3 years ago
Read 2 more answers
Write a method swaparrayends() that swaps the first and last elements of its array parameter. ex: sortarray = {10, 20, 30, 40} b
Alexus [3.1K]
In the C programming language, you can't determine the array size from the parameter, so you have to pass it in as an extra parameter. The solution could be:

#include <stdio.h>

void swaparrayends(int arr[], int nrElements)
{
int temp = arr[0];
arr[0] = arr[nrElements - 1];
arr[nrElements - 1] = temp;
}


void main()
{
int i;
int myArray[] = { 1,2,3,4,5 };
int nrElements = sizeof(myArray) / sizeof(myArray[0]);
swaparrayends(myArray, nrElements);

for (i = 0; i < nrElements; i++)
{
printf("%d ", myArray[i]);
}

getchar();
}

In higher languages like C# it becomes much simpler:

        static void Main(string[] args)
        {
            int[] myArray = {1, 2, 3, 4, 5};
            swaparrayends(myArray);
            foreach (var el in myArray)
            {
                Console.Write(el + " ");
            }

            Console.ReadLine();
        }

        static void swaparrayends(int[] arr)
        {
            int temp = arr[0];
            arr[0] = arr.Last();
            arr[arr.Length - 1] = temp;
        }

3 0
3 years ago
When would a one way flag variable be used
Tamiku [17]
A one-way flag<span> can also be </span>used<span>, for example, to watch errors occuring in input data so that the program </span>could<span> ask the inputs again. A </span>variable<span> is a temporary if its value is always needed only for a very short period.</span>
7 0
3 years ago
How might your use of computers and knowledge of technology systems affect your personal and professional success?
Xelga [282]
Amost all professions include theuse of computers. Knowing a lot about them and the way they work could help you use them when needed in a work environment. It would also make an employer more likely to hire you.
6 0
3 years ago
Read 2 more answers
Other questions:
  • _____ creates a border or space that separates information.
    14·1 answer
  • We have three containers whose sizes are 10 pints, 7 pints, and 4 pints, respectively. The 7-pint and 4-pint containers start ou
    14·2 answers
  • You are the head of the corporate security department, and the Microsoft teamhas asked you for some assistance in setting the pa
    11·1 answer
  • What is a computer and what is the work of it​
    5·2 answers
  • For each obstacle, select the best solution. failing to find other members for a club: failing a class: failing to get the credi
    9·2 answers
  • Write a calculate_sq_inches_of_good_pizza function that accepts the diameter of a pizza and returns the area of the pizza minus
    7·1 answer
  • A host is on the 192.168.146.0 network that has a subnet mask of 255.255.255.0. The binary value of the host portion is 11010101
    8·1 answer
  • outline 4 IDE features that makes software development much faster and more convenient than other alternatives.​
    9·1 answer
  • A network technician attempts to ping www.example.net from a customer computer, but the ping fails. access to mapped network dri
    5·1 answer
  • What will be displayed after this code segment is run?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!