Skip to content
VUBuddy

CS304 Quiz 2 Set 2

Object Oriented Programming PDF 846 KBUpdated 23 Oct 2026
Quiz CS304 Quiz 2 Set 2 PDF 846 KB
vubuddy.com
Type
Quiz
Course
CS304 Object Oriented Programming
Size
PDF 846 KB
Updated
23 Oct 2026
Free download 0 of 3 used today
Download free · 846 KB

You get 3 free files a day on the website. Add the Chrome extension for 30 a day.

Unlimited downloads in the Android app Get it free on Google Play

Preview text

Text from pages 1, 2 of 2. Download the file for all 2 pages.

Q1. Why should we write our own assignment operator when dynamic memory is involved?

  1. Compiler performs shallow copy
  2. Assignment operator is not generated by compiler automatically
  3. Overloading is mandatory
  4. Deep copy causes errors

Correct answer: Compiler performs shallow copy

Q2. Which of the following is the correct syntax of declaring static variable “count” of type int?

  1. int static count;
  2. int count static;
  3. static int count;
  4. static count int;

Correct answer: static int count;

Q3. Which of the following stores the address of a variable?

  1. Function
  2. Constructor
  3. Destructor
  4. Pointer

Correct answer: Pointer

Q4. What will be the value of variables a,b, and c after instantiating an object of the given class? class test { int a; int b; int c; public: test():b(5),c(a),a(b){ } };

  1. Junk value, 5, Junk value
  2. 5, Junk value, 5
  3. 5, 5, 5
  4. Junk value, 5, 5

Correct answer: Junk value, 5, Junk value

Q5. Why should the return type of the assignment operator be const?

  1. To increase memory usage
  2. To avoid assignment to subexpressions
  3. To increase speed
  4. To allow assignment chaining

Correct answer: To avoid assignment to subexpressions

Q6. Which of the following is an example of unary operator?

  1. Increment Operator ( ++ )
  2. Inequality Operator ( != )
  3. Division Operator ( / )
  4. Equality Operator ( = =)

Correct answer: Increment Operator ( ++ )

Q7. Which of the following best describes relationship between House and Address classes?

  1. Aggregation
  2. Composition
  3. Inheritance
  4. Association

Correct answer: Aggregation

Q8. In composition ____________ are called from composing objects to composed objects.

  1. Pointers
  2. Constructors
  3. Destructors
  4. Member Functions

Correct answer: Constructors

Q9. What happens if the assignment operator returns non-const reference?

  1. Memory leak occurs
  2. Compilation time increases
  3. Assignment to subexpressions is allowed
  4. Syntax error occurs

Correct answer: Assignment to subexpressions is allowed

Q10. What does return *this; do in an overloaded assignment operator?

  1. Returns a reference to the current object
  2. Returns a pointer
  3. Returns a temporary object
  4. Terminates the function

Correct answer: Returns a reference to the current object

All CS304 files →
CS304 Object Oriented Programming All CS304 handouts, past papers, quizzes and MCQs in one place. Open course page

Get more out of VUBuddy, for free

Android app Free on Google Play
  • Unlimited downloads
  • The explanation behind every MCQ answer
  • Study offline on slow data
Get the Android app
Chrome extension Free on the Chrome Web Store
  • 30 downloads a day instead of 3
  • Sign in and buy Pro Semester here
Add to Chrome

One Pro Semester membership works in both the extension and the app.