Skip to content
VUBuddy

CS304 Solved Current Papers Fall 2021 by Adil Alvi

Object Oriented Programming PDF 185 KBUpdated 23 Oct 2026
Quiz CS304 Solved Current Papers Fall 2021 by Adil Alvi PDF 185 KB
vubuddy.com
Type
Quiz
Course
CS304 Object Oriented Programming
Size
PDF 185 KB
Updated
23 Oct 2026
Free download 0 of 3 used today
Download free · 185 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, 3 of 8. Download the file for all 8 pages.

CS304 CURRENT PAPERS FALL 2021

Q1. Write key components of STL?

STL consists of three key components • Containers • Iterators • Algorithms

Q2. Protected statement is an exception handling statement comment this statement with explanation?

It means that the normal flow of the program is interrupted and that the runtime environment attempts to find an exception handler—a block of code that can handle a particular type of error.

Q3. Write table of container type and iterative type?

Q4. Write types stack unwinding and explain one type with code?

The process of removing function entries from function call stack at run time is called Stack Unwinding. There are two types of Stack Unwinding

  1. Nested Functions 2) Nested Try catch blocks

1) Nested Try catch blocks

When an exception will be thrown from a try block control will go to catch block of that try block if it is not appropriate catch block then control will go to catch blocks of other try blocks above it one by one, Stack Unwinding will occur in following order in below example,

int main( ) { try { try { throw 1;

catch( float ) { }

catch( int ) {

return 0;

Q5. Write abstract class with example?

An abstract class is a class that is designed to be specifically used as a base class. In C++, we can make a class abstract by making its function(s) pure virtual. Conversely, a class with no pure virtual function is a concrete class (which object can be instantiated)

Q6. Write override function of parent class?

Function overriding is a feature that allows us to have a same function in child class which is already present in the parent class. A child class inherits the data members and member functions of parent class, but when you want to override a functionality in the child class then you can use

Q7. What is Graceful Termination?

Program can be designed in such a way that instead of abnormal termination, that causes the wastage of resources, program performs clean up tasks, mean we add check for expected errors (using if conditions)

Example:

int Quotient (int a, int b ) { if(b == 0){ cout << “Denominator can’t “ << “ be zero” << endl; // Do local clean up exit(1);

return a / b;

Q8. Write Techniques for Error Handling:

  1. Abnormal termination
  2. Graceful termination
  3. Return the illegal value
  4. Return error code from a function e. Exception handling

Q9. What is type parameters?

Type parameters, also known as type variables, are used as placeholders to indicate that a type will be assigned to the class at runtime. The following list contains the standard type parameters for each use case: 1) E: Element, 2) K: Key, 3) N: Number, 4) T: Type, 5) V: Value

Q10. Write types of Copy Constructor?

Default Copy constructor:

The compiler defines the default copy constructor. If the user defines no copy constructor, compiler supplies its constructor.

User Defined constructor:

The programmer defines the user-defined constructor

Q11. Write program to comparing two strings?

#include<string.h> #include<stdio.h>

int main()

char str1[100], str2[100]; cout<<"\n Enter First String : "; gets(str1); cout<<"\n Enter Second String : "; gets(str2); if(strcmp(str1, str2)==0) //strcmp() is a library function, used to compare the two strings.

cout<<"\n Strings are Equal!!!";

else

cout<<"\n Strings are Not Equal!!!";

return 0;

Q12. Write a program with using built-in function?

We create a program to calculate 3^4 using built-in function

#include <cmath>

int main() { int threeExpFour = pow(3, 4); cout << "3^4 is " << threeExpFour << endl; return 0;

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.