Podcast
Questions and Answers
What does a pointer point to when it is incremented?
What does a pointer point to when it is incremented?
- An element of a different type
- The next element of its type (correct)
- The previous element of its type
- A random memory location
How is pointer arithmetic generally defined?
How is pointer arithmetic generally defined?
- Relative to the pointer's address
- Relative to the total memory size
- Relative to the number of elements
- Relative to the base type of the pointer (correct)
In the given program, what does 'p = &ob;' achieve?
In the given program, what does 'p = &ob;' achieve?
- Assigns the address of pointer 'p' to object 'ob'
- Assigns the address of object 'ob' to pointer 'p' (correct)
- Dereferences pointer 'p' to get the value of object 'ob'
- Assigns the value of object 'ob' to pointer 'p'
What is the purpose of using '->' in the statement 'cout << p->get_i();'?
What is the purpose of using '->' in the statement 'cout << p->get_i();'?
What does the statement 'cl ob = {1, 2, 3}' achieve?
What does the statement 'cl ob = {1, 2, 3}' achieve?
What is the correct way to access a member of a class when given a pointer to an object?
What is the correct way to access a member of a class when given a pointer to an object?
What character is used to initialize each object in an array when a class defines a parameterized constructor?
What character is used to initialize each object in an array when a class defines a parameterized constructor?
In C++, how are arrays of objects declared and used?
In C++, how are arrays of objects declared and used?
If an object's constructor requires multiple arguments, what form of initialization list should be used for arrays of objects?
If an object's constructor requires multiple arguments, what form of initialization list should be used for arrays of objects?
What does the following code snippet illustrate: cl(int j) { i=j; }
?
What does the following code snippet illustrate: cl(int j) { i=j; }
?
What does the using namespace std;
statement in C++ indicate?
What does the using namespace std;
statement in C++ indicate?