CS304 Solved Current Papers Fall 2021 by Adil Alvi
- Type
- Quiz
- Course
- CS304 Object Oriented Programming
- Size
- PDF 185 KB
- Updated
- 23 Oct 2026
You get 3 free files a day on the website. Add the Chrome extension for 30 a day.
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
- 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:
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;
Related CS304 files
All CS304 files →- CS304 Highlighted Handouts Lectures 1-45 Set 2 Highlighted PDF 7.7 MB
- CS304 Midterm Notes Midterm PDF 601 KB
- CS304 Grand Quiz Quiz DOCX 4.5 MB
- CS304 GDB Solution 2021 by VUBuddy GDB PDF 456 KB
- CS304 Assignment 2 Fall 2021 Assignment CPP 4 KB
- CS304 Assignment 1 Solution Spring 2021 Assignment PDF 381 KB
Get more out of VUBuddy, for free
- Unlimited downloads
- The explanation behind every MCQ answer
- Study offline on slow data
- 30 downloads a day instead of 3
- Sign in and buy Pro Semester here
One Pro Semester membership works in both the extension and the app.