CS201 Final Term Paper 30-08-2021
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.
{
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
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 )
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 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?
CS201 Final Term Paper Spring 2021
*Date:* 30-08-2021
*Time:* 12:30pm
*Total Questions:*
22
MCQs 16 (1 Mark)
Short Qs 3 (3 Marks)
Long Qs 3 (5 Marks)
*MCQs 90% From:*
Past Papers
*Short & Long Questions 90% from these Topics:*
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
Tem
Plates
Post a Comment