GradePack

    • Home
    • Blog
Skip to content
bg
bg
bg
bg

GradePack

The following program generates an error. Why? const int NUM…

The following program generates an error. Why? const int NUM_ELEMENTS = 5;int userVals[NUM_ELEMENTS];int i;userVals[0] = 1;userVals[1] = 7;userVals[2] = 4; for (i = 0; i

Read Details

What is the ending value of the element at index 0? int numb…

What is the ending value of the element at index 0? int numbers[10];numbers[0] = 35;numbers[1] = 37;numbers[1] = numbers[0] + 4;

Read Details

The numNegatives variable counts the number of negative valu…

The numNegatives variable counts the number of negative values in the array userVals. What should numNegatives be initialized to, to make sure it has the correct value after the for loop? int userVals[20];int i;int numNegatives = /* What should this be? */ ; for (i = 0; i < 20; ++i) { if (userValues[i] < 0) { numNegatives = numNegatives + 1; }}

Read Details

What is the output? int MyFct(int x) { int y; x = x * 2; y =…

What is the output? int MyFct(int x) { int y; x = x * 2; y = x + 1; return y;} int main() { int a; a = 5; cout

Read Details

What is the output? void IsEven(int num) { int even; if (num…

What is the output? void IsEven(int num) { int even; if (num % 2 == 0) { even = 1; } else { even = 0; }}int main() { IsEven(7); cout

Read Details

For the following function, which is a valid function call?…

For the following function, which is a valid function call? Assume maxValue is an integer. int Max(int x, int y) { if (x > y){ return x; } else { return y; }}

Read Details

What is output? double MyFct(double a, double b) { return (a…

What is output? double MyFct(double a, double b) { return (a + b) / 2.0;}int main() { double x = 3.0; double y = 5.0; double z = 8.0; double t; t = MyFct(x, y); t = MyFct(t, z); cout

Read Details

How many parameters does FahrenheitToCelsius have? double Fa…

How many parameters does FahrenheitToCelsius have? double FahrenheitToCelsius(double fahrenheit) { return (fahrenheit – 32.0) * 5.0 / 9.0;} int main() { double fahrenheit; cin >> fahrenheit; int c1; int c2; int c3; int c4; c1 = FahrenheitToCelsius(fahrenheit); c2 = FahrenheitToCelsius(32); c3 = FahrenheitToCelsius(78); c4 = FahrenheitToCelsius(100);}

Read Details

Given array scorePerQuiz has 10 elements. Which assigns 7th…

Given array scorePerQuiz has 10 elements. Which assigns 7th element in the array with the value 8?

Read Details

Given the following function. To change the function to retu…

Given the following function. To change the function to return the product instead of the sum, how many lines of code need to be changed? int Calculate(int a, int b) { return a + b;}int main() { cout

Read Details

Posts pagination

Newer posts 1 … 45,534 45,535 45,536 45,537 45,538 … 73,051 Older posts

GradePack

  • Privacy Policy
  • Terms of Service
Top