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
kolezko [41]
3 years ago
8

Validating the results of a program is important to a. correct runtime errors b. make sure the program solves the original probl

em c. create a model of the program d. correct syntax error
Computers and Technology
1 answer:
elena-s [515]3 years ago
4 0

Answer:

b. make sure the program solves the original problem

Explanation:

This is important so as to avoid logical errors. Logical errors unlike compiler or run time errors will not stop your code from compilling and executing but after your program compiles and runs, but does the wrong thing by given you unexpected results

This is the reason why validation of results after your code is completed is important in this way you are sure the program solves the original problem.

You might be interested in
CHALLENGE 7.1.1: Initialize a list. ACTIVITY Initialize the list short.names with strings 'Gus', Bob, and 'Ann'. Sample output f
vlabodo [156]

Answer:

short_names = ["Gus", "Bob", "Ann"]

print(short_names[0])

print(short_names[1])

print(short_names[2])

Explanation:

There are some typos in your code. In addition to the missing part of the code, I corrected the typos.

First of all, initialize the list called short_names. The list starts with "[" and ends with "]". Between those, there are must be the names (Since each name is a string, they must be written between "" and there must be a semicolon between each name)

Then, you can print each name by writing the name of the list and the index of the names between brackets (Index implies the position of the element and it starts with 0)

3 0
3 years ago
g Write a program to sort an array of 100,000 random elements using quicksort as follows: Sort the arrays using pivot as the mid
shtirl [24]

Answer:

header.h->function bodies and header files.

#include<iostream>

#include<cstdlib>

#include<ctime>

using namespace std;

/* Partitioning the array on the basis of piv value. */

int Partition(int a[], int bot, int top,string opt)

{

int piv, ind=bot, i, swp;

/*Finding the piv value according to string opt*/

if(opt=="Type1 sort" || opt=="Type3 sort")

{

piv=(top+bot)/2;

}

else if(opt=="Type2 sort" || opt=="Type4 sort")

{

piv=(top+bot)/2;

if((a[top]>=a[piv] && a[top]<=a[bot]) || (a[top]>=a[bot] && a[top]<=a[piv]))

piv=top;

else if((a[bot]>=a[piv] && a[bot]<=a[top]) || (a[bot]>=a[top] && a[bot]<=a[piv]))

piv=bot;

}

swp=a[piv];

a[piv]=a[top];

a[top]=swp;

piv=top;

/*Getting ind of the piv.*/

for(i=bot; i < top; i++)

{

if(a[i] < a[piv])

{

swp=a[i];

a[i]=a[ind];

a[ind]=swp;

ind++;

}

}

swp=a[piv];

a[piv]=a[ind];

a[ind]=swp;

return ind;

}

void QuickSort(int a[], int bot, int top, string opt)

{

int pindex;

if((opt=="Type3 sort" || opt=="Type4 sort") && top-bot<19)

{

/*then insertion sort*/

int swp,ind;

for(int i=bot+1;i<=top;i++){

swp=a[i];

ind=i;

for(int j=i-1;j>=bot;j--){

if(swp<a[j]){

a[j+1]=a[j];

ind=j;

}

else

break;

}

a[ind]=swp;

}

}

else if(bot < top)

{

/* Partitioning the array*/

pindex =Partition(a, bot, top,opt);

/* Recursively implementing QuickSort.*/

QuickSort(a, bot, pindex-1,opt);

QuickSort(a, pindex+1, top,opt);

}

return ;

}

main.cpp->main driver file

#include "header.h"

int main()

{

int n=100000, i;

/*creating randomized array of 100000 numbers between 0 and 100001*/

int arr[n];

int b[n];

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

arr[i]=(rand() % 100000) + 1;

clock_t t1,t2;

t1=clock();

QuickSort(arr, 0, n-1,"Type1 sort");

t2=clock();

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

arr[i]=b[i];

cout<<"Quick sort time, with pivot middle element:"<<(t2 - t1)*1000/ ( CLOCKS_PER_SEC );

cout<<"\n";

t1=clock();

QuickSort(arr, 0, n-1,"Type2 sort");

t2=clock();

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

arr[i]=b[i];

cout<<"Quick sort time, with pivot median element:"<<(t2 - t1)*1000/ ( CLOCKS_PER_SEC );

cout<<"\n";

t1=clock();

QuickSort(arr, 0, n-1,"Type3 sort");

t2=clock();

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

arr[i]=b[i];

cout<<"Quick sort time and insertion sort time, with pivot middle element:"<<(t2 - t1)*1000/ ( CLOCKS_PER_SEC );

cout<<"\n";

t1=clock();

QuickSort(arr, 0, n-1,"Type4 sort");

t2=clock();

cout<<"Quick sort time and insertion sort time, with pivot median element:"<<(t2 - t1)*1000/ ( CLOCKS_PER_SEC );

return 0;

}

Explanation:

Change the value of n in the main file for different array size. Output is in the same format as mentioned, time is shown in milliseconds.

7 0
3 years ago
The ? contains software routines that developers use to create a consistent computer environment
Luba_88 [7]

The toolbox contains software routines that developers use to create a consistent computer environment.

3 0
3 years ago
Read 2 more answers
Which website is important for hacking
Yuliya22 [10]

Answer:

Here's a few

Explanation:

  • SQL Injection attacks. SQL Injection attack is the most common website hacking technique. ...
  • Cross Site Scripting (XSS) ...
  • Denial of Service (DoS/DDoS) ...
  • Cross-site request forgery (CSRF or XSRF) ...
  • DNS Spoofing (DNS cache poisoning) ...
  • Social engineering techniques.

Glad I could help!!

6 0
3 years ago
The difference between the centerline of a vehicle and the line perpendicular to the rear wheels is called what?
snow_lady [41]
The thrust angle is an imaginary line drawn perpendicular to the rear axle's centerline. It compares the direction that the rear axle is aimed with the centerline of the vehicle. It also confirms if the rear axle is parallel to its front axle and that the wheelbase on both sides of the vehicle is the same.
7 0
3 years ago
Other questions:
  • Tommy has hired a marketing company to create a billboard advertisement
    11·2 answers
  • According to Holpp and Kelly's approaches to developing vision, the benchmarking approach is more internally focused, whereas th
    6·1 answer
  • __________ was awarded the Nobel Prize in physics forhis work on the photoelectric effect.
    13·1 answer
  • Recursion is a natural use for a _____ (stack or queue)
    13·1 answer
  • Define a function that takes two arguments: a string called strText and a number called intNumber. This function will use a repe
    12·2 answers
  • A(n) ____ instruction might look like a meaningless string of 0s and 1s, but it actually represents specific operations and stor
    9·1 answer
  • I need to know thr full number of pie
    8·1 answer
  • 1. A bank customer invested $24 in a bank with 5 percent simple interest per year, write a program the construct a table showing
    11·1 answer
  • What is professional education? <br><br><br><br><br>Please help me to do this.​
    7·2 answers
  • What can I do If my Texas Instrument TI-84 calculator is not giving accurate answers?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!