Question

Question 116 pts (TCO 2) What is the output of the following code?                         void func(int...

Question 116 pts

(TCO 2) What is the output of the following code?
                        void func(int x)
                        {
                                    x = x * 2;
                        }
int main( )
{
        int x = 10;
        func(x);
        cout << x << endl;
}

20
30
10
5

Question 126 pts

(TCO 2) A derived class is typically an example of _____.

a “has a” relationship
an “is a” relationship
a “uses a” relationship
an “is used” relationship

Question 136 pts

(TCO 2) Given the following class definition and lines of code, Line 1 in main is a call to what?
class Distance
{
private:
    int feet;
    double inches;
public:
    Distance( );
    Distance(int initFt, double initIn);
    void setFeet(int feetIn);
    void setInches(double inchesIn);
    int getFeet() const;
    double getInches( ) const;
};
int main( )
{
Distance d1;              //Line 1
const int MAX = 100;      //Line 2
Distance list[MAX];       //Line 3
Distance d2(1, 2.3);      //Line 4
Distance * pDist;         //Line 5
d1.feet = 5;              //Line 6
// etc. – assume the remaining code is correct
}

The 0-argument Distance constructor
The 2-argument, int, double, Distance constructor
The 2-argument, double, int, Distance constructor
The 1-argument, int, Distance constructor

Question 146 pts

(TCO 2) How many parameters are required to overload the pre-increment operator for a class as a member function?

None
1
2
No limit

Question 156 pts

(TCO 2) When organizing a program into three files (main, class implementation, and class header), which is not a .cpp file?

main
none are .cpp
class header
class implementation

Question 166 pts

(TCO 2) Composition is typically an example of _____.

a “has a” relationship
an “is a” relationship
a “uses a” relationship
an “is used” relationship

Question 176 pts

(TCO 2) Given a class called Employee and the following definitions and statements, which of the statements below correctly calls the function passing in the address of the data array?
void myFunction (Employee * eptr);
Employee emp;

myFunction(emp);
myFunction(&emp);
myFunction(*emp);
myFunction(**emp);

Question 186 pts

(TCO 2) Given the definition of some class called Employee, which of the following correctly dynamically allocates an array of 20 Employee objects?

Employee * myData = new Employee[20];
Employee myData[20] = new Employee[20];
Employee = myData[20];
Employee array = new Employee[20];

Question 196 pts

(TCO 2) Given the following definitions and statements, which of the statements below correctly calls the function passing in the address of the data array?
void myFunction (double * dptr);;
double data [10];

myFunction(data);
myFunction(&data);
myFunction(*data);
myFunction(data[0]);

Question 206 pts

(TCO 2) Which of the following provides the basic attributes and behaviors of a Java window (a title bar at the top of the window and buttons to minimize, maximize, and close the window)?

JLabel
JFrame
JSwing
JWindowsControl
0 0
Add a comment Improve this question Transcribed image text
Answer #1
11) 10
12) an “is a” relationship
13) The 0-argument Distance constructor
14) None(0)
15) class header
16) a “has a” relationship
17) myFunction(&emp);
18) Employee * myData = new Employee[20];
19) myFunction(data);
20) JFrame
Add a comment
Know the answer?
Add Answer to:
Question 116 pts (TCO 2) What is the output of the following code?                         void func(int...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • 1. Given this snippet of codes, what is the expected output? void func(int *x, int y)...

    1. Given this snippet of codes, what is the expected output? void func(int *x, int y) {     *x = *x + y;     y = 2; } void main() {     int x = 10, y = 10;     func(&x, y);     printf("x: %d, y: %d", x, y); } x= ? y=? 2. Given this snippet of codes, what is the expected output? void func(int *x, int y) {     *x = *x + y;     x = 10;...

  • 1. (TCO 1) What is the output of the following C++ code? int list[5] = {0,...

    1. (TCO 1) What is the output of the following C++ code? int list[5] = {0, 5, 10, 15, 20}; int j; for (j = 0; j < 5; j++)      cout << list[j]; (Points : 4)         0 1 2 3 4         0 5 10 15         0 5 10 15 20         5 10 15 20 Question 2.2. (TCO 1) What is stored in alpha after the following code executes? int alpha[5] = {0}; int j; for (j = 0; j...

  • Consider the following program: # include <iostream> using namesapce std; void Func(int a, int bl double...

    Consider the following program: # include <iostream> using namesapce std; void Func(int a, int bl double number-25.0: int main) f int x-18, y-20; cout<c"Before: x- kex<" and y-eyecendl; Fundxy 1// end of main void Funcfint a, int b) int sum a+b; a-200; b-300; numberanumber+1.0 Which of the statements below are correct? (Select only the correct answers. There may be more than one) D A The statement double number-25.0; declares a global variable number B. The variables x and y are...

  • Question 1 2 pts The preprocessor executes after the compiler. False True Question 2 2 pts...

    Question 1 2 pts The preprocessor executes after the compiler. False True Question 2 2 pts What code is human-readable and follows the standards of a programming language? Secret code Source code Key code None of these Machine code Question 3 2 pts What is the symbol that marks the beginning of a one line comment? Question 1 2 pts The preprocessor executes after the compiler. True False Question 5 2 pts A statement that may be used to stop...

  • void insertion_sort(int array[], int length, int & count_comp, int & count_move); void merge_sort(int array[], int length, int & count_comp, int & count_move); void heap_sort(int array...

    void insertion_sort(int array[], int length, int & count_comp, int & count_move); void merge_sort(int array[], int length, int & count_comp, int & count_move); void heap_sort(int array[], int length, int & count_comp, int & count_move); void quick_sort_sort(int array[], int length, int & count_comp, int & count_move); // YOUR // Implementation // should // go // here // or be put in separated .cpp files typedef void (*sort_algo_type)(int array[], int length, int& count_comp, int & count_move); void run_sort_algo(int array[], int length, sort_algo_type sorting,...

  • Q1. Write a recursive function in C++ void printNumberedChars(string str, int i=0) { ... } which...

    Q1. Write a recursive function in C++ void printNumberedChars(string str, int i=0) { ... } which prints each character of the given string str on a new line, with each line numbered 1, 2, 3, …. For example calling the function with printNumberedChars("hello"); should output the following: 1. h 2. e 3. l 4. l 5. o Q2. Write a recursive function in C++ int sumArray(const int* arr, unsigned int size) { ... } which takes an array of integers,...

  • 1.   What will be the value of x after the following code is executed? int x...

    1.   What will be the value of x after the following code is executed? int x = 10, y = 20; while (y < 100) { x += y; } A.   90 B.   110 C.   210 D.   This is an infinite loop 2.   If a superclass has constructor(s): A.   then its subclass must initialize the superclass fields (attributes). B.   then its subclass must call one of the constructors that the superclass does have. C.   then its subclass does not inherit...

  • C++ Consider the definition of the following class: (1,2,3, 5,7 clasa productTyp publie productType O productType(int....

    C++ Consider the definition of the following class: (1,2,3, 5,7 clasa productTyp publie productType O productType(int. double, double) productType (atring, int, double, double)s //tine6 productType (atring. atring.atring //Line1 /Line 2 /Line 3 //Line /Line s int, double, double) //Line 7 void set (atring, atring, string. int void print) const double, double) i //Line //tine 9 void setQuantitiesInstock (int x) void updateQuantitiesinstock (int x) int getQuantitiesInstock) const //Line 10 //Line 11 //Line 12 void #etPrice (double x); double getPrice) consti //Line...

  • I need a c++ code please. 32. Program. Write a program that creates an integer constant...

    I need a c++ code please. 32. Program. Write a program that creates an integer constant called SIZE and initialize to the size of the array you will be creating. Use this constant throughout your functions you will implement for the next parts and your main program. Also, in your main program create an integer array called numbers and initialize it with the following values (Please see demo program below): 68, 100, 43, 58, 76, 72, 46, 55, 92, 94,...

  • what is the output for the following code? explain the steps. /*#include <iostream> using namespace std;...

    what is the output for the following code? explain the steps. /*#include <iostream> using namespace std; int f(int &i) { i = 10; return(5 * i); } int main() { int n = 5; f(n); cout << n << "\n"; return 0; } #include <iostream> using namespace std; int sub1(int n) { n--; return n; } int main() { int m = 10; for(int j = 0; j < 10; j++) m -= sub1(j); cout << m << "\n"; return...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT