Final Quiz Ii Oopc
Final Quiz Ii Oopc
Name
Roll No
Course Title OBJECT ORIENTED PROGRAMMING CONCEPTS
Course Code ITDC0201
Maximum Marks 5
Obtained Marks
6. Which type of pointer does not point to any memory location until assigned a value?
a) Void pointer b) Null pointer
c) Dangling pointer d) None of the above
8. What does the expression p - q yield if p and q are both pointers to elements of the same array?
a) The memory difference in bytes
b) The number of elements between p and q
c) A syntax error
d) The product of p and q
9. If char *p; and p holds the address 0x1000, what will p + 2 point to?
a) Address 0x1000 b) Address 0x1002
c) Address 0x1004 d) Address 0x1008
11. Given the following class, which line will call the destructor of the object obj?
class Test {
public:
~Test() { /* Destructor code */ }
};
void function() {
Test obj;
} // Line A
12. If a class Demo has a user-defined parameterized constructor, which statement below is true about
creating an object with Demo d;?
a) This will create an object using the "do-nothing" constructor.
b) This will result in a compilation error if no default constructor is defined.
c) The parameterized constructor will be called with default arguments.
d) The object will be created without calling any constructor.
13. If a class contains only a parameterized constructor and no default constructor, what will happen
when you attempt to create an object without passing any arguments?
a) The compiler will generate a "do-nothing" constructor automatically.
b) A compile-time error will occur.
c) The parameterized constructor will be called with default arguments.
d) The object will be created, but member variables will remain uninitialized.
16. Which of the following statements is true for a copy constructor in C++?
a) It can only be called explicitly by the user.
b) It is invoked when an object is assigned to another existing object.
c) It is automatically called when an object is initialized with another object.
d) It cannot be defined by the user.
True or False:
Note: Write “True” or “False”, Short form T or F is not allowed.
17. A non-member function cannot be used to overload binary operators.
18. Void pointer can be typecast to any other pointer type.
19. Dereferencing a null pointer causes undefined behavior.
20. The address of operator & can be overloaded.