Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Which of the following options below is legal in C++? Group of answer choices int calc(int num1, int num2 = 10, int num3, int

1. Which of the following options below is legal in C++?

Group of answer choices

int calc(int num1, int num2 = 10, int num3, int num4 = 20);

int calc(int num1, int num2, int num3 = 10, int num4 = 20);

int calc(int num1 = 10, int num2, int num3 = 20, int num4);

int calc(int num1 = 10, int num2 = 20, int num3, int num4);

2) In physics, an object that is in motion is said to have kinetic energy. The following formula can be used to determine a moving objects kinetic energy:

image text in transcribed

The variables in the formula are as follows: KE is the kinetic energy, m is the objects mass in kilograms, and v is the objects velocity, in meters per second.

Which of the options below will correctly calculate and return the kinetic energy?

Group of answer choices

double KE(double m, double v)

{ return 0.5 * m * v * v; }

double KE(double m, double v)

{ return 0.5 * m * m * v * v; }

double KE(double m, double v)

{ return 0.5 * pow(m*v, 2); }

double KE(double m, double v)

{ return 0.5 * pow(pow(m, v), 2); }

3) In a menu-driven program, the get_menu_choice function has one sole purpose: to prompt the user for their menu choice, and send the users input back to main. In a menu-driven program where there are three menu choices, the prompt for the menu choice would look like this:

Enter your choice (1 3):

Which of the options below correctly represents the get_menu_choice function?

Group of answer choices

void get_menu_choice()

{

. (omitted)

}

int get_menu_choice() { . (omitted) }

void get_menu_choice(int menu_choice)

{

. (omitted)

}

int get_menu_choice(int menu_choice)

{

. (omitted)

}

4) int func(int, int);

int func(double, int, int=1);

double func(double, double, double=0.5);

double func(int, double);

int main()

{

cout

cout

}

int func(int num1, int num2)

{ return num1*num2; }

int func(double num1, int num2, int num3)

{ return num1+num2+num3; }

double func(double num1, double num2, double num3)

{ return num1-num2-num3; }

double func(int num1, double num2)

{ return num1um2; }

What is the output of this program?

Group of answer choices

8

3.0

8

2.0

10

2.0

10

3.0

5) int sum(int, int, int=0);

What is shown in the line of code above?

Group of answer choices

Default argument

Default reference

Default constant

Default parameter

6)

#include

using namespace std;

int number = 2;

void functionOne();

void functionTwo();

int main()

{

functionOne();

functionTwo();

functionOne();

functionTwo();

functionOne();

functionTwo();

system("PAUSE");

return 0;

}

void functionOne()

{

static int number = 0;

cout

number--;

}

void functionTwo()

{

cout

++number;

}

What is the output of this program?

Group of answer choices

0 0 0 0 0 0

0 2 -1 3 -2 4

0 2 0 3 0 4

0 0 -1 0 -2 0

7)

_ have the same name but different parameters

Group of answer choices

Static variables

Function prototypes

Overloaded functions

Default arguments

8)

int sum1(int, int);

int sum2(int, int, int);

What describes the two lines of code shown above?

Group of answer choices

Function prototypes

Function overloading

Function headers

Function calling

9)

Which of the options below will cause a compiler error in a C++ program?

Group of answer choices

int divide(double num1);

double divide(int num1);

double divide(int num1, int num2, int num3, int num4);

int divide();

int divide(int num1, int num2);

double divide(int num1, int num2, int num3);

int divide();

double divide();

int divide(int num1, int num2);

int divide(int num2, int num2, int num3);

double divide(double num1, double num2);

double divide(double num1, double num2, double num3);

double divide(int num1);

int divide(double num1);

int divide(double num1, int num2);

double divide(int num1, double num2);

10)

Which type of variable retains its value in-between function calls?

Group of answer choices

Parameter

Static

Reference

Global

KE = 1/2 mu

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Relational Database And Transact SQL

Authors: Lucy Scott

1st Edition

1974679985, 978-1974679980

More Books

Students also viewed these Databases questions

Question

Does a unilaterally mistaken party have any right to relief?

Answered: 1 week ago