0% found this document useful (0 votes)
2 views

Programming

The document is a quiz for the course CSE-224 on Object Oriented Programming, consisting of multiple-choice questions, fill-in-the-blank questions, and programming tasks. It covers topics such as membership operators, data types in C++, access specifiers, copy constructors, and the concept of overloading. The quiz also includes practical programming exercises related to factorial calculation and analyzing code outputs.

Uploaded by

amirizaz11
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Programming

The document is a quiz for the course CSE-224 on Object Oriented Programming, consisting of multiple-choice questions, fill-in-the-blank questions, and programming tasks. It covers topics such as membership operators, data types in C++, access specifiers, copy constructors, and the concept of overloading. The quiz also includes practical programming exercises related to factorial calculation and analyzing code outputs.

Uploaded by

amirizaz11
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Course No: CSE-224 Course Title: Object Oriented Programming (Sessional)

QUIZ Full Marks – 22.5 Time – 25 mins


1. Choose the best answer from multiple choices: (5)
(a) Which of the following is a membership operator?
i) ! ii) & iii) :: iv) .
(b) How many data types are there in C++?
i) 1 ii) 2 iii) 3 iv) 4
(c) A protected member of the class is accessible in –
i) Only same class iii) Same class and derived class
ii) Outside the class iv) None of the above
(d) The copy constructor is executed on –
i) Assigned one object to another object on its creation
ii) When objects are sent to function using call by value mechanism
iii) When the function return an object
iv) All of the above
(e) Which of the following OOP’s concept is not used in the following code?
Class A
{
int a;
public:
void print()
{
cout<< “Hello World”;
}
};
i) Inheritance
ii) Polymorphism
iii) Encapsulation
iv) Abstraction

2. Fill the gaps with appropriate answers: (5)


(a) ______________ concept of OOP has allowed the reuse the code.
(b) Encapsulation means __________________________________________
(c) A reference is declared using ____ symbol.
(d) A constructor is called _____ times in the lifetime of an object.
(e) C++ supports ____ types of polymorphism.

3. Show the general forms for new and delete. What are the advantages of using them instead
of malloc() and calloc()? (2)

4. Give two reasons why you might want to overload a class’s constructor. (2)
5. Briefly explain what “overload” keyword does and why it is no longer needed? (2)

6. What is the output of the following programs? (3)


(a) #include<iostream> (b) #include<iostream>
using namespace std; using namespace std;
int x = 5; int fun(int x = 0, int y = 0, int z)
int &f() {
{ return (x + y + z);
return x; )
) int main()
int main() {
{ cout << fun(10);
f() = 10; return 0;
cout<<x; }
}

7. Write a program to find the factorial of a number using call by reference concept. (3.5)

You might also like