-
1.What will the following statement output?
cout << &num1;
A)None of these
B)the value stored in the variable named num1
C)the number 1
D)the memory address of the variable named num1
E)the string &num1
2. What will the following code output?
int number = 888;
int *var = &number;
cout << var << endl;
A)the address of number
B)an asterisk followed by 8888
C)8888
D)an asterisk followed by the address of number
3. Assuming ptr is a pointer variable, what...
-
C++ A reason for passing a pointer to a function is
Question 13 options:
a)
to avoid the overhead of copying large data structures.
b)
to allow the called function to modify a variable accessible to
the calling function.
c)
to allow easy access to data in the function that is being
called.
d)
A and B are both true.
-
Question 27
The following statement ________.
cin >> *num3;
stores the keyboard input in the variable
num3
stores the keyboard input into the pointer
num3
is illegal in C++
stores the keyboard input into the variable pointed to by
num3
None of these
Question 28
The following statement ________.
int *ptr = new int;
results in a compiler error
assigns an integer less than 32767 to the variable
ptr
assigns an address to the variable ptr
creates a new pointer...
-
C++
1. The copy constructor is used for one the following scenarios: I. Initialize one object from another of the same type. II. Copy an object to pass it as argument to a function. III. Copy an object to return it from a function. Read the following program and answer questions (20 points) #include <iostream> using namespace std; class Line public: int getLength( void); Line( int len // simple constructor Line( const Line &obj) 1/ copy constructor Line (); //...
-
TRUE/FALSE 1. If pl is an integer pointer variable, with the value of 1000, pl++ changes P1 to point to the memory location 1001. ANSWER: T 2. When you return a dynamic array to the freestore, you must include the number of elements in the array 3. You can assign an array to a pointer variable. 4. The size of dynamic arrays must be declared at compile time. 5. int *pl; declares a static variable. ANSWER: F ANSWER: F ANSWER:...
-
I need to get this two last parts of my project done by tonight.
If you see something wrong with the current code feel free to fix
it. Thank you!
Project 3 Description
In this project, use project 1 and 2 as a starting point and
complete the following tasks.
Create a C++ project for a daycare. In this project, create a
class called child which is defined as follows:
private members:
string First name
string Last name
integer Child...
-
c++ question
1. C++ string Class
What does the output look like after executing the following
statements?
std::string numstr = "12";
numstr += "3";
std::cout << numstr << '\n';
A. None of these.
B. The snippet has syntax errors.
C. 15
D.123
//
2. Let S be a class that allows integers to be stored in its
objects like an array. For example, if obj is an object of S, one
can write statements like
obj[0] = 100;
or
int...
-
Question 11 pts
Fill in the blank. Two functions are defined main.c and
MyAge.c
// FILE main.c
main ( )
{
_______ int age ;
printf ( " the value of age is %d \n", age ) ;
}
// FILE MyAge.c
int age = 10;
int MyAge ( )
{
}
Group of answer choices
static
external
internal
extern
Flag this Question
Question 21 pts
Fill in the blank. Two functions are defined main.c and
MyAge.c
The below program...
-
Help fast
:Assume a variable called orange exists of type Fruit pointer. The Fruit structure is defined below. For the variable orange, write a statement that assigns a member variable named hasSeeds to 1 typedef struct Fruit struct f a. &(orange.hasSeeds) 1; b. orange.("hasSeeds) 1 c. orange->hasSeeds 1; d. orange.hasSeeds 1; // menber variables Fruit; Q8: When the malloc function is called, the malloc function returns a(n) a. address on the heap b. address on the stack c. address on...
-
The code should be written in C++.
I included the Class used for this function. Also, please fix the
main function if necessary.
Description: This function de-allocates all memory
allocated to INV. This will be the last function to be called
(automatically by the compiler)
//before the program is exited.
This function also erased all data in the data file.
There are other functions that add, process and alter the file; the
file printed after those functions will have new...