¤Virtual University Of Pakistan Network¤







Permalink Reply by Yasmeen(S.admin) on July 21, 2012 at 1:14pm Q: Write down piece of code that will declare a matrix of 3×3 using stream
Q: What is the keyword ‘this’ and what are the uses of ‘this’ pointer?
Q: Write a C++ program that contains a class ‘myClass’ having two data members of type int.
In main function of the program
1. Prompt the user to enter the number of objects to be created.
2. Dynamically allocate memory to objects according to the size entered by user.
3. De-allocate memory that was allocated to objects
Q: one code was to convert in seconds to hr, min & sec..
Q: new, delet operator, stream insertion, nested classes, templates

Permalink Reply by Yasmeen(S.admin) on July 21, 2012 at 1:15pm THANKS MOON

Permalink Reply by Yasmeen(S.admin) on July 27, 2012 at 11:45am Classes defined inside other classes are called ________ classes
► looped
► nested
► overloaded
► none of the given options.
When the compiler overloads the assignment (=) operator by default then __________
► compiler does member wise assignment.
► compiler does not allow default overload of assignment (=) operator
► member of the class are not assigned properly
► None of the given options
YA QUESTION ESKSI AUR TARHAN POCHA THA JS KA JAWAB THA MEMBER WISE ASSIGNMENT
MCQ/Q: Copy constructor KY BOHAT QUESTION THAY ES KI CONCEPT CLEAR HONY CHAIN
MCQ: stream insertion and stream extraction operators
MCQ: Unary and binary operators
Q: 2/ 3 number ka tha
How many bytes will the pointer iPtr of type hexadecimal aur sath mai value dee hoi thee
(x—ff51) and jump to the next position and what is the address iPtr += 4 ;
Which programming tool is helpful in tracing the logical errors?
Debugger
A template function must have at least ---------- generic data type
► Zero
► One
► Two
► Three
► Object of operator class
► Object of different class
► Built-in data type
► All of the given options
The operator function will be implemented as _____, if obj1 drive the - operator whereas obj2 is
passed as arguments to - operator in the statement given below.
obj3 = obj1 - obj2;
► Member function
► Non-member function
► Friend function
► None of the given options
Which one of the following is the declaration of overloaded pre-increment operator implemented as
member function?
► Class-name operator +() ;
► Class-name operator +(int) ;
► Class-name operator ++() ;
► Class-name operator ++(int) ;check from book please
The static data members of a class are initialized _______
► at file scope
► within class definition
► within member function
► within main function
life time of static variable?
What will be the output of following function if we call this function by passing int 5?
template <class T>
T reciprocal(T x)
{
return (1/x);
}
Answer:-
The output will zero as 1/5 and its .05 but conversion to int make it
zero
Above is prototype of template class so assume passing an int and
Answer:
Classname operator ++(); ---- pre increment
Classname operator ++(int) ---- post increment
Matrix m1 = m2;
Answer:-
Unary operator takes only one arguments like i++ or i-- (Post increment or post decrement operators for
integers) or ++i,--i (Pre increment or pre decrement operators for integers) ,we can not make Unary
operator as binary or binary as Unary operator.
To calculate the tax 5% and 7 % to deduct the salary using the switch statement
Full concept of Midterm aur ya question book mai hay kafi ziyda milta hay lakin values change thee lakin idea same tha
5 marks ka 2nd question
-Class String
-Delete pointer
-New sy allocate memory
-Strcpy(s2,s1)
Main()
-String s, *sptr

Permalink Reply by Yasmeen(S.admin) on July 27, 2012 at 11:46am 1. Find the error in following syntax,
while(i<=100)
sum+=i*i;
2. General syntax of declaring and initializing the data members.
3. class String
{
char buf [25];
};
Write code for assignment (=) operator function which assign one String object to other object. Your code should also avoid self assignment.
4. Write a simple program, which will get a stream of character and output the stream of characters using cin and cout.

Permalink Reply by Yasmeen(S.admin) on July 27, 2012 at 11:46am Q.make a program using getline function(5)
Q.make a program using template function select two floating point number and add them with add() function.(5)
Q.make a program take salary and pay tax of 5% if salary is less than 10,000 and pay 7% if the salary is greater than 10,000 using switch function.(5)
Q.what are the function of new and delete ?(3)
Q.what are the stream insertion overloaded operators?(3)

