
OOP2023_P1_B11B12_March27
Authored by MR ARORA
Computers
University
Used 1+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
5 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
20 sec • 1 pt
Which of the following statements about the this pointer is false?
The this pointer is a keyword in C++ that refers to the object that is currently being operated on.
The this pointer can be used to access member variables and member functions of the current object.
The this pointer is not a constant pointer and can be reassigned to point to a different object.
The this pointer is automatically passed as a hidden argument to all non-static member functions.
2.
MULTIPLE CHOICE QUESTION
20 sec • 1 pt
Which of the following code snippets correctly uses new and delete to allocate and deallocate a dynamic array of pointers with a size of 5?
int *arr = new int[5];
delete[] arr;
int *arr = new int*[5];
delete[] arr;
int *arr = new int*[5];
delete[] *arr;
int *arr = new int[5]();
delete[] arr;
3.
MULTIPLE CHOICE QUESTION
20 sec • 1 pt
Predict the output of the given code.
1 and 3
Run time error
10 and 2
Compile time error
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Predict the output of the given code.
Default constructor called.
Parameterized constructor called with 42.
Destructor called.
Destructor called.
Default constructor called.
Parameterized constructor called with 42.
Destructor called.
Default constructor called.
Destructor called.
Default constructor called.
Destructor called.
Default constructor called.
Destructor called.
Parameterized constructor called with 42.
Destructor called.
5.
MULTIPLE CHOICE QUESTION
20 sec • 1 pt
Which of the following is true about friend functions in C++?
They can be called only from within the class
They cannot be overloaded
They can be defined in the class or outside the class
They can be inherited by derived classes
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?