CS 201 Final Term Previous Current Paper 2021
PAPER 1
5 to 7 mcqs from past papers of waqar
Q1: difference between default and parameterized constructors.
Q2: use three variable to expose the dec, hex, and oct.
Q3, write c++ programs with three variable salary, no. Of days and rate and salary account by the formula Salary= no.days*rate Take out of no of days with the daily rate of 1000 per day.
Q4: write c++ program with 2 variable 1- calculate rows and columns 2- calculate transpose of matrix
Q5_ function of default function
Q6_ if you agree prototype of ordinary function and special function of a class are same. Justify with comment.
3 questions error find
2 questions output btane wale
2 programs
R 3 ese he short short question the Kn knse operator overload ni ho skte wo btayen Kese pta chlega k new function se memory allocate hue h ya ni  (5 matks)
Consider the following statement :
String *text;
Text = new String[5];
Now we want to delete this array, what happens when we use the following statement? Justify your answer with solid reasons.
Delete text;
Write code which overloads the function named abs1 for integer, double and character data types.
For example, if we pass an integer value to this function, a message should print on screen "using integer abs1", on passing a double type value, the message "using double abs1" and on passing character value, the message "using character abs1" should print.
Read the following code carefully and find out errors in it.
#include <iostream.h>
class A{
public A()
{
cout "n A Constructor ...";
}
~A();
{
cout "n A Destructor ...";
}
}
class B
{
public;
B()
{
cout "n B Constructor ...";
}
~B()
{
cout "n B Destructor ...";
}
private:
A a
};
void main(void)
{
B b;
}
Given is the code for the class myClass.
class myClass
{
private:
int x ;
int y;
public:
myClass()
{
x = 0;
y = 0;
}
};
You are required to write the code to perform the following task in the main() function.
Prompt the user to enter the number of objects to be created.
Dynamically allocate memory to objects according to the size entered by user.
De-allocate memory that was allocated to objects.
Write a program that prompts the user to enter a string and reverse the string using pointers and display the string in reverse order on the output screen. 
Program must input a complete line including spaces (3 marks )
Is it possible to define a function inside the class? If yes, then how does the compiler treat the newly defined function?
Is it possible to define a function inside the class? If yes, then how does the compiler treat the newly defined function?
Suppose an object of class A is declared as data member of class
PAPER 2
1. Write a program which prompts the user to enter a string and reverse the string using pointers and display the string in reverse order on the output screen. Program must input a complete line including spaces(3 marks )
2. Is it possible to define a function inside the class? If yes, then how does the compiler treat the newly defined function?
3. Is it possible to define a function inside the class? If yes, then how does the compiler treat the newly defined function?
4. Suppose an object of class A is declared as data member of class B.
(i) The constructor of which class will be called first?
(ii) The destructor of which class will be called first?
Write a statement for opening file trans.txt for input; using an ifstream object called inTransaction.
What will be the output of the given program code ?
#include <iostream>
using namespace std;
int main ()
{
int n;
n=-77;
cout.width(6);
cout right n endl;
cout.width(6);
cout internal n endl;
cout.width(6);
cout left n endl;
return 0;
}
èIf the requested memory is not available in the system then what does calloc(), malloc() and new operator return?
PAPER 3
Today CS 201 paper
1.Constructor that gave 2 aguments to both mebers (5)
2. This operator is use for?
3. What function is use to free memory allocation 
4. What happens when we not free memory 
array [2][3] number of elements ?
17mcqs  
All paper was from past papers.
PAPER 4
CS 201
09:30Am
Today paper
Total McQs : 16 
Sarey past paper main se ay thy 
Subjective part
Malloc function ka syntax, classes wala topic imp ha output nikalni thi......
Baki easy tha paper ....
PAPER 5
CS 201
9:30
Half mcq past se
Q1 static variable
Q2 restriction on overload operator
Q3 find error
Q4-5 find output
L Q program
PAPER 6
Today paper cs201 17-02-20 30 to 40% From past papers of Moaaz And WaqarBhatti
2 Question on Finding Errors in code 
1 question was on incrementing Date through class 
1 question from pointers i.e getting input from user and reverse the order through pointer
Write a program for array of 10 numbers using float data type and initialize the first 4 numbers at 1.0,2.0,3.0,4.0 (3 marks) We use Malloc or Calloc to allocate memory chuck, what should we check against to know if the allocation of the memory chunk was successful or not. (3 Marks) 
Why do we use delete to free memory? write the code to free memory in the following code (Code consisted new operator but no delete operator to free it just had to enter that in the code) (3 marks) 
Suppose an object in Class A is made an object of Class B(don't exactly remember the wording) For which class the constructor is called for first For which class the destructor is called for first (3 marks) 
Find mistakes in the given code, give reason for the mistakes and also write the correct code. (the program was about Teacher ID and coding consisted of class and constructor) (5 Marks) 
Suppose we want to write a Macro that swaps 2 numbers, what problems can we come across and how do we avoid them? Give 5 affects (5 marks)
2020 final paper cs201
CS 201 important topics final term 
Macros
Memory allocation
Dynamic memory allocation
Memory leak
Dangling pointers
Inline function Vs Macros
Function overloading
Classes and objects with syntax
Constructor and destructor ( complete concept)
New operator
Class Abstraction
Friend Function and classes
Difference between Reference and pointers
Operator overloading
Unary operator
Assignment operator
This operator
Streams
Overloading insertion and extraction operator
Static objects
Call by value and call by reference
Copy constructor
Classes inside classes
Template function and objects
Class Templates
 _I have verified that these topics are important. 
Best of luck_