Permalink Reply by Yasmeen(S.admin) on July 27, 2012 at 11:47am Friend function of a class is ______________.
Member function
Non-member function
Private function
Public function
A template function must have at least ---------- generic data type
Zero
One
Two
Three
The object _______________may be used both for file input and file output
fstream,
ifstream,
ofstream,
none of the given options
What should be the return type of the constructor?
void pointer
int
same as object type
constructors do not return any thing
Classes defined inside other classes are called ________ classes.
Looped
Nested
Overloaded
none of the given options.
new operator is used to allocate memory from the free store during
Compile Time
Run Time
Link Time
None of the given options
Which kind of functions can access private member variables of a class?
Friend functions of the class
Private member functions of the class
Public member functions of the class
Friend, private and public functions
The normal source of cin object is
File
Disk
Keyboard
RAM
Which value is returned by the destructor of a class?
A pointer to the class.
An object of the class.
A status code determining whether the class was destructed correctl
Destructors do not return a value.
C is widely known as development language of _______ operating system.
Linux
Windows
Unix
Mac OS
Like member functions, ______ can also access the private data members of a class.
Non-member functions
Friend functions
Any function outside class
None of the given options
The stream insertion and stream extraction operators are already overloaded for ______.
User-defined data types
Built-in data types
User-defined and built-in data types
None of the given options
The appropriate data type to store the number of rows and colums of the matrix is____________.
Float
Int
Char
none of the given options.
A Matrix can be composed of ints, floats or doubles as their elements. Best way is to handle this ,
_______________.
Write a separate class to handle each
Use templates
Use strings to store all types
None of the given options
cout setfill(‘0’) setw(7) 128 ;
0000128
0128128
1280000
0012800
Which of the following is the correct way to declare a variable x of integer type?
x int ;
integer x ;
int x;
x integer
Q.1: Using setw and setfill manipulators to display Virtual--------University.
Q.2: Write a program to display:
If you age is less than or equal to 18 then display "you are child"
if your age is above 18 or less than 35 then display "you are adult"
if your age is is above 60 then display "you are senior citizen"

Permalink Reply by Yasmeen(S.admin) on July 27, 2012 at 11:48am objctv nd subjctv dono k liye stream insertion & stream extraction ke concept bohat ache hone chahiyen.
mooaz file mei se 5-6 objctv they.
total 52 qustn they,
40 were objectives.
5 program they,
qustn 48-52
1-class template add(); 2 variable lene they of float type. unpe add func apply karna tha main mei n then sum return karana tha.
2.what is the difference b/w get() and getline()? explain with coding example.
3.ek program friend function pe tha usko class mei declare kara k cout karana tha.
4.ek program mei +operator ko overload karana tha.and two objcts ka sum karana tha of string type.

Permalink Reply by Yasmeen(S.admin) on July 27, 2012 at 11:48am most of the questions were from past papers.. from moaz's file
there was one long question
Question statement
that we have to calculate the amount of tax on an item purchased by customer ,, tax is 15% and user should input the item's price ..(5 marks)
2nd question was the same setw and setfill one
3rd there was a question we had to write some template but sorry i cannot remember the exact question..
for 3 Marks
Q1. amongst pointer to character or array for string which one is better for string representation and why??
Q2.Static funtion aur non static function ka output batana tha..

Permalink Reply by Yasmeen(S.admin) on July 27, 2012 at 11:49am otal 52 Qs.
40 MCQs, 5 Qs of 2 Marks, 5 Qs of 3 Marks, 3 Qs of 5 Marks
Few Mcqs was from past papers mostly was new.
Same with subjective paper.
If p and q are pointers then whats wrong in the given statement? (2)
Cout p=” p “, p+q = “p+q” endl (something like that)
Code was given an we have to find out errors (2)
Suppose an object of class A is declared as data member of class B. (3)
(i) The constructor of which class will be called first?
(ii) (ii) The destructor of which class will be called first?
if program will take 123 in octal, what it will be in hex? (3)
in one Qs we need to write the output of a code given (3)
The whole code was given and we need make changes in “remove” and “print” etc.
Kuch elements ko remove and add krna tha. (5)
2 Qs were same of correcting the given code.

Permalink Reply by Yasmeen(S.admin) on July 27, 2012 at 11:50am MCQ 20% from past paper
Q Write a program which open a file name “this.txt” and then using write() function, writes the string “Introduction to Programming” at the end of the file.
Q What will be the output of the program:
Int x=10;
Int&y=x;
Y+=5;
Coutx;
Q A two dimensional array has 3 rows and 4 columns. Write down the syntax to initialize first element of all three rows of two dimensional array with value 2.
Q How can we initialize an object which is created as constant data member in another class?
Q An array delare int day[]={1,2,3,4,5,6,7}
How many elements have?
If the declaration ofarray is changed to int days[7]={1,2,3,4,5,6,7}
How many elements have?
Q write general syntax of two way friend relationship between the class(class1, class2).
Give explaination of the code
Martix(int=0,int=0)
Matrix(constMartix&)
~Matrix();
.make a program using getline function(5)

Permalink Reply by PRINCE ZORRO on July 28, 2012 at 4:34pm Nice work yasmeen keep it up
=======================
Popular Social Events
=======================
+ Miss VU
+ Mr VU
---------------------------------------
௵ MR VU,S
௵ ADMINS
ʭ☀Administration☀ʭ
Senior Admin : Yasmeen
VUDESK Owner : Ismail Shah
© 2013 Created by ʭIsmail Shahʭ.
| Awards & Titles |
VUDESK is social networking website created for the students of Virtual University of Pakistan with an aim of providing educational support in terms of subject oriented material such as Assignment,GDB,Quizes Solutions and of course a light entertainment.
Video Profile
Our Community has also Live TV Transmission to facilitate the students for enhancing their skills as well as to take opportunity for doing something they love to do,Check Below Link To Know all about our upcoming transmission and Programs
Radio Asia Live [VUDESK Radio]
EziLive TV