Question

1. In C++, programmers can use a class to create a large number of instance variables...

1.

In C++, programmers can use a class to create a large number of instance variables of the class's type.

Group of answer choices

True

False

2.

When a C++ programmer declares a function, they are required to state all of the following except

Group of answer choices

{}

The type of data, if any, returned by the function

The function name

The type of data, if any, sent to the function

3.

When a C++ programmer calls a function, she states all of the following except

Group of answer choices

{}

The actual run-time data values, if any, sent to the function

The function's name

The actual run-time data value, if any, returned to the function

4.

Supposed you want to write a function whose parameters are not modified by code executed in the function. That is, she wants the values from the calling's function to not be modified by the function being called. What kind of parameters should you use?

Group of answer choices

pass-by-value

pass-by-reference

pass-by-name parameters

array parameters

5.

Consider the following statements:

if ( i <= 5 ) {
        cout << "Hello ";
}
cout << "Goodbye";

based on the following variable declarations and initializations:

int i = 5;
int j = 2;
int k = 6;

When executed, the upper statements will print out:

Group of answer choices

Hello Goodbye

Hello

Goodbye

Nonthing will be printed

6.

Consider the following statements:

if ( i <= 5 ) {
    cout << "Hello ";
}
else {
    cout << "Goodbye";
}

based on the following variable declarations and initializations:

int i = 5;
int j = 2;
int k = 6;

When executed, the upper statements will print out:

Group of answer choices

Hello

Goodbye

Hello Goodbye

No answer text provided.

Homework Answers

Answer #1

Ans

1. False

No class doesn't have instance member of its type but it can have static member of its type

2.{}

function name, datatype of parameters and return type is required

But {} is used when defining a function

3.{}

on function call, function name, values pass to the function,

4. pass-by-value

pass by value doesn't modify actual parameters

pass by reference pass the address

pass by name pass function definition

array parameter passes by reference

5. Hello Goodbye

if condition gets true and it prints Hello

and then goodbye is printed

6. Hello

if condition gets true Hello is printed. Hence else block do not execute.

If any doubt ask in the comments.

Know the answer?
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
Similar Questions
1.An l-value is not required to be a location in memory. Group of answer choices True...
1.An l-value is not required to be a location in memory. Group of answer choices True False 2. An l-value cannot have a value assigned to it, whereas an r-value can. Group of answer choices True False 3. In C++, the body of a for loop may never run, even once. Group of answer choices True False 4. When a C++ programmer declares a function, they are required to state all of the following except Group of answer choices {}...
Data Structures using C++ Consider the definition the following function template: template <class Type> Type func(Type...
Data Structures using C++ Consider the definition the following function template: template <class Type> Type func(Type list[], int size) {        Type x = list[0];        Type y = list[size - 1];        for (int j = 1; j < size / 2; j++)        {               if (x < list[j])                      x = list[j];               if (y > list[size - 1 - j])                      y = list[size - 1 - j];        }        return x + y; }...
a. Define the class bankAccount to store a bank customer’s account number and balance. Suppose that...
a. Define the class bankAccount to store a bank customer’s account number and balance. Suppose that account number is of type int, and balance is of type double. Your class should, at least, provide the following operations: set the account number, retrieve the account number, retrieve the balance, deposit and withdraw money, and print account information. Add appropriate constructors. b. Every bank offers a checking account. Derive the class checkingAccount from the class bankAccount (designed in part (a)). This class...
QUESTION 1 What does the following code segment output? int red, blue; red = 7; blue...
QUESTION 1 What does the following code segment output? int red, blue; red = 7; blue = red + 2 * 5 red++; blue = blue + red; cout << blue; 4 points    QUESTION 2 Is the following statement true or false? The Boolean expression in the following if statement will be true for all values of x in the range from 10 to 20 (including the endpoints) and false for all other values: int x; if (x >=...
Write a 4-6 sentence summary explaining how you can use STL templates to create real world...
Write a 4-6 sentence summary explaining how you can use STL templates to create real world applications. In your summary, provide an example of a software project that you can create using STL templates and provide a brief explanation of the STL templates you will use to create this project. After that you will implement the software project you described . Your application must be a unique project and must incorporate the use of an STL container and/or iterator and...
Strings The example program below, with a few notes following, shows how strings work in C++....
Strings The example program below, with a few notes following, shows how strings work in C++. Example 1: #include <iostream> using namespace std; int main() { string s="eggplant"; string t="okra"; cout<<s[2]<<endl; cout<< s.length()<<endl; ​//prints 8 cout<<s.substr(1,4)<<endl; ​//prints ggpl...kind of like a slice, but the second num is the length of the piece cout<<s+t<<endl; //concatenates: prints eggplantokra cout<<s+"a"<<endl; cout<<s.append("a")<<endl; ​//prints eggplanta: see Note 1 below //cout<<s.append(t[1])<<endl; ​//an error; see Note 1 cout<<s.append(t.substr(1,1))<<endl; ​//prints eggplantak; see Note 1 cout<<s.find("gg")<<endl; if (s.find("gg")!=-1) cout<<"found...
Write the Game class, Java lanuage. A Game instance is described by three instance variables: gameName...
Write the Game class, Java lanuage. A Game instance is described by three instance variables: gameName (a String), numSold (an integer that represents the number of that type of game sold), and priceEach (a double that is the price of each of that type of Game). I only want three instance variables!! The class should have the following methods: A constructor that has two parameter – a String containing the name of the Game and a double containing its price....
Cpp Task: Create a class called Mixed. Objects of type Mixed will store and manage rational...
Cpp Task: Create a class called Mixed. Objects of type Mixed will store and manage rational numbers in a mixed number format (integer part and a fraction part). Details and Requirements Your class must allow for storage of rational numbers in a mixed number format. Remember that a mixed number consists of an integer part and a fraction part (like 3 1/2 – “three and one-half”). The Mixed class must allow for both positive and negative mixed number values. A...
In C++ Employee Class Write a class named Employee (see definition below), create an array of...
In C++ Employee Class Write a class named Employee (see definition below), create an array of Employee objects, and process the array using three functions. In main create an array of 100 Employee objects using the default constructor. The program will repeatedly execute four menu items selected by the user, in main: 1) in a function, store in the array of Employee objects the user-entered data shown below (but program to allow an unknown number of objects to be stored,...
Code Example 8-1 1. int count = 1; 2. int item_total = 0; 3. int item...
Code Example 8-1 1. int count = 1; 2. int item_total = 0; 3. int item = 0; 4. while (count < 4) { 5.      cout << "Enter item cost: "; 6.      cin >> item; 7.      item_total += item; 8.      ++count; 9. } 10. int average_cost = round(item_total / count); 11. cout << "Total cost: " << item_total << "\nAverage cost: " << average_cost; (Refer to Code Example 8-1.) If the user enters 5, 10, and 15 at the prompts, the output is: Total